Signal sur Heiken Heishi

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #103093 quote
    Sofitech
    Participant
    Master

    J’aimerais créer un signal lorsque des bougies Heiken Heishi présentent certaines conditions.
    Achat lorsque 2 bougies sont vertes et sans mèche basse
    Vente lorsque 2 bougies sont rouges et sans mèche haute..
    J’ai essayé ce code mais cela ne donne aucun signal, quelqu’un voit l’erreur  ??

    haclose=(open+close+low+high)/4
    haopen=(haopen[1]+haclose[1])/2
    xHigh = Max(haOpen, haClose)
    xLow = Min(haOpen, haClose)
    hahigh = Max(High,xHigh)
    halow = Min(Low,xLow)
    
    
    if haclose[2]>haopen[2] and haclose[1]>haopen[1] and haopen[2]=halow[2] and haopen[1]=halow[1] then
    signal=1
    endif
    if haclose[2]<haopen[2] and haclose[1]<haopen[1] and haopen[2]=hahigh[2] and haopen[1]=hahigh[1] then
    signal=-1
    endif
    return signal
    #103129 quote
    Nicolas
    Keymaster
    Master

    Il faut à minima une barre d’historique pour ton calcul de bougies Heikin Ashi fonctionne: (on teste donc si le barindex est supérieur à 1)

    if barindex>1 then 
    haclose=(open+close+low+high)/4
    haopen=(haopen[1]+haclose[1])/2
    xHigh = Max(haOpen, haClose)
    xLow = Min(haOpen, haClose)
    hahigh = Max(High,xHigh)
    halow = Min(Low,xLow)
    endif
    
    if haclose[2]>haopen[2] and haclose[1]>haopen[1] and haopen[2]=halow[2] and haopen[1]=halow[1] then
    signal=1
    endif
    if haclose[2]<haopen[2] and haclose[1]<haopen[1] and haopen[2]=hahigh[2] and haopen[1]=hahigh[1] then
    signal=-1
    endif
    return signal
    #156189 quote
    Alai-n
    Participant
    Veteran

    Bonjour,

    En partant de l’idée du signal généré par ce code…

    Comment puis-je le faire déclencher sur une plage horaire bien définie, par exemple 10h à 12h ???

    J’ai essayé “currentHour”, “currentTime”, “Time”, je n’arrive à rien! Soit le “Signal 1” m’affiche toute la plage horaire de 10h à 12h00, soit le “Signal 1” affiche bien la bonne configuration Heikin Ashi mais sûr n’importe quelle plage horaire dans la journée!!!

    Si quelqu’un avait une piste à partager, je suis preneur.

    Merci

    #156204 quote
    Sofitech
    Participant
    Master

    @Alai-n

    Pour être sûr de bien comprendre… tu veux que l’indicateur ne soit fonctionnel pour indiquer un signal qu’entre 10h et 12h ?

    Mais si c’est dans le cadre d’une stratégie pro-order tu peux simplement utiliser les fonctions “Flatbefore” et “Flatafter” en début de code (ex : Defparam flatbefore = 100000). Ainsi, même si l’indicateur fonctionne H24, la stratégie n’en exploitera les signaux que dans la tranche horaire définie.

    #156221 quote
    Alai-n
    Participant
    Veteran

    Merci pour ta réponse, mais c’est dans le cadre de “Probuilder” que je souhaiterai le faire fonctionner!!!

    Si quelqu’un a une idée…

    #156297 quote
    Sofitech
    Participant
    Master

    On peut avoir un code comme celui avec l’indication “time”.

    signal=0
    Ctime = time >= 100000 and time <= 120000
    if barindex>1 then
    haclose=(open+close+low+high)/4
    haopen=(haopen[1]+haclose[1])/2
    xHigh = Max(haOpen, haClose)
    xLow = Min(haOpen, haClose)
    hahigh = Max(High,xHigh)
    halow = Min(Low,xLow)
    endif
     
    if haclose[2]>haopen[2] and haclose[1]>haopen[1] and haopen[2]=halow[2] and haopen[1]=halow[1] and ctime then
    signal=1
    endif
    if haclose[2]<haopen[2] and haclose[1]<haopen[1] and haopen[2]=hahigh[2] and haopen[1]=hahigh[1] and ctime then
    signal=-1
    endif
    return signal
    #156328 quote
    Alai-n
    Participant
    Veteran

    @Sofitech

    Merci beaucoup de ton aide, cela fonctionne enfin…

    Vaut mieux un qui sait que dix qui cherchent! Encore merci.

    Bonne soirée

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Signal sur Heiken Heishi


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Sofitech @sofitech Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by Alai-n
5 years, 2 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 07/22/2019
Status: Active
Attachments: No files
Logo Logo
Loading...