Barindex > 50 ???

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #203981 quote
    wtangsiri
    Participant
    Junior

    Bonjour Nicolas

    Dans un sous-programme (indicateur caché) que tu as écrit
    je n’ai pas compris la séquence suivante :
    “if barindex>bandedge then”

    Pourquoi testes tu barindex > 50 ?

    Merci pour ton éclairage qui m’est très précieux

     

     

    Indicator needed to run the strategy (“PRICE ACTION BUND”)
    
    // UNIVERSAL CODE POSTED BY NICOLAS
    
    // INDICATOR PRICE ACTION BUND
    bandedge=50
    
    whitenoise= (Close - Close[50])
    if barindex>bandedge then
    // super smoother filter
     a1= Exp(-1.414 * 3.14159 / bandedge)
     b1= 2*a1 * Cos(1.414*180 /bandedge)
     c2= b1
     c3= -a1 * a1
     c1= 1 - c2 - c3
     filt= c1 * (whitenoise + whitenoise[1])/2+ c2*filt[1] + c3*filt[1]
    
     filt1 = filt
    
      if ABS(filt1)>pk[1] then
       pk = ABS(filt1)
      else
       pk = 0.99* pk[1]
      endif
      if pk=0 then
       denom = -1
      else
       denom = pk
      endif
    
      if denom = -1 then
       result = result[1]
      else
       result = filt1/pk
      endif
    endif
    RETURN result COLOURED(66,66,205) as "PRICE ACTION", 0 as "0"
    
    #203985 quote
    JC_Bywan
    Moderator
    Master

    Bonjour,

    Tant que barindex est plus petit que 50, alors whitenoise=close-close[50] de la ligne 8 n’existe pas encore car close[50] n’existe pas encore, whitenoise est donc « undefined » pour commencer.

    Whitenoise n’existe qu’à partir du barindex=50 (le premier barindex étant 0), et il y en a besoin dans le calcul de filt en ligne 16, et comme il y faut aussi le whitenoise de la barre précédente, la ligne 16 ne donnera autre chose qu’undefined qu’à partir de la barre qui suit 50, d’où la ligne 9 “if barindex>bandedge” (strictement supérieur à bandedge=50).

    NB : n’étant pas impliqué dans la création de ce code, je ne peux pas ajouter s’il vaut mieux le blinder en précisant que bandedge doit être >=50 pour éviter un choix utilisateur inférieur à 50 qui ne serait pas compatible avec la ligne 8 définissant whitenoise, ou bien s’il vaut mieux modifier la ligne 8 en whitenoise= (Close Close[bandedge])

    wtangsiri thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Barindex > 50 ???


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
wtangsiri @wtangsiri Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by JC_Bywan
3 years, 10 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 11/11/2022
Status: Active
Attachments: No files
Logo Logo
Loading...