strategie nadasq 5min

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #207594 quote
    Marlaynicolas
    Participant
    New

    Bonjour à tous,

    je vous remonte et partage un stratégie sur le nadasq en 5min avec spread à 1 pour capital de 10000 avec 2 contrats, je pense qu’on peut encore améliorer les gains et diminuer les pertes.
    Je m’aperçois que je n’ai que des trades longs je ne comprends pas pourquoi les courts ne fonctionne pas.

    merci au passage à nicolas et robertto .

     

    // Définition des paramètres du code
    DEFPARAM CumulateOrders = false // pas de cumul de positions
    DEFPARAM Preloadbars = 1000000
    
    capital= 50000
    
    // 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 = 150000
    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 = 223000
    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 acheteuse
    indicator1 = SenkouSpanA[9,26,52]
    c1 = (close CROSSES OVER indicator1)
    indicator2 = SenkouSpanB[9,26,52]
    c2 = (close CROSSES OVER indicator2)
    c3 = (close > DOpen(0)[1])
    IF (c1 AND c2 ) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
    BUY 2 CONTRACT AT MARKET
    partial=0
    ENDIF
    // sortie partielle
    if longonmarket and positionperf>1.71/100 and partial=0 then
    sell countofposition/1.7 contract at market
    partial = 1
    endif
    if summation[1680](longonmarket)=1680 then
    sell at market
    endif
    if summation[1000](shortonmarket)=1000 then
    exitshort at market
    endif
    
    // Stops et objectifs
    set stop %loss 1.8
    set target %profit 1.73
    
    
    IF Not OnMarket THEN
    //
    // when NOT OnMarket reset values to default values
    //
    TrailStart    = 65          //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
    Nicolas thanked this post
    Capture-decran-133.png Capture-decran-133.png Capture-decran-135.png Capture-decran-135.png Capture-decran-134.png Capture-decran-134.png Capture-decran-137.png Capture-decran-137.png
    #207599 quote
    JC_Bywan
    Moderator
    Master

    Bjr,

    Vite fait avant de démarrer la séance, à moins d’une erreur de copier-coller qui oublie un bout de code, ou que je fasse l’erreur fatale de mal lire le code avant mon café, je ne vois pas d’entrée sellshort dans ce code, juste des achats longs, des sorties partielles ou totales, et des exitshort sans entrée sellshort préalable…

    SELLSHORT

    Marlaynicolas thanked this post
    #207603 quote
    Marlaynicolas
    Participant
    New

    bonjour jc bryan ,
    j’ai fait ce code juste pour des achats et mes sorties sont faites par le break even ou sur une duree de bougies,
    Novice encore pour la programmation pourrais tu me dire comment tu mettrais ton sell short

    #207684 quote
    JC_Bywan
    Moderator
    Master

    Tu es déjà moins novice que ce que tu penses, ou tu as oublié avoir déjà utilisé cette instruction sellshort, voici ton post #197547 qui ressemble beaucoup au code ci-dessus, dans lequel tu avais déjà utilisé sellshort à la ligne22 avec les conditions c1 et c2 en “cross under” cette fois-là (par rapport au cross over pour la version buy actuelle)

    Marlaynicolas thanked this post
    #207721 quote
    Nicolas
    Keymaster
    Master

    Merci Nicolas pour le partage. C’est très apprécié, et ça signifie que le partage et la collaboration fonctionne toujours dans notre communauté 😉

    merri and Marlaynicolas thanked this post
    #207744 quote
    Marlaynicolas
    Participant
    New

    bonjour JC_Bywan,
    J’ai essayé le sellshort peux tu me dire si tu l’aurais positionné avec les conditions C1 et C2 ou si tu l’aurais utliser avec d’autres conditons.

    Le résultat est moins bon si j’ai bien compris intégré le sellshort

    // Définition des paramètres du code
    DEFPARAM CumulateOrders = false // pas de cumul de positions
    DEFPARAM Preloadbars = 1000000
    
    capital= 50000
    
    // 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 = 150000
    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 = 223000
    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 acheteuse
    indicator1 = SenkouSpanA[9,26,52]
    c1 = (close CROSSES OVER indicator1)
    indicator2 = SenkouSpanB[9,26,52]
    c2 = (close CROSSES OVER indicator2)
    c3 = (close > DOpen(0)[1])
    IF (c1 AND c2 ) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
    BUY 2 CONTRACT AT MARKET
    partial=0
    ENDIF
    IF NOT ShortOnMarket AND c1 and c2 THEN
    SELLSHORT 2 SHARES AT MARKET
    ENDIF
    // Condition pour ouvrir une position vendeuse
    
    // sortie partielle
    if longonmarket and positionperf>1.71/100 and partial=0 then
    sell countofposition/1.7 contract at market
    partial = 1
    endif
    if summation[1680](longonmarket)=1680 then
    sell at market
    endif
    if summation[1000](shortonmarket)=1000 then
    exitshort at market
    endif
    
    // Stops et objectifs
    set stop %loss 1.8
    set target %profit 1.73
    
    
    IF Not OnMarket THEN
    //
    // when NOT OnMarket reset values to default values
    //
    TrailStart    = 65          //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
    Capture-decran-138.png Capture-decran-138.png Capture-decran-139.png Capture-decran-139.png Capture-decran-140.png Capture-decran-140.png
    #207750 quote
    Marlaynicolas
    Participant
    New

    Je reviens vers toi, concernant mon partage avec l’algo eur/usd 3 minutes.

    Je voudrais créer un autre algo en prenant en compte mon algo eur/usd 3minutes , c’est a dire quand mon Trade est lancé je m’aperçois quand il part dans le négatif je voudrais pouvoir paramétrer le fibonnacci afin par exemple quand il retrace vers le dernier plus haut du timeframe 1h ou 4 h ou 15 minutes pouvoir lancé un autre algo qui lui dit retracement des 50% de fibo pas rapport au retracement du time frame 1heure ou 4 heures tu te met à la vente et je voudrais paramétrer le take profit sur le niveau d’ouverture ou même le paramétrer sur le take profit de mon  algo 3 minutes et mon stop loss toujours paramétrer sur 0.58%.

    Je parle de ca parce que je me suis entrainer en démo quand mon reel prenait le trade j’ai surveillé  quand il partait dans le sens contraire j’attendais une bougie de retournement comme un pendu ou harami sur des times frame de différents   ou un overblock en time frame 15 minutes et je validé mes trades . Donc je me demande si je ne pourrais pas le paramétrer mais la je ne sais pas faire la technique est plus complexe.

    Je sais pas si j’ai été clair pour vous?

    #207752 quote
    Marlaynicolas
    Participant
    New

    Oderblock pardon faute de frappe

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

strategie nadasq 5min


ProOrder : Trading Automatique & Backtests

New Reply
Author
Summary

This topic contains 7 replies,
has 3 voices, and was last updated by Marlaynicolas
3 years, 1 month ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 01/18/2023
Status: Active
Attachments: 7 files
Logo Logo
Loading...