Vente partielle de contrat sur indice

Viewing 15 posts - 16 through 30 (of 30 total)
  • Author
    Posts
  • #195245 quote
    Nicolas
    Keymaster
    Master

    Ci-joint le code de la stratégie modifiée qui exécute des sorties partielles.

    WS-15MN-LONG-BE-NICOLAS.itf sortie-partielle-proorder.png sortie-partielle-proorder.png
    #195264 quote
    gerard66
    Participant
    New

    merci Nicolas

    c est parfait

    #197547 quote
    Marlaynicolas
    Participant
    New

    Bonjour nicolas,
    je me suis permis d’utiliser ton code pour la vente partielle sur cfd mais je ne vois pas mon erreur, mon résultat ne change pas pourrais tu m’aider.
    je te joins le code , désolé je l’ai partagé plusieurs fois.
    dans l’attente de te lire

    // Définition des paramètres du code
    DEFPARAM CumulateOrders = False // Cumul des positions désactivé
    
    // Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position avant l'heure spécifiée
    noEntryBeforeTime = 145000
    timeEnterBefore = time >= noEntryBeforeTime
    
    // Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position après l'heure spécifiée
    noEntryAfterTime = 235900
    timeEnterAfter = time < noEntryAfterTime
    
    // Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiés
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    // Conditions pour ouvrir une position en vente à découvert
    indicator1 = SenkouSpanB[9,26,52]
    c1 = (close CROSSES UNDER indicator1)
    indicator2 = SenkouSpanA[9,26,52]
    c2 = (close CROSSES UNDER indicator2)
    
    IF (c1 AND c2) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry and tally < maxTrades THEN
    sellshort 2 CONTRACT AT MARKET
    closed=0
    endif
    if onmarket then
    buy 1 contract at (tradeprice +0.0010*pipsize) limit
    endif
    //---------------------------------------------------------------------------------------------------------------
    once maxTrades = 10                               //maxNumberDailyTrades
    once tally = 0
    if intradayBarIndex = 0 then
    tally = 0
    endif
     
    newTrades =  (onMarket and not onMarket[1]) or ((not onMarket and not onMarket[1]) and (strategyProfit <> strategyProfit[1])) or (longOnMarket and ShortOnMarket[1]) or (longOnMarket[1] and shortOnMarket) or ((tradeIndex(1) = tradeIndex(2)) and (barIndex = tradeIndex(1)) and (barIndex > 0) and (strategyProfit = strategyProfit[1]))
     
    if newTrades then
    tally = tally +1
    endif
    //------------------------------------------------------------------------------------------------------------------------
    //---------------------------------------------------------------------------------------------------------------
    //Max-Orders per Day
    once maxOrdersL = 1  //long
    once maxOrdersS = 1  //short
    if intradayBarIndex = 0 then //reset orders count
    ordersCountL = 0
    ordersCountS = 0
    endif
     
    if longTriggered then //check if an order has opened in the current bar
    ordersCountL = ordersCountL + 1
    endif
    if shortTriggered then //check if an order has opened in the current bar
    ordersCountS = ordersCountS + 1
    endif
    
    //------------------------------------------------------------------------------------------------------------------------
    // Stops et objectifs
    set stop %loss 0.58
    set target %profit 0.21
    
    
    IF Not OnMarket THEN
    //
    // when NOT OnMarket reset values to default values
    //
    TrailStart    = 2.79          //30     Start trailing profits from this point
    BasePerCent   = 0.000       //20.0%  Profit percentage to keep when setting BerakEven
    StepSize      = 1          //10     Pip chunks to increase Percentage
    PerCentInc    = 0.000       //10.0%  PerCent increment after each StepSize chunk
    BarNumber     = 10          //10     Add further % so that trades don't keep running too long
    BarPerCent    = 0.235       //10%    Add this additional percentage every BarNumber bars
    RoundTO       = -0.5        //-0.5   rounds always to Lower integer,   +0.4 rounds always to Higher integer,     0 defaults PRT behaviour
    PriceDistance = 9 * pipsize //7      minimun distance from current price
    y1            = 0           //reset to 0
    y2            = 0           //reset to 0
    ProfitPerCent = BasePerCent //reset to desired default value
    TradeBar      = BarIndex
    ELSIF LongOnMarket AND close > (TradePrice + (y1 * pipsize)) THEN                              //LONG positions
    //
    // compute the value of the Percentage of profits, if any, to lock in for LONG trades
    //
    x1 = (close - tradeprice) / pipsize                                     //convert price to pips
    IF x1 >= TrailStart THEN                                                //    go ahead only if N+ pips
    Diff1         = abs(TrailStart - x1)                                 //difference from current profit and TrailStart
    Chunks1       = max(0,round((Diff1 / StepSize) + RoundTO))           //number of STEPSIZE chunks
    ProfitPerCent = BasePerCent + (BasePerCent * (Chunks1 * PerCentInc)) //compute new size of ProfitPerCent
    // compute number of bars elapsed and add an additionl percentage
    // (this percentage is different from PerCentInc, since it's a direct percentage, not a Percentage of BasePerCent)
    // (if BasePerCent is 20% and this is 10%, the whole percentage will be 30%, not 22%)
    BarCount      = BarIndex - TradeBar
    IF BarCount MOD BarNumber = 0 THEN
    ProfitPerCent = ProfitPerCent + BarPerCent
    ENDIF
    //
    ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent))         //make sure ProfitPerCent doess not exceed 100%
    y1 = max(x1 * ProfitPerCent, y1)                                     //y1 = % of max profit
    ENDIF
    ELSIF ShortOnMarket AND close < (TradePrice - (y2 * pipsize)) THEN                             //SHORT positions
    //
    // compute the value of the Percentage of profits, if any, to lock in for SHORT trades
    //
    x2 = (tradeprice - close) / pipsize                                     //convert price to pips
    IF x2 >= TrailStart THEN                                                //      go ahead only if N+ pips
    Diff2         = abs(TrailStart - x2)                                 //difference from current profit and TrailStart
    Chunks2       = max(0,round((Diff2 / StepSize) + RoundTO))           //number of STEPSIZE chunks
    ProfitPerCent = BasePerCent + (BasePerCent * (Chunks2 * PerCentInc)) //compute new size of ProfitPerCent
    // compute number of bars elapsed and add an additionl percentage
    // (this percentage is different from PerCentInc, since it's a direct percentage, not a Percentage of BasePerCent)
    // (if BasePerCent is 20% and this is 10%, the whole percentage will be 30%, not 22%)
    BarCount      = BarIndex - TradeBar
    IF BarCount MOD BarNumber = 0 THEN
    ProfitPerCent = ProfitPerCent + BarPerCent
    ENDIF
    //
    ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent))         //make sure ProfitPerCent doess not exceed 100%
    y2 = max(x2 * ProfitPerCent, y2)                                     //y2 = % of max profit
    ENDIF
    ENDIF
    IF y1 THEN                                                                 //Place pending STOP order when y1 > 0   (LONG positions)
    SellPrice = Tradeprice + (y1 * pipsize)                                 //convert pips to price
    //
    // check the minimun distance between ExitPrice and current price
    //
    IF abs(close - SellPrice) > PriceDistance THEN
    //
    // place either a LIMIT or STOP pending order according to current price positioning
    //
    IF close >= SellPrice THEN
    SELL AT SellPrice STOP
    ELSE
    SELL AT SellPrice LIMIT
    ENDIF
    ELSE
    //
    //sell AT MARKET when EXITPRICE does not meet the broker's minimun distance from current price
    //
    SELL AT Market
    ENDIF
    ENDIF
    IF y2 THEN                                                                 //Place pending STOP order when y2 > 0   (SHORT positions)
    ExitPrice = Tradeprice - (y2 * pipsize)                                 //convert pips to price
    //
    // check the minimun distance between ExitPrice and current price
    //
    IF abs(close - ExitPrice) > PriceDistance THEN
    //
    // place either a LIMIT or STOP pending order according to current price positioning
    //
    IF close <= ExitPrice THEN
    EXITSHORT AT ExitPrice STOP
    ELSE
    EXITSHORT AT ExitPrice LIMIT
    ENDIF
    ELSE
    //
    //ExitShort AT MARKET when EXITPRICE does not meet the broker's minimun distance from current price
    //
    EXITSHORT AT Market
    ENDIF
    ENDIF
    #256967 quote
    Michel_I
    Participant
    New

    Cet ordre de vente fonctionne très bien, mais nécessite la clôture de bougie pour être exécuté. Est il possible de placer un ordre Take Profit partiel, pour une demi position par exemple ? Cela permettrait une exécution sûre de l’ordre, mais je ne vois rien dans la doc de PRT qui le permette…

    #256988 quote
    Nicolas
    Keymaster
    Master

    Pour clôturer partiellement un ordre, il faut utiliser un ordre au marché et pour cela il faut que le code soit lu et le code n’est lu qu’une seule fois par bougie à sa clôture.

    Pour agir intra bougie, on peut utiliser une unité de temps plus petite qui va lire le code plus souvent pour la gestion des ordres (sans toucher à la logique propre d’entrée qui elle restera sur l’unite de temps qu’elle utilise déjà).

    Ci-joint la version MTF, on la lance sur le timeframe désiré pour gérer les sorties partielles, ici dans mon exemple ci-joint en 5-minutes.


    WS-15MN-LONG-BE-NICOLAS-MTF.itf 2026-01-28-10_13_04-Mini-DAX-Full0326-8_00-22_00-5-minutes-24907-0.41-10_12_53-am.png 2026-01-28-10_13_04-Mini-DAX-Full0326-8_00-22_00-5-minutes-24907-0.41-10_12_53-am.png
    #257053 quote
    Michel_I
    Participant
    New

    Merci beaucoup pour votre réponse rapide ! Je teste cela de suite !


    #257054 quote
    Michel_I
    Participant
    New

    Il semble y avoir un problème sur le fichier itf joint… PRT refuse de l’ouvrir en indiquant que le format du fichier n’est pas correct

    #257055 quote
    Michel_I
    Participant
    New

    J’ai aussi essayé de passer en 1 mn la partie de mon code relative au stop suiveur, qui est de base en 5 minutes, mais PRT refuse car 1 n’est pas multiple de 5. Il faut donc que je ré-écrive tout le code en 1 minute ?


    #257056 quote
    Michel_I
    Participant
    New

    Même en partant d’un code basé en 1 minute, cela ne fonctionne pas, j’ai le même message d’erreur…


    #257064 quote
    Nicolas
    Keymaster
    Master

    En attendant de pouvoir résoudre ce problème d’import de fichier, ci-dessous le code complet à copier/coller pour bien comprendre la logique des 2 timeframes.

    // ===========================
    // WS 15MN LONG BE
    // ===========================
    DEFPARAM CumulateOrders = false
    DEFPARAM Preloadbars = 10000
    
    
    TIMEFRAME(15 minutes,updateonclose)
    
    
    // ========== TAILLE DES POSITIONS ==========
    // 3 VARIABLES A PARAMETRER
    CapitalInit = 10000      // Capital initial (pour le réinvestissement des gains)
    REINV = 0                // 0 = sans réinvestir  /  1 = réinvestir les gains
    NCONTRATS = 2      // nombre par défaut de minicontrats (longs)
    
    
    IF REINV = 0 THEN
    n = NCONTRATS
    Capital = CapitalInit
    ELSIF REINV = 1 THEN
    capital = CapitalInit + strategyprofit
    n = (capital / CapitalInit) * NCONTRATS
    ENDIF
    
    
    // ACTIVATION OU NON DES LONGS / SHORTS
    // 0 = désactiver  /  1 = activer
    LongsOK = 1
    ShortsOK = 0
    
    
    //Coefficient SHORT
    Coef = 15/10
    
    
    // PARAMETRES BREAKEVEN
    Breakeven1 = 1    // 0 = désactiver      1 = activer
    
    
    IF not onmarket THEN
    BElongactif = 0
    BEshortactif = 0
    ENDIF
    
    
    IF not longonmarket THEN
    BElongactif = 0
    ENDIF
    IF not shortonmarket THEN
    BEshortactif = 0
    ENDIF
    
    
    // Paramètres Breakeven
    
    
    // LONGS
    BEniveauLong = 50
    BELongKeep = 5
    
    
    // SHORTS
    BEniveauShort = 60
    BEShortKeep = 5
    
    
    // ACTIVATION DES PLAGES HORAIRES D'ENTRÉE EN POSITION
    // 0 = désactiver la plage / 1 = activer la plage (conseillé)
    // LONGS
    
    
    PlageOKL1 = 1
    PlageOKL2 = 0
    PlageOKL3 = 0
    PlageOKL4 = 0
    PlageOKL5 = 0
    PlageOKL6 = 0
    
    
    // SHORTS
    
    
    PlageOKS0 = 0
    PlageOKS1 = 0
    PlageOKS2 = 0
    PlageOKS3 = 0
    PlageOKS4 = 0
    PlageOKS5 = 0
    
    
    //PLAGE HORAIRE
    
    
    // LONGS
    CtimeAchat1 = time >= 090000 and time < 113000
    CtimeAchat2 = time >= 113000 and time < 153000
    CtimeAchat3 = time >= 153000 and time < 173000
    CtimeAchat4 = time >= 173000 and time < 190000
    CtimeAchat5 = time >= 190000 and time < 203000 and dayofweek <> 5
    CtimeAchat6 = time >= 203000 and time < 213000 and dayofweek <> 5
    
    
    // FILTRE : % VARIATION DE LA JOURNEE PRECEDENTE
    // Pas de trade long / short si fort % variation long / short la veille
    
    
    IF dayofweek = 1 THEN
    dayclose = DClose(2)
    dayopen = DOpen(2)
    ELSIF dayofweek >=2 and dayofweek < 6 THEN
    dayclose = DClose(1)
    dayopen = DOpen(1)
    ENDIF
    
    
    PrevDayVar = dayclose - dayopen
    PrevDayVarPercent = (PrevDayVar *100 / dayclose)
    
    
    CaPrevDay1 = PrevDayVarPercent < 2.3
    CaPrevDay2 = PrevDayVarPercent < 2.4
    CaPrevDay3 = PrevDayVarPercent < 3.2
    CaPrevDay4 = PrevDayVarPercent < 1.6
    CaPrevDay5 = PrevDayVarPercent < 3
    CaPrevDay6 = PrevDayVarPercent < 2.1
    
    
    CvPrevDay0 = PrevDayVarPercent > -3
    CvPrevDay1 = PrevDayVarPercent > -1.8
    CvPrevDay2 = PrevDayVarPercent > -3
    CvPrevDay3 = PrevDayVarPercent > -2.5
    CvPrevDay4 = PrevDayVarPercent > -2.8
    CvPrevDay5 = PrevDayVarPercent > -2.5
    
    
    // FILTRE : MOMENTUM
    
    
    MOM1a = Momentum[5]
    Cam1 = MOM1a > MOM1a[1]
    MOM2a = Momentum[4]
    Cam2 = MOM2a > MOM2a[4]
    MOM3a = Momentum[13]
    Cam3 = MOM3a > MOM3a[2]
    MOM4a = Momentum[8]
    Cam4 = MOM4a > MOM4a[1]
    MOM5a = Momentum[13]
    Cam5 = MOM5a > MOM5a[4]
    MOM6a = Momentum[14]
    Cam6 = MOM6a > MOM6a[7]
    
    
    MOM0v = Momentum[8]
    Cvm0 = MOM0v < MOM0v[3]
    MOM1v = Momentum[10]
    Cvm1 = MOM1v < MOM1v[1]
    MOM2v = Momentum[13]
    Cvm2 = MOM2v < MOM2v[1]
    MOM3v = Momentum[6]
    Cvm3 = MOM3v < MOM3v[2]
    MOM4v = Momentum[3]
    Cvm4 = MOM4v < MOM4v[1]
    MOM5v = Momentum[14]
    Cvm5 = MOM5v < MOM5v[1]
    
    
    
    
    // FILTRE : PENTE VWAP
    d = max(1, intradaybarindex)
    
    
    IF SUMMATION[d](volume) <> 0 Then
    VWAP = SUMMATION[d](volume*typicalprice)/SUMMATION[d](volume)
    ELSE
    VWAP = 0
    ENDIF
    
    
    IF CtimeAchat1 AND VWAP[15] <> 0 THEN
    IF VWAP >= VWAP[15] THEN
    Slope = (VWAP - VWAP[15]) / VWAP[15]
    ELSIF VWAP < VWAP[15] THEN
    Slope = (VWAP - VWAP[15]) / VWAP
    ENDIF
    caVwap1 = Slope < 40/10000
    ENDIF
    
    
    IF CtimeAchat2 AND VWAP[90] <> 0 THEN
    IF VWAP >= VWAP[90] THEN
    Slope = (VWAP - VWAP[90]) / VWAP[90]
    ELSIF VWAP < VWAP[90] THEN
    Slope = (VWAP - VWAP[90]) / VWAP
    ENDIF
    caVwap2 = Slope < 45/10000
    ENDIF
    
    
    IF CtimeAchat3 AND VWAP[5] <> 0 THEN
    IF VWAP >= VWAP[5] THEN
    Slope = (VWAP - VWAP[5]) / VWAP[5]
    ELSIF VWAP < VWAP[5] THEN
    Slope = (VWAP - VWAP[5]) / VWAP
    ENDIF
    caVwap3 = Slope < 60/10000
    ENDIF
    
    
    IF CtimeAchat4 AND VWAP[65] <> 0 THEN
    IF VWAP >= VWAP[65] THEN
    Slope = (VWAP - VWAP[65]) / VWAP[65]
    ELSIF VWAP < VWAP[65] THEN
    Slope = (VWAP - VWAP[65]) / VWAP
    ENDIF
    caVwap4 = Slope < 5/10000
    ENDIF
    
    
    IF CtimeAchat5 AND VWAP[75] <> 0 THEN
    IF VWAP >= VWAP[75] THEN
    Slope = (VWAP - VWAP[75]) / VWAP[75]
    ELSIF VWAP < VWAP[75] THEN
    Slope = (VWAP - VWAP[75]) / VWAP
    ENDIF
    caVwap5 = Slope < 75/10000
    ENDIF
    
    
    IF CtimeAchat6 AND VWAP[5] <> 0 THEN
    IF VWAP >= VWAP[5] THEN
    Slope = (VWAP - VWAP[5]) / VWAP[5]
    ELSIF VWAP < VWAP[5] THEN
    Slope = (VWAP - VWAP[5]) / VWAP
    ENDIF
    caVwap6 = Slope < 35/10000
    ENDIF
    
    
    
    
    IF PlageOKS0 AND VWAP <> 0 AND VWAP[80] <> 0 THEN
    IF VWAP >= VWAP[80] THEN
    Slope = (VWAP - VWAP[80]) / VWAP[80]
    ELSIF VWAP < VWAP[80] THEN
    Slope = (VWAP - VWAP[80]) / VWAP
    ENDIF
    cvVwap0 = Slope < 100/10000
    ELSE
    cvVwap0 = 1
    ENDIF
    
    
    IF PlageOKS1 AND VWAP <> 0 AND VWAP[60] <> 0 THEN
    IF VWAP >= VWAP[60] THEN
    Slope = (VWAP - VWAP[60]) / VWAP[60]
    ELSIF VWAP < VWAP[60] THEN
    Slope = (VWAP - VWAP[60]) / VWAP
    ENDIF
    cvVwap1 = Slope < 5/10000
    ELSE
    cvVwap1 = 1
    ENDIF
    
    
    IF PlageOKS2 AND VWAP <> 0 AND VWAP[5] <> 0 THEN
    IF VWAP >= VWAP[5] THEN
    Slope = (VWAP - VWAP[5]) / VWAP[5]
    ELSIF VWAP < VWAP[5] THEN
    Slope = (VWAP - VWAP[5]) / VWAP
    ENDIF
    cvVwap2 = Slope < 5/10000
    ELSE
    cvVwap2 = 1
    ENDIF
    
    
    IF PlageOKS3 AND VWAP <> 0 AND VWAP[5] <> 0 THEN
    IF VWAP >= VWAP[5] THEN
    Slope = (VWAP - VWAP[5]) / VWAP[5]
    ELSIF VWAP < VWAP[5] THEN
    Slope = (VWAP - VWAP[5]) / VWAP
    ENDIF
    cvVwap3 = Slope < 5/10000
    ELSE
    cvVwap3 = 1
    ENDIF
    
    
    IF PlageOKS4 AND VWAP <> 0 AND VWAP[10] <> 0 THEN
    IF VWAP >= VWAP[10] THEN
    Slope = (VWAP - VWAP[10]) / VWAP[10]
    ELSIF VWAP < VWAP[10] THEN
    Slope = (VWAP - VWAP[10]) / VWAP
    ENDIF
    cvVwap4 = Slope < 10/10000
    ELSE
    cvVwap4 = 1
    ENDIF
    
    
    IF PlageOKS5 AND VWAP <> 0 AND VWAP[30] <> 0 THEN
    IF VWAP >= VWAP[30] THEN
    Slope = (VWAP - VWAP[30]) / VWAP[30]
    ELSIF VWAP < VWAP[30] THEN
    Slope = (VWAP - VWAP[30]) / VWAP
    ENDIF
    cvVwap5 = Slope < 5/10000
    ELSE
    cvVwap5 = 1
    ENDIF
    
    
    //FILTRE : TAILLE DE BOUGIE ET VOLATILITE
    
    
    CandleOKL = abs(open-close)<(65/10000)*close and AverageTrueRange[100](close)<=105
    CandleOKS = abs(open-close)<(62/10000)*close and AverageTrueRange[100](close)<=110
    // LONGS
    
    
    IF LongsOK = 1 THEN
    IF not longonmarket THEN
          
    IF PlageOKL1 and CtimeAchat1 THEN
    HautRange1 = highest[40](high)
             
    c1 = close > HautRange1[1]
    c2 = close[1] > HautRange1[2]
    c3 = average[40](close) > average[50](close) AND average[50](close) > average[195](close)
    c3bis = RSI[8] < 94 and RSI[18] > 48
    IF c1 and c2 and c3 and c3bis and CtimeAchat1 and not onmarket and CandleOKL and CaPrevDay1 and Cam1 and caVwap1 THEN
    Buy n shares at market
    SET STOP %LOSS 0.65
    SET TARGET %PROFIT 1
    ENDIF
    ENDIF
          
    IF PlageOKL2 and CtimeAchat2 THEN
    HautRange2 = highest[40](high)
             
    c4 = close > HautRange2[1]
    c5 = close[1] > HautRange2[2]
    c6 = average[5](close) > average[15](close) AND average[15](close) > average[50](close)
    c6bis = RSI[4] < 98
    IF c4 and c5 and c6 and c6bis and CtimeAchat2 and not onmarket and CandleOKL and CaPrevDay2 and Cam2 and caVwap2 THEN
    Buy n shares at market
    SET STOP %LOSS 0.6
    SET TARGET %PROFIT 1
    ENDIF
    ENDIF
          
    IF PlageOKL3 and CtimeAchat3 THEN
    HautRange3 = highest[58](high)
             
    c7 = close > HautRange3[1]
    c8 = close[1] > HautRange3[2]
    c9 = average[20](close) > average[40](close) AND average[40](close) > average[100](close)
    c9bis = RSI[6] < 96
    IF c7 and c8 and c9 and c9bis and CtimeAchat3 and not onmarket and CandleOKL and CaPrevDay3 and Cam3 and caVwap3 THEN
    Buy n shares at market
    SET STOP %LOSS 0.6
    SET TARGET %PROFIT 1
    ENDIF
    ENDIF
          
    IF PlageOKL4 and CtimeAchat4 THEN
    HautRange4 = highest[5](high)
             
    c10 = close > HautRange4[1]
    c11 = close[1] > HautRange4[2]
    c12 = average[70](close) > average[60](close)
    c12bis = RSI[12] < 82
    IF c10 and c11 and c12 and c12bis and CtimeAchat4 and not onmarket and CandleOKL and CaPrevDay4 and Cam4 and caVwap4 THEN
    Buy n shares at market
    SET STOP %LOSS 0.5
    SET TARGET %PROFIT 1
    ENDIF
    ENDIF
          
    IF PlageOKL5 and CtimeAchat5 THEN
    HautRange5 = highest[50](high)
             
    c13 = close > HautRange5[1]
    c14 = close[1] > HautRange5[2]
    c15 = average[20](close) > average[35](close) AND average[35](close) > average[215](close)
    c15bis = RSI[6] < 84
    IF c13 and c14 and c15 and c15bis and CtimeAchat5 and not onmarket and CandleOKL and CaPrevDay5 and Cam5 and caVwap5 THEN
    Buy n shares at market
    SET STOP %LOSS 0.5
    SET TARGET %PROFIT 1
    ENDIF
    ENDIF
          
    IF PlageOKL6 and CtimeAchat6 THEN
    HautRange6 = highest[54](high)
             
    c16 = close > HautRange6[1]
    c17 = close[1] > HautRange6[2]
    c18 = average[20](close) > average[25](close) AND average[25](close) > average[165](close)
    c18bis = RSI[6] < 84
    IF c16 and c17 and c18 and c18bis and CtimeAchat6 and not onmarket and CandleOKL and CaPrevDay6 and Cam6 and caVwap6 THEN
    Buy n shares at market
    SET STOP %LOSS 0.35
    SET TARGET %PROFIT 1
    ENDIF
    ENDIF
          
    ENDIF
    ENDIF
    
    
    
    
    
    
    // SORTIE LONGS LE VENDREDI SOIR À 21H30
    IF time >= 213000 and longonmarket and DayOfWeek=5 THEN
    sell at market
    ENDIF
    
    
    
    
    // GESTION DU BREAKEVEN - Longs
    
    
    IF Breakeven1 = 1 THEN
    nivBElong = BEniveauLong/10000*tradeprice(1)
    IF longonmarket and close-tradeprice(1)>=nivBElong THEN
    Breakevenlevel = tradeprice(1) + (BELongKeep/10000*tradeprice(1))
    BElongactif = 1
    ENDIF
       
    IF BElongactif = 1 THEN
    sell at Breakevenlevel stop
    ENDIF
    ENDIF
    
    
    
    
    //STAGNATION (LONGS) : SORTIE SI PERTE >= 120 pips APRES 48 BOUGIES
    floatingprofit = close-tradeprice(1)
    IF longonmarket and floatingprofit<=-120 and BarIndex-TradeIndex>48 THEN
    sell at market
    ENDIF
    
    
    TIMEFRAME(default)
    if not onmarket then
    partial=0
    endif
    // sortie partielle
    if longonmarket and positionperf>.6/100 and partial=0 then
    sell countofposition/2 contract at market
    partial = 1
    endif
    



    #257072 quote
    Nicolas
    Keymaster
    Master

    voici un export d’une plateforme PRT d’un compte IG demo pour vérifier l’export et re-import.

    WS-15MN-LONG-BE-NICOLAS-MTF_IG.itf WS-15MN-LONG-BE-NICOLAS-SOFT.itf
    #257075 quote
    Nicolas
    Keymaster
    Master

    autre export d’une plateforme PRT software.

    WS-15MN-LONG-BE-NICOLAS-SOFT-1.itf
    #257079 quote
    Michel_I
    Participant
    New

    Merci beaucoup pour ces exemples ! Si je comprends bien : quand je veux que l’une de mes variables soit calculée en 1 minute, le graphe par défaut doit être affiché en 1 minute (ce qui limite l’historique de BT à 200 000 bougies (6 mois) dans ma version de PRT). Dans ce cas je peux choisir de calculer d’autres variables en UT différentes, cela fonctionne. Par contre si je veux que mon UT de base soit le 5 minutes, pour avoir un historique de 1 ou 2 ans, je ne peux pas programmer de variable en 1 minute, mais uniquement dans des UT plus longues que le 5 minutes.

    C’est bien cela ?

    C’est dommage, car le suivi en 1 minute pourrait être très intéressant pour les stops suiveurs par exemple, dans une stratégie basée en 5 ou 15 minutes…

    #257090 quote
    Nicolas
    Keymaster
    Master

    Oui c’est bien cela, on ne peut accéder qu’aux données des unités de temps supérieures et non celles inférieures. Donc ici toutes les UT au dessus de 1-minute sont accessibles et pas celles en dessous (les UT en secondes en l’occurrence).

    #257095 quote
    Michel_I
    Participant
    New

    OK ! Merci pour ces explications !


Viewing 15 posts - 16 through 30 (of 30 total)
  • You must be logged in to reply to this topic.

Vente partielle de contrat sur indice


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
gerard66 @gerard66 Participant
Summary

This topic contains 29 replies,
has 2 voices, and was last updated by Michel_I
3 weeks ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 05/04/2022
Status: Active
Attachments: 10 files
Logo Logo
Loading...