calcul taille de position et stop loss

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #149028 quote
    totoroux69
    Participant
    Junior

    Bonjour,

    J’essaie de coder ma stratégie mais je n’arrive pas à obtenir le bon stop loss et TP et  la bonne taille de position.

    Pour le stop loss, je souhaiterai qu’il soit fixer sur le plus haut des 10 dernières bougies (vente) et sur le plus bas des 10 dernières bougies (achat).

    Et qu’il calcul automatiquement la taille de position en fonction du capital soit 1%

    Et pour le TP qu’il soit fixer à 2 fois le SL soit un RR de 1:2

    Si vous avez des pistes ou d’autres demandes similaires pour que cela puisse m’aider.

    Merci d’avance

    defparam flatafter = 170000
    defparam flatbefore = 090000
    
    defparam CUMULATEORDERS = true
    
    MySupport = highest[10](high)
    MYRESISTANCE = lowest[10](low)
    
    //
    
    a = 12
    b = 26
    c = 9
    
    sma = Average[200](close)
    ma = MACDline[a,b,c](close)
    signal=exponentialaverage[c](ma)
    
    //moncapital = 10000
    //mylot = (moncapital+strategyprofit)*0.01
    //monlot = (mylot/1/10)
    
    
    // Conditions pour ouvrir une position acheteuse
    if dayofweek>=1 and dayofweek<=5  then
    IF  ma crosses over signal and ma < 0 and close > sma THEN
    BUY 1   shares AT MARKET
    ENDIF
    
    // Conditions pour fermer une position acheteuse
    IF LONGONMARKET THEN
    SELL AT MYresistance STOP
    
    ENDIF
    
    
    // Conditions pour ouvrir une position en vente à découvert
    IF ma crosses under signal and ma > 0 and close < sma THEN
    SELLSHORT 1 shares AT MARKET
    ENDIF
    
    // Conditions pour fermer une position en vente à découvert
    IF SHORTONMARKET THEN
    exitshort AT MYsupport stop
    
    ENDIF
    endif
    
    
    #149045 quote
    fifi743
    Participant
    Master
    defparam flatafter = 170000
    defparam flatbefore = 090000
     
    defparam CUMULATEORDERS = true
     
    MySupport = highest[10](high)
    MYRESISTANCE = lowest[10](low)
     
    //
     
    a = 12
    b = 26
    c = 9
     
    sma = Average[200](close)
    ma = MACDline[a,b,c](close)
    signal=exponentialaverage[c](ma)
     
    //moncapital = 10000
    //mylot = (moncapital+strategyprofit)*0.01
    //monlot = (mylot/1/10)
     
     
    // Conditions pour ouvrir une position acheteuse
    if dayofweek>=1 and dayofweek<=5  then
    IF  ma crosses over signal and ma < 0 and close > sma THEN
    BUY 1   shares AT MARKET
    set stop ploss close-MYRESISTANCE
    set target Pprofit 2*(close-MYRESISTANCE)
    ENDIF
     
    // Conditions pour fermer une position acheteuse
    IF LONGONMARKET THEN
    SELL AT Market
     
    ENDIF
     
     
    // Conditions pour ouvrir une position en vente à découvert
    IF ma crosses under signal and ma > 0 and close < sma THEN
    SELLSHORT 1 shares AT MARKET
    set stop ploss MySupport-close
    set target pprofit 2*(MySupport-close)
    ENDIF
     
    // Conditions pour fermer une position en vente à découvert
    IF SHORTONMARKET THEN
    exitshort AT market
     
    ENDIF
    endif

    j’ai pas testé

    j’ai modifier les fermetures de position

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

calcul taille de position et stop loss


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
totoroux69 @totoroux69 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by fifi743
5 years, 4 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 10/30/2020
Status: Active
Attachments: No files
Logo Logo
Loading...