Aide pour idée et optimisation stratégie

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #136555 quote
    Matt66612
    Participant
    Junior

    Bonjour à tous .

    Je débute depuis quelques semaines , dans le code du training automatique .j’ai eu quelques idées de code .

    je vous partage ici l’embryon d’un code que j’ai mis en place .

    je pense qu’il peut être grandement améliorer, c’est pourquoi je vous demande de l’aide.

    Si certains ont des idées pour améliorer la stratégie et optimiser les paramètres, cela me serait vraiment d’une grande aide.

    Merci ceux qui me liront et me répondront.

    // Définition des paramètres du code
    DEFPARAM CumulateOrders = False // Cumul des positions désactivé
    
    // Conditions pour ouvrir une position acheteuse
    indicator1 = Average[50](close)
    indicator2 = Average[200](close)
    c1 = (indicator1 > indicator2)
    indicator3 = Momentum[200](Momentum[25](close))
    c2 = (indicator3 > 0)
    indicator4 = Momentum[25](close)
    c3 = (indicator4 > 0)
    indicator5 = MACD[5,15,9](MACD[50,200,9](close))
    c4 = (indicator5 CROSSES OVER 0)
    indicator6 = MACD[50,200,9](close)
    c5 = (indicator6 > 0)
    
    IF c1 AND c2 AND c3 AND c4 AND c5 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions pour ouvrir une position en vente à découvert
    indicator7 = Momentum[25](close)
    c6 = (indicator7 < 0)
    indicator8 = Momentum[200](Momentum[25](close))
    c7 = (indicator8 <= 0)
    indicator9 = MACD[5,15,9](MACD[50,200,9](close))
    c8 = (indicator9 CROSSES UNDER 0)
    indicator10 = MACD[50,200,9](close)
    c9 = (indicator10 <= 0)
    indicator11 = Average[50](close)
    indicator12 = Average[200](close)
    c10 = (indicator11 < indicator12)
    
    IF c6 AND c7 AND c8 AND c9 and c10 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    // Stops et objectifs
    SET STOP %LOSS 1
    SET TARGET %PROFIT 1
    
    MACD-momentum-1.3.itf
    #136733 quote
    Nicolas
    Keymaster
    Master

    Je pense qu’il faudrait nous en dire un peu plus ? Par exemple, sur quel type d’instrument et sur quelle unité de temps employer cette stratégie ? Comment sont pris les positions et quelle est le processus décisionnel qui t’a amené à les coder ? Je vois que le risk reward ratio est de 1, as-tu essayé d’augmenter de gérer les prises de profits d’une autre manière ? Merci pour le partage en tout cas.

    #136743 quote
    Matt66612
    Participant
    Junior

    Merci de votre réponse Nicolas.

    C’est une stratégie de daytrading sur le dax30 en Tf 15 min

    Je fais un petit up de la stratégie.

    La stratégie est basé sur un triple Macd , un court un long et un très long avec un filtre à 3 Momentum .

    Le but est de suivre la tendance.

    La stratégie me semble solide mais le nombres de transactions reste faible, j’aimerais augmenté le nombres de transactions , mais je n’ai pas d’idée pour cela.

    Peut être avec un système de boucle .

    j’ai dans le projet d’ajouté un BE peut être que cela peut améliorer le RR.

     

     

    defparam CUMULATEORDERS =false
    defparam flatafter=173000
    defparam flatbefore = 090000
    mymacdc=macd[12,26,9](close)
    mymacdL=macd[48,104,36](close)
    mymacdTL=macd[192,416,154](close)
    mymomc=momentum[14]
    mymomL=momentum[56]
    mymomTL=momentum[224]
    mymmec=ExponentialAverage[20](close)
    mymmeL=ExponentialAverage[200](close)
    
    c1=mymacdL[a]>0
    c2=mymacdL>0
    c3=mymacdTL[a]>0
    c4=mymacdTL>0
    c5=mymacdc crosses over 0
    c6=mymomL[a]>0
    c7=mymomL>0
    c8=mymomTL[a]>0
    c9=mymomTL>0
    c10=mymmec[a]>mymmeL[3]
    c11=mymmec>mymmeL
    c23=mymomc[b] >0
    if c1 and c2 and c3 and c4 and c5 and c6 and c7 and c8 and c9 and c10 and c11 and c23 then
    buy 1 contract at market
    endif
     
    c12=mymacdL[a]<0
    c13=mymacdL<0
    c14=mymacdTL[a]<0
    c15=mymacdTL<0
    c16=mymacdc crosses under 0
    c17=mymomL[a]<0
    c18=mymomL<0
    c19=mymomTL[a]<0
    c20=mymomTL<0
    c21=mymmec[a]<mymmeL[a]
    c22=mymmec<mymmeL
    c24 = mymomc[b]< 0
    if c12 and c13 and c14 and c15 and c16 and c17 and c18 and c19 and c20 and c21 and c22 and c24 then
    SELLSHORT 1 contract at market
    endif
    SET STOP %LOSS 1.5
    set target %profit 3
    
    DAX-15-minutes.png DAX-15-minutes.png
    #138211 quote
    Matt66612
    Participant
    Junior

    Après quelques recherches voici une version qui semble assez robuste.

    je partage ici pour avoir vos idées pour optimiser et améliorer .

    Bien à vous.

    defparam CUMULATEORDERS =false
    defparam PRELOADBARS=3000
    defparam flatafter=220000
    defparam flatbefore = 080000
    
    
    mymacdc=macd[12,26,9](close)
    mymacdL=macd[48,104,36](close)
    mymomTL=momentum[185]
    
    c1 = mymacdL[6]>0
    c2=mymacdc crosses over 0
    c3=mymomTL[6]>0
    if c1 and c2 and c3 then
    buy max(1,taille) contract  at market
    endif
    c4 = mymacdL[6]<0
    c5=mymacdc crosses under 0
    c6=mymomTL[6]<0
    if c4 and c5 and c6 then
    sellshort max(1,taille)  contract at market
    endif
    SET STOP LOSS 70
    SET TARGET PROFIT 196
    startBreakeven = 5
    
    PointsToKeep = 2.5
    
    IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THEN
    
    breakevenLevel = tradeprice(1)+PointsToKeep*pipsize
    ENDIF
    
    IF breakevenLevel>0 THEN
    SELL AT breakevenLevel STOP
    ENDIF
    
    IF NOT ONMARKET THEN
    breakevenLevel=0
    ENDIF
    taille=1
    
    for v = 1 to 10 do
    if positionperf(v)>0 then
    taille=taille+0.1
    else
    taille=1
    endif
    next
    
    rapport.png rapport.png dax-day-15-min-double-macdmom.itf
    #138254 quote
    sophia_etoille83
    Participant
    Average

    Bonjour @Matt666

    Es tu toujours ici ?

    + En ajoutant un trailling Stop (de Nicolas), le % des positions et le ratio augmentent.
    + Et en ajoutant le réinvestissement des gains, on multiplie x3 les gains.
    + sl 0 146 au lieu de 70

    Test fait sur 25000 UT.

    Je pense qu’il y a encore possibilité de faire mieux (ajouter + de trades), je regarderai + en détails ultérieurement, si tu veux.

    Belle journée 🙂

     

    defparam CUMULATEORDERS =false
    defparam PRELOADBARS=3000
    defparam flatafter=220000
    defparam flatbefore = 080000
     
     
    mymacdc=macd[12,26,9](close)
    mymacdL=macd[48,104,36](close)
    mymomTL=momentum[185]
     
    c1 = mymacdL[6]>0
    c2=mymacdc crosses over 0
    c3=mymomTL[6]>0
    
    
    
    //for v = 1 to 10 do
    //if positionperf(v)>0 then
    //taille=taille+0.1
    //else
    //taille=1
    //endif
    //next
    //
    
    Capital=1000
    Marge=3/100
    n=(Capital/1000)+(strategyprofit*1/marge/10000/3)
    
    
    
    
    trailingstart =30//20//
    trailingstep = 5//5//
    
    //========================================================BUY =====================
    if not ONMARKET AND c1 and c2 and c3 then
    buy n contract  at market
    
    endif
    
    SET STOP LOSS 146//70
    //========================================================SHORT=====================
    c4 = mymacdL[6]<0
    c5=mymacdc crosses under 0
    c6=mymomTL[6]<0
    
    if not ONMARKET AND c4 and c5 and c6 then
    sellshort n contract at market
    endif
    
    
    
    //++++++++++++++++++++breaken //////////////////////////////////////////////
    startBreakeven = 5
    PointsToKeep = 2.5
    
    
    IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THEN
     
    breakevenLevel = tradeprice(1)+PointsToKeep*pipsize
    ENDIF
     
    IF breakevenLevel>0 THEN
    SELL AT breakevenLevel STOP
    ENDIF
     
    IF NOT ONMARKET THEN
    breakevenLevel=0
    ENDIF
    //++++++++++++++++++++breaken //////////////////////////////////////////////
    
    
    
    
    
    //reset the stoploss value
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
     
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF
     
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
    newSL = tradeprice(1)-trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
    newSL = newSL-trailingstep*pipsize
    ENDIF
    ENDIF
     
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    
    
    
    Matt66612 thanked this post
    #138300 quote
    Matt66612
    Participant
    Junior

    Merci sophia_etoille83 pour ton retour. Ton aide est la bienvenue.

    #138448 quote
    zilliq
    Participant
    Master

    Attention, plus de gains, c’st plus de volatilité, et donc plus de risque de perte. Ce n’est pas la course qui compte c’est la régularité

    Regarde ton ratio de sharpe, tu dois être au minimum au dessus de 1, idéalement 1.5

    Bon dimanche

    #138555 quote
    sophia_etoille83
    Participant
    Average

    Zilliq,

    Plus de gains = plus de volatilité? Je ne suis pas trop d’accord  🙂
    Par contre sécuriser ses gains au lieu de laisser se transformer des gains en pertes sur des stratégies courts termes, pour moi il y a un gros soucis et cela n’est pas concevable.
    La recette idéale est la suivante = toujours plus de gains sécurisés +  performance positions gagnantes supérieure à 80-85%  et ratio supérieur 2 – 2.5% au minimum

    Voilà ma recette 🙂

    Et celui-ci (au-dessus) est largement supérieur à ça après y avoir ajouté qq bouts de codes (après l’avoir vu tourné évidement) => Le ratio est > à 4 et positions gagnantes > 85% sur 15000 UT soit 108 trades.

    #138561 quote
    Matt66612
    Participant
    Junior

    Tu penses que 15k ut c’est suffisant pour savoir si une stratégie est solide ?

    #138567 quote
    sophia_etoille83
    Participant
    Average

    Normalement non, je fais sur tout l’historique passé puis ensuite par zone.
    Le marché évolue et ne réagit pas de la même façon sur certaines périodes.

    Si les 100 derniers trades, les stats sont tres mauvaises alors c’est qu’il y a un problème. Mais ce n’est que mon avis.
    Je ne mets en place que des stratégies qui refletent mon trading manuel, donc les mauvais trades sont identifiables: certains ne peuvent pas être éviter et d’autres oui…

    #138568 quote
    sophia_etoille83
    Participant
    Average

    Si vous avez netfix, il y a un super reportage sur les probabilités mathématiques 🙂

    #138583 quote
    Matt66612
    Participant
    Junior

    OK merci pour l’info. Je vais regardé ce reportage, cela peut être intéressant.

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

Aide pour idée et optimisation stratégie


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
Matt66612 @matt66612 Participant
Summary

This topic contains 11 replies,
has 4 voices, and was last updated by Matt66612
5 years, 8 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 06/19/2020
Status: Active
Attachments: 4 files
Logo Logo
Loading...