calculer le nombre de contrat

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #201610 quote
    Jules100912Jules100912
    Participant
    New

    bonjour,

    Mon TP se situe à tp=close-(close-(SuperTrend-close)*2) de mon point d’entrée ET mon SL se situe au niveau de ma Supertrend.

    Je n’arrive pas à faire en sorte que mon SL et TP aient toujours une valeur en euro fixe (ex: SL =10e et TP=20e).

    Je pense que je dois calculer le nombre de contrat en fonction de la distance à laquelle le TP et SL se trouvent, mais malheureusement je n’y arrive pas.

    Quelqu’un saurait m’aider?

     

    tpst = CALL "Mon tp st"[DTP] //tp=close-(close-(ST-close)*x)
    SL=ST1-close
    
    // Conditions pour ouvrir une position acheteuse
    IF NOT LongOnMarket AND achat1 AND achat2 AND achat3 THEN
    BUY 2 CONTRACTS AT MARKET   // à la place de 2 contrats j'aimerais mettre une formule qui fait varier le nombre de contrat
    SET STOP pTRAILING SL
    SET TARGET PPROFIT tpst
    ENDIF
    
    
    
    // Conditions pour ouvrir une position en vente à découvert
    IF NOT ShortOnMarket AND vente1 AND vente2 AND vente3 THEN
    SELLSHORT 2 CONTRACTS AT MARKET
    SET STOP pTRAILING SL
    SET TARGET PPROFIT tpst
    ENDIF

    Merci d’avance

    #201631 quote
    NicolasNicolas
    Keymaster
    Legend

    Tu peux calculer ta taille de contrat d’un stoploss avec cette formule par exemple : (à adapter à ta stratégie bien entendu)

    REM Calculate contracts
    StopLoss = 25 // distance of stoploss in points
    maxrisk = 10 // max money to loose on stoploss
    PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize)
    Jules100912 thanked this post
    #201901 quote
    Jules100912Jules100912
    Participant
    New

    Merci beaucoup, ca marche si je met un stoploss a 10 ou une valeur comme ça mais pour quelque chose du genre stoploss=close-low+10 ça ne fonctionne pas.

    Tu aurais une autre solution?

Viewing 3 posts - 1 through 3 (of 3 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

calculer le nombre de contrat


ProOrder : Trading Automatique & Backtests

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Jules100912Jules100912
4 years, 1 month ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 09/28/2022
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...