MME / supertrend / ATR

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #198601 quote
    thibault76
    Participant
    New

    Bonjour,

    Pourriez vous svp me faire un système de trading avec les conditions suivantes car je n’y connais rien en programmation :

    Sur le futur CAC avec 2 contrats :

    En ut 30 min : à l’achat avec prix en bougies japonaises : croisement haussier de la moyenne mobile exponentielle (mme) 9 sur la (mme) 34 si le supertrend est haussier (filtre). Vente d’un contrat futur si hésitation d’une première bougie heikin Ashi
    Fin total du trade si bougie heikin Ashi devient intégralement rouge c’est à dire pleine (cf pj).
    Stop loss : 0.8 fois l’Atr

    En ut 30 min. à la vente avec prix en bougies japonaises : croisement baissier de la moyenne mobile exponentielle 9 sous la mme 34 si le supertrend est baissier (filtre). Vente d’un contrat futur si hésitation d’une première bougie heikin Ashi
    Fin total du trade si bougie heikin Ashi devient intégralement verte c’est à dire pleine (cf pj)
    Stop loss : 0.8 fois l’Atr

    NB : peu importe la force du croisement faible ou forte des MME

    Merci beaucoup

    Cordialement,

    Thibault

    Capture-bougies-pleines.jpg Capture-bougies-pleines.jpg Capture-Bougies-HA-dindecision.jpg Capture-Bougies-HA-dindecision.jpg
    #198608 quote
    JC_Bywan
    Moderator
    Master

    Bonjour, premier jet à tester sur UT30, version juste achat pour commencer, car selon ce que tu appelles “hésitation” sans la spécifier, et si “pleine rouge” n’est pas “sans mèches” (je n’en vois pas sur la pj), il faudra peut-être apporter des modifications avant de pouvoir ajouter son équivalent en vad.

    ema9 = ExponentialAverage[9](close)
    ema34 = ExponentialAverage[34](close)
    monST = SuperTrend[3,10]
    monatr = AverageTrueRange[14](close)
    
    HAClose=totalprice
    if barindex>1 then
    HAOpen=(HAOpen[1]+HAClose[1])/2
    else
    HAOpen = totalprice
    endif
    HAHigh=Max(high,Max(HAOpen, HAclose))
    HALow=Min(low,Min(HAOpen, HAclose))
    
    c1 = ema9 CROSSES OVER ema34
    c2 = (monST >= monST[1])
    
    if not longonmarket and c1 AND c2 THEN
    BUY 2 CONTRACT AT MARKET
    monstop=0.8*monatr
    endif
    
    if countofposition=2 and HAclose<=HAopen then
    SELL 1 CONTRACT AT MARKET
    endif
    
    if countofposition=1 and HAclose=HAlow and HAopen=HAhigh then
    SELL 1 CONTRACT AT MARKET
    endif
    
    set stop loss monstop
    
    graph monstop
    #198639 quote
    thibault76
    Participant
    New

    Bonjour

    Merci beaucoup !

    Pour te répondre :

    • bougie heikin Ashi (HA) d’hésitations à coder = bougie verte ou rouge avec 2 mèches de chaque coté de la bougie HA
    • bougie heikin Ashi (HA) verte de continuation = bougie avec soit un corps vert sans mèches soit avec un corps vert avec une seule mèche en haut de la bougie HA
    • bougie heikin Ashi (HA) rouge de continuation = bougie avec soit un corps rouge sans mèches soit un corps rouge avec une seule mèches en bas de la bougie HA

    Pour rappel : vente d’un contrat futur si hésitation d’une première bougie heikin Ashi et continuation toujours du trade en cas de bougie Heikin ashi de continuation

    Pourrais tu stp modifier ton code en fonction de ces éléments demandés ?

    Je te remercie infiniment.

    Cordialement

    Thibault

    #198656 quote
    JC_Bywan
    Moderator
    Master

    Ok, autant l’hésitation est bien définie et j’ai modifié, autant j’ai encore un petit doute restant sur la sortie car tu me parles de “continuation toujours du trade en cas de bougie Heikin ashi de continuation”. Je vais supposer qu’on parle de sortie sur bougie de continuation opposée? Si oui, voici:

    ema9 = ExponentialAverage[9](close)
    ema34 = ExponentialAverage[34](close)
    monST = SuperTrend[3,10]
    monatr = AverageTrueRange[14](close)
    
    HAClose=totalprice
    if barindex>1 then
    HAOpen=(HAOpen[1]+HAClose[1])/2
    else
    HAOpen = totalprice
    endif
    HAHigh=Max(high,Max(HAOpen, HAclose))
    HALow=Min(low,Min(HAOpen, HAclose))
    
    c1 = ema9 CROSSES OVER ema34
    c2 = (monST >= monST[1])
    
    if not longonmarket and c1 AND c2 THEN
    BUY 2 CONTRACT AT MARKET
    monstop=0.8*monatr
    endif
    
    //Sortie partielle si bougie HA d'hésitation
    if countofposition=2 and max(HAclose,HAopen)<HAhigh and min(HAclose,HAopen)>HAlow then
    SELL 1 CONTRACT AT MARKET
    endif
    
    //Sortie du reste si bougie HA de continuation opposée
    if countofposition=1 and HAclose>=HAlow and HAopen=HAhigh then
    SELL 1 CONTRACT AT MARKET
    endif
    
    set stop loss monstop
    
    graph monstop
    #198659 quote
    thibault76
    Participant
    New

    Salut

    J’ai essayé mais malheureusement ca ne fonctionne pas. Il y a une erreur de syntaxe en ligne 24. Erreur indiquée : “commande inconnue”. Pourrais tu stp voir ceci ?

    Cordialement

    Thibault

    Capture.jpg Capture.jpg
    #198665 quote
    JC_Bywan
    Moderator
    Master

    Pas mal de caractères consécutifs ont disparu dans ta ligne 24 par rapport à la mienne, sans doute une petite fausse manip au clavier immédiatement après le copier-coller…

    #198667 quote
    thibault76
    Participant
    New

    En effet ca fonctionne très bien ! Désolé. C’était un souci de copier coller de ma part.

    Je trouve que le code est très bien, merci beaucoup. Quand tu auras le temps pourrais tu stp me faire aussi à la suite de ton code, celui pour la vente ?

    #198720 quote
    JC_Bywan
    Moderator
    Master

    Voici:

    ema9 = ExponentialAverage[9](close)
    ema34 = ExponentialAverage[34](close)
    monST = SuperTrend[3,10]
    monatr = AverageTrueRange[14](close)
    
    HAClose=totalprice
    if barindex>1 then
    HAOpen=(HAOpen[1]+HAClose[1])/2
    else
    HAOpen = totalprice
    endif
    HAHigh=Max(high,Max(HAOpen, HAclose))
    HALow=Min(low,Min(HAOpen, HAclose))
    
    // Achat
    c1 = ema9 CROSSES OVER ema34
    c2 = (monST >= monST[1])
    if not longonmarket and c1 AND c2 THEN
    BUY 2 CONTRACT AT MARKET
    monstop=0.8*monatr
    endif
    
    // Sortie partielle si bougie HA d'hésitation
    if countofposition=2 and max(HAclose,HAopen)<HAhigh and min(HAclose,HAopen)>HAlow then
    SELL 1 CONTRACT AT MARKET
    endif
    
    // Sortie du reste si bougie HA de continuation opposée
    if countofposition=1 and HAclose>=HAlow and HAopen=HAhigh then
    SELL 1 CONTRACT AT MARKET
    endif
    
    // vad
    c3 = ema9 CROSSES UNDER ema34
    c4 = (monST <= monST[1])
    if not shortonmarket and c3 AND c4 THEN
    SELLSHORT 2 CONTRACT AT MARKET
    monstop=0.8*monatr
    endif
    
    //Sortie partielle si bougie HA d'hésitation
    if countofposition=-2 and max(HAclose,HAopen)<HAhigh and min(HAclose,HAopen)>HAlow then
    EXITSHORT 1 CONTRACT AT MARKET
    endif
    
    //Sortie du reste si bougie HA de continuation opposée
    if countofposition=-1 and HAopen=HAlow and HAclose<=HAhigh then
    EXITSHORT 1 CONTRACT AT MARKET
    endif
    
    set stop loss monstop
    
    graph monstop
    #198736 quote
    thibault76
    Participant
    New

    Bonjour

    Tu es un géni !

    Le code fonctionne bien mieux notamment en UT15 et UT2h.

    Dernière chose stp : serait ce possible que tu améliores les entrées sur les bougies japonaises?

    Pour rappel les entrées se font sur les bougies japonaises, et les sorties sur bougies Heikin Ashi

    En effet parfois les entrées se font quelques bougies japonaises plus loin que le croisement des moyennes mobiles. Voici en pj une capture d’écran.

    Pas idéal de voir avec les captures, serait ce possible par hasard de faire un visio 5 min cette semaine quand tu auras le temps ?

    Capture2.jpg Capture2.jpg
    #198836 quote
    JC_Bywan
    Moderator
    Master

    Pas évident de voir sur la capture écran s’il y a retard ou pas, parfois on peut croire que ça a croisé sur une bougie mais peut-être qu’en zoomant c’était en fait croisé sur la suivante, donc le code est lu une plus tard que ce qu’on croyait, et l’entrée faite au début de celle d’après. Si par contre il y a un exemple avec plus d’écart que ça, alors, au cas où, il faut vérifier que les ema et le supertrend à l’écran ont bien les mêmes paramètres que ceux du code proorder pour être sûr.

    #198885 quote
    thibault76
    Participant
    New

    Ok merci beaucoup

    #198886 quote
    thibault76
    Participant
    New

    Re ce système de trading parait être rentable même si les performances futures peuvent être différentes.

    Dernière chose stp :

    Pour comparer les résultats, pourrais tu stp me faire le même code sans la partie Heikin Ashi. Voici la nouvelle hypothèse : le trade prend fin uniquement lors du croisement des moyennes mobiles exponentielles. Serait ce possible stp ?

    #198975 quote
    JC_Bywan
    Moderator
    Master

    Bonjour,

    Sans Heikin-Ashi, avec sortie sur seul croisement inverse des ema:

    ema9 = ExponentialAverage[9](close)
    ema34 = ExponentialAverage[34](close)
    monST = SuperTrend[3,10]
    monatr = AverageTrueRange[14](close)
    
    c1 = ema9 CROSSES OVER ema34
    c2 = (monST >= monST[1])
    c3 = ema9 CROSSES UNDER ema34
    c4 = (monST <= monST[1])
    
    // Achat
    if not longonmarket and c1 AND c2 THEN
    BUY 2 CONTRACT AT MARKET
    monstop=0.8*monatr
    endif
    
    // Sortie
    if countofposition=2 and c3 then
    SELL 2 CONTRACT AT MARKET
    endif
    
    // vad
    if not shortonmarket and c3 AND c4 THEN
    SELLSHORT 2 CONTRACT AT MARKET
    monstop=0.8*monatr
    endif
    
    // Sortie
    if countofposition=-2 and c1 then
    EXITSHORT 2 CONTRACT AT MARKET
    endif
    
    set stop loss monstop
    #198976 quote
    thibault76
    Participant
    New

    Merci beaucoup !

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

MME / supertrend / ATR


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
thibault76 @thibault76 Participant
Summary

This topic contains 13 replies,
has 2 voices, and was last updated by thibault76
3 years, 6 months ago.

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