Un seul trade perdant par jour

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #177480 quote
    clasch
    Participant
    Senior

    Bonjour,

    J’ai vu dans le forum plusieurs codages pour qu’il n’y ait un seul trade par jour.

    Mais je souhaiterais rajouter une condition : Arrêt du code pour la journée, dès qu’un trade est perdant. Tant qu’il y a des trades gagnant, l’algorithme doit continuer à “travailler” !

    Quelqu’un aurait-il une idée ? Merci d’avance.

    Bonne journée,

    Claudio

    #177483 quote
    Swingueur
    Participant
    Average

    Bonjour,
    Il devrait etre possible d’utiliser un systeme de ‘flag’:
    – Si on commence une journee la variable est a 1 (ou 0)
    – On prend des trades tant que cette variable est a la bonne valeur
    – Quand on vend, on compare le close avec POSITIONPRICE pour savoir le statut du trade, et si c’est perdant, on passe cette variable a 0.

    #177484 quote
    robertogozzi
    Moderator
    Master

    À la fin de l'opération, il est nécessaire de comparer le STRATEGYPROFIT actuel avec le précédent.

    Swingueur thanked this post
    #177494 quote
    Nicolas
    Keymaster
    Master

    A tester avec cette fonction pour arrêter le trading pour la journée après un trade perdant.

    if strategyprofit<strategyprofit[1] then 
     notrade = 1
    endif 
    
    if intradaybarindex=0 then 
     notrade = 0
    endif 
    
    if not notrade then 
     // code de trading 
    endif
    #177498 quote
    Swingueur
    Participant
    Average

    Si on fait du trend following en intraday, on peut sortir avec STRATEGYPROFIT en baisse par rapport a la periode precedente, non? (on “rend au marche” en fin de trade en general.)
    J’utiliserais plutot une variable intermediaire initialisee au moment de l’entree en position. Mais bon, a tester.

    IF Day <> Day[1] THEN
    notrade = 0
    ENDIF
    
    IF NOT OnMarket and conditions and notrade=0 THEN
    ... // Trade conditions
    previousProfit = STRATEGYPROFIT
    ENDIF
    ... // SL & TP conditions or exit conditions
    
    IF NOT OnMarket and OnMarket[1] and STRATEGYPROFIT<previousProfit THEN
    notrade=1
    ENDIF
    
    
    
    Nicolas thanked this post
    #177522 quote
    clasch
    Participant
    Senior

    Un grand merci pour vos propositions de codage.

    Lorsque j’aurai testé, je reviendrai ici pour un retour !

    Merci encore.

    #177553 quote
    clasch
    Participant
    Senior

    Nicolas, merci le code fonctionne bien chez moi.

    Swingueur, merci mais le code ne fonctionne pas bien chez moi (il donne un résultat différent, mais pas celui recherché).

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

Un seul trade perdant par jour


Support ProOrder

New Reply
Author
author-avatar
clasch @clasch Participant
Summary

This topic contains 6 replies,
has 4 voices, and was last updated by clasch
4 years, 4 months ago.

Topic Details
Forum: Support ProOrder
Language: French
Started: 09/14/2021
Status: Active
Attachments: No files
Logo Logo
Loading...