Arrêter le système jusqu'au lendemain

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #100338 quote
    LifenLifen
    Participant
    Senior

    Bonsoir,

    Tout d’abord un grand merci à Nicolas et à tous les participants de ce forum riche en informations.

    Je souhaiterais arrêter un programme jusqu’au lendemain dès qu’un nombre de points a été réalisé (avec plusieurs opérations dans la journée). Par exemple dès que 20 points ont été atteints, sachant que chaque opération a un tp5 donc cela veut dire 4 opérations dans la journée.

    Idem si  X points sont touchés en S/L

    Merci d’avance de votre aide.

    #100341 quote
    NicolasNicolas
    Keymaster
    Legend

    Ce petit code snippet ci-dessous reprend le gain et la perte maximale autorisée par jour, en points:

    MaxProfit = 50 //max daily profit objective in pips
    MaxLoss = 40 //max daily loss in pips
    
    //max profit/loss achieved
    if day<>day[1] then 
    strategyprofitpoint=0 //daily reset 
    endif 
    if(strategyprofit<>strategyprofit[1]) then
    pnl = strategyprofit-strategyprofit[1]
    size = max(startContract,abs(countofposition[1]))
    onepos = pnl/size
    pointprofit = onepos/pointvalue
    strategyprofitpoint = strategyprofitpoint+pointprofit
    endif
    allowtrading=1
    if (strategyprofitpoint>=MaxProfit or strategyprofitpoint<=-MaxLoss) then
    allowtrading=0
    endif

    La variable booléenne allowtrading autorise ou non le trading, il suffit de l’employer dans tes conditions de trading de ta stratégie.

    Jean-Christophe and aldtrading thanked this post
    #100348 quote
    LifenLifen
    Participant
    Senior

    Un grand merci Nicolas pour ta réactivité, c’est parfait !

    Bonne soirée

    #240209 quote
    YvesRobertYvesRobert
    Participant
    Average

    Bonjour,

    Est ce que ce code est correct pour que le trading s’arrête si on a un nombre de perte max dans la journée sur le nasdaq par exemple ?

    Merci pour votre réponse.

    Je l’ai adapté.

    if day<>day[1] then
    strategyprofitpoint=0 //daily reset
    allowtrading=1            //daily reset
    endif

    if(strategyprofit<>strategyprofit[1]) then
    pnl = strategyprofit-strategyprofit[1]
    totalstrategyprofit = totalstrategyprofit+pnl
    endif

    if totalstrategyprofitpoint<=-MaxLoss then
    SELL AT MARKET
    EXITSHORT AT MARKET
    allowtrading=0
    ENDIF

    #240211 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Oui, mais la ligne 2 doit s’écrire ainsi:

    totalstrategyprofitpoint=0 //daily reset
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Arrêter le système jusqu'au lendemain


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
Lifen @lifen Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by robertogozzirobertogozzi
1 year, 11 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 06/10/2019
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...