signification "initial" sur ancienne version

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #20971 quote
    manoit
    Participant
    New

    Bonjour,

    La constante initial (manifestement du même ordre que low, close, etc…) présente dans un indicateur codé dans une précédente version de Probuilder m’est inconnue. Bien entendu, le code ne fonctionne plus.

    Y a t-il un équivalent dans le langage actuel? ou bien si je pouvais connaître sa signification pour pouvoir le programmer

    Merci par avance

    #21000 quote
    Nicolas
    Keymaster
    Master

    Sauf erreur de ma part, l’instruction ou constante “initial” n’a jamais été utilisé dans le langage de programmation de ProRealTime. Il peut s’agir d’une erreur de copier/coller ou d’une ligne de commentaire qui a été dé-commenté ?

    Avec une vision du code, on pourra sans doute dépanner ce problème sans soucis 🙂

    #21007 quote
    manoit
    Participant
    New
    if barindex = 0 then
    
    islong = 1
    reverse = 0
    af = initial
    highvalue = high
    lowvalue = low
    
    prevhighvalue = high
    prevlowvalue = low
    mysar = lowvalue
    
    else
    
    highvalue = max(highvalue, high[1])
    lowvalue = min(lowvalue, low[1])
    
    if islong then
    if low[1] < mysar then reverse = 1 islong = 0 endif else if high[1] > mysar then
    reverse = 1
    islong = 1
    endif
    endif
    
    if islong then
    if reverse then
    mysar = lowvalue
    af = 0.02
    lowvalue = low[1]
    highvalue = high[1]
    else
    if (highvalue > prevhighvalue and af < 0.2) then af = af + min(0.02, (0.2-af)) endif mysar = mysar + af * (highvalue - mysar) mysar = min(mysar, low[1]) if (barindex > 1) then
    mysar = min(mysar, low[2])
    endif
    endif
    
    else
    if reverse then
    mysar = highvalue
    af = 0.02
    lowvalue = low[1]
    highvalue = high[1]
    else
    if (lowvalue < prevlowvalue and af < 0.2) then af = af + min(0.02, (0.2-af)) endif mysar = mysar + af * (lowvalue - mysar) mysar = max(mysar, high[1]) if (barindex > 1) then
    mysar = max(mysar, high[2])
    endif
    endif
    endif
    
    prevhighvalue = highvalue
    prevlowvalue = lowvalue
    reverse = 0
    
    REM anticipation du prochain cours
    newhighvalue = max(highvalue, high)
    newlowvalue = min(lowvalue, low)
    
    if islong then
    if low < mysar then newmysar = highvalue else if (newhighvalue > prevhighvalue and af < 0.2) then newaf = af + min(0.02, (0.2-af)) else newaf = af endif newmysar = mysar + newaf * (newhighvalue - mysar) newmysar = min(newmysar, low) newmysar = min(newmysar, low[1]) endif else if high > mysar then
    newmysar = lowvalue
    else
    if (newlowvalue < prevlowvalue and af < 0.2) then
    newaf = af + min(0.02, (0.2-af))
    else
    newaf = af
    endif
    newmysar = mysar + newaf * (newlowvalue - mysar)
    newmysar = max(newmysar, high)
    newmysar = max(newmysar, high[1])
    endif
    endif
    
    endif
    
    return newmysar

     

    Merci pour la réponse, alors je ne comprends plus…il ne peut s’agir d’un commentaire, mais bien d’une définition de variable…

    Il n’y a eu aucun effacement…

    Merci par avance.

    #21008 quote
    Nicolas
    Keymaster
    Master

    “initial” devait être une variable externe à renseigner avec une valeur quelconque, je lui ai ici affecté la valeur 0.02.

    J’ai revu un peu le code et ça fonctionne désormais, voici le code corrigé ci-dessous et un exemple du rendu à l’écran. Cela ressemble à ce que tu souhaitais obtenir ?

    once islong = 1
    once reverse = 0
    once af = 0.02//initial
    once highvalue = high
    once lowvalue = low
    
    once prevhighvalue = high
    once prevlowvalue = low
    once mysar = lowvalue
    
    if barindex>10 then 
    highvalue = max(highvalue, high[1])
    lowvalue = min(lowvalue, low[1])
    
    if islong then
    if low[1] < mysar then 
    reverse = 1 
    islong = 0 
    endif 
    else 
    if high[1] > mysar then
    reverse = 1
    islong = 1
    endif
    endif
    
    if islong then
    if reverse then
    mysar = lowvalue
    af = 0.02
    lowvalue = low[1]
    highvalue = high[1]
    else
    if (highvalue > prevhighvalue and af < 0.2) then 
    af = af + min(0.02, (0.2-af)) 
    endif 
    mysar = mysar + af * (highvalue - mysar) 
    mysar = min(mysar, low[1]) 
    if (barindex > 1) then
    mysar = min(mysar, low[2])
    endif
    endif
    
    else
    if reverse then
    mysar = highvalue
    af = 0.02
    lowvalue = low[1]
    highvalue = high[1]
    else
    if (lowvalue < prevlowvalue and af < 0.2) then 
    af = af + min(0.02, (0.2-af)) 
    endif 
    mysar = mysar + af * (lowvalue - mysar) 
    mysar = max(mysar, high[1]) 
    if (barindex > 1) then
    mysar = max(mysar, high[2])
    endif
    endif
    endif
    
    prevhighvalue = highvalue
    prevlowvalue = lowvalue
    reverse = 0
    
    REM anticipation du prochain cours
    newhighvalue = max(highvalue, high)
    newlowvalue = min(lowvalue, low)
    
    if islong then
    if low < mysar then 
    newmysar = highvalue 
    else 
    if (newhighvalue > prevhighvalue and af < 0.2) then 
    newaf = af + min(0.02, (0.2-af)) 
    else 
    newaf = af 
    endif 
    newmysar = mysar + newaf * (newhighvalue - mysar) 
    newmysar = min(newmysar, low) 
    newmysar = min(newmysar, low[1]) 
    endif 
    else 
    if high > mysar then
    newmysar = lowvalue
    else
    if (newlowvalue < prevlowvalue and af < 0.2) then
    newaf = af + min(0.02, (0.2-af))
    else
    newaf = af
    endif
    newmysar = mysar + newaf * (newlowvalue - mysar)
    newmysar = max(newmysar, high)
    newmysar = max(newmysar, high[1])
    endif
    endif
    endif
    
    return newmysar
    indicateur-prorealtime-sar.png indicateur-prorealtime-sar.png sar-prediction.png sar-prediction.png
    #21012 quote
    manoit
    Participant
    New
    Merci beaucoup!
    je ne pourrai le tester que la semaine prochaine. mais ça semble OK et …mieux (je n’étais pas l’auteur)!
    ravi d’avoir découvert tes compétences! Je n’en abuserai pas, mais c’est un filet de sécurité très appréciable lorsque je “sèche”.
    Bien cordialement
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

signification "initial" sur ancienne version


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
manoit @manoit Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by manoit
9 years, 1 month ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 01/13/2017
Status: Active
Attachments: No files
Logo Logo
Loading...