algo de trading NASDAQ 5 MINUTES
Forums › ProRealTime forum Français › Support ProOrder › algo de trading NASDAQ 5 MINUTES
- This topic has 5 replies, 2 voices, and was last updated 2 years ago by JC_Bywan.
-
-
08/13/2022 at 4:15 PM #199023
Bonjour à tous ,
je vous partage une strategie nadasq en 5 minutes en algo.
Je voudrais intégrer la condition ” si mon trade arrive à temps de bougies par exemple 1000 je voudrais qu’il me coupe la position total ou ce qu’il restera en contrat ” est ce que vous pouvez m’aider à intégrer celle ci dans ce qui suit.
J’ai beau essayé ma tête fume et rien ne se passe, je ne sais pas ou mettre le paramètre et comment l’écrire.
Et si quelqu’un pouvait travailler dessus pour réduire les pertes ca serait génial et me donner son avis. si cela vaut le coup de le mettre en route.
Je vous remercie dans l’attente de vous lire.
nadasq 5 minutes123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138// Définition des paramètres du codeDEFPARAM CumulateOrders = false // pas de cumul de positionsDEFPARAM Preloadbars = 1000000capital= 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éenoEntryBeforeTime = 150000timeEnterBefore = 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éenoEntryAfterTime = 223000timeEnterAfter = time < noEntryAfterTime// Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiésdaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0// Conditions pour ouvrir une position acheteuseindicator1 = 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 THENBUY 2 CONTRACT AT MARKETpartial=0ENDIF// sortie partielleif longonmarket and positionperf>1.7/100 and partial=0 thensell countofposition/1.5 contract at marketpartial = 1endif// Stops et objectifsset stop %loss 2.0set target %profit 1.73IF Not OnMarket THEN//// when NOT OnMarket reset values to default values//TrailStart = 65 //30 Start trailing profits from this pointBasePerCent = 0.000 //20.0% Profit percentage to keep when setting BerakEvenStepSize = 1 //10 Pip chunks to increase PercentagePerCentInc = 0.000 //10.0% PerCent increment after each StepSize chunkBarNumber = 10 //10 Add further % so that trades don't keep running too longBarPerCent = 0.235 //10% Add this additional percentage every BarNumber barsRoundTO = -0.5 //-0.5 rounds always to Lower integer, +0.4 rounds always to Higher integer, 0 defaults PRT behaviourPriceDistance = 9 * pipsize //7 minimun distance from current pricey1 = 0 //reset to 0y2 = 0 //reset to 0ProfitPerCent = BasePerCent //reset to desired default valueTradeBar = BarIndexELSIF 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 pipsIF x1 >= TrailStart THEN // go ahead only if N+ pipsDiff1 = abs(TrailStart - x1) //difference from current profit and TrailStartChunks1 = max(0,round((Diff1 / StepSize) + RoundTO)) //number of STEPSIZE chunksProfitPerCent = 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 - TradeBarIF BarCount MOD BarNumber = 0 THENProfitPerCent = ProfitPerCent + BarPerCentENDIF//ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent)) //make sure ProfitPerCent doess not exceed 100%y1 = max(x1 * ProfitPerCent, y1) //y1 = % of max profitENDIFELSIF 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 pipsIF x2 >= TrailStart THEN // go ahead only if N+ pipsDiff2 = abs(TrailStart - x2) //difference from current profit and TrailStartChunks2 = max(0,round((Diff2 / StepSize) + RoundTO)) //number of STEPSIZE chunksProfitPerCent = 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 - TradeBarIF BarCount MOD BarNumber = 0 THENProfitPerCent = ProfitPerCent + BarPerCentENDIF//ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent)) //make sure ProfitPerCent doess not exceed 100%y2 = max(x2 * ProfitPerCent, y2) //y2 = % of max profitENDIFENDIFIF 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 THENSELL AT SellPrice STOPELSESELL AT SellPrice LIMITENDIFELSE////sell AT MARKET when EXITPRICE does not meet the broker's minimun distance from current price//SELL AT MarketENDIFENDIFIF 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 THENEXITSHORT AT ExitPrice STOPELSEEXITSHORT AT ExitPrice LIMITENDIFELSE////ExitShort AT MARKET when EXITPRICE does not meet the broker's minimun distance from current price//EXITSHORT AT MarketENDIFENDIF1 user thanked author for this post.
08/18/2022 at 11:48 AM #199212Dans la mesure où tu es confiant que ton système ne sort pas pour rerentrer immédiatement, pour sortir à 1000 bougies tu peux tester:
123456if summation[1000](longonmarket)=1000 thensell at marketendifif summation[1000](shortonmarket)=1000 thenexitshort at marketendif1 user thanked author for this post.
08/20/2022 at 5:49 AM #199261Bonjour merci pour retour,
Est ce que tu pourrais me l’intégrer dans la stratégie dois je le mettre au début avant les conditions achat ou âpres?
Si tu as le temps de me montrer je t’en remerci.
J’aurai une autre stratégie à partager sur des positions vendeuses cette fois si
Qaund mon trade arrive à un nombre de bougies de 550 sur mon UT DE 3MIN par exemple je voudrais qu’il coupe toute ma position vendeuse
Est ce que tu pourrais m’aider?
Merci à toi
08/20/2022 at 5:51 AM #199262Mon systeme de prend qu’un trade la plupart du temps ou 2 max je t’envoi apres midi une photo des trades pris sur une période de 2 ans
08/21/2022 at 6:28 PM #199362Bonjour je te joins mon algo avec ta suggestion pourrais tu me dire si je l’ai bien placé et peux tu voir si tu diminues le nombre de bougies si les résultats te semble s’améliorer . Ce que je vois je vois ce n’ai que des trades long comment faire pour avoir des trades courts .
merci a toi
nasdaq 5 minutes123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145// Définition des paramètres du codeDEFPARAM CumulateOrders = false // pas de cumul de positionsDEFPARAM Preloadbars = 1000000capital= 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éenoEntryBeforeTime = 150000timeEnterBefore = 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éenoEntryAfterTime = 223000timeEnterAfter = time < noEntryAfterTime// Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiésdaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0// Conditions pour ouvrir une position acheteuseindicator1 = 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 THENBUY 2 CONTRACT AT MARKETpartial=0ENDIF// sortie partielleif longonmarket and positionperf>1.7/100 and partial=0 thensell countofposition/1.5 contract at marketpartial = 1endifif summation[1000](longonmarket)=1000 thensell at marketendifif summation[1000](shortonmarket)=800 thenexitshort at marketendif// Stops et objectifsset stop %loss 2.0set target %profit 1.73IF Not OnMarket THEN//// when NOT OnMarket reset values to default values//TrailStart = 65 //30 Start trailing profits from this pointBasePerCent = 0.000 //20.0% Profit percentage to keep when setting BerakEvenStepSize = 1 //10 Pip chunks to increase PercentagePerCentInc = 0.000 //10.0% PerCent increment after each StepSize chunkBarNumber = 10 //10 Add further % so that trades don't keep running too longBarPerCent = 0.235 //10% Add this additional percentage every BarNumber barsRoundTO = -0.5 //-0.5 rounds always to Lower integer, +0.4 rounds always to Higher integer, 0 defaults PRT behaviourPriceDistance = 9 * pipsize //7 minimun distance from current pricey1 = 0 //reset to 0y2 = 0 //reset to 0ProfitPerCent = BasePerCent //reset to desired default valueTradeBar = BarIndexELSIF 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 pipsIF x1 >= TrailStart THEN // go ahead only if N+ pipsDiff1 = abs(TrailStart - x1) //difference from current profit and TrailStartChunks1 = max(0,round((Diff1 / StepSize) + RoundTO)) //number of STEPSIZE chunksProfitPerCent = 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 - TradeBarIF BarCount MOD BarNumber = 0 THENProfitPerCent = ProfitPerCent + BarPerCentENDIF//ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent)) //make sure ProfitPerCent doess not exceed 100%y1 = max(x1 * ProfitPerCent, y1) //y1 = % of max profitENDIFELSIF 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 pipsIF x2 >= TrailStart THEN // go ahead only if N+ pipsDiff2 = abs(TrailStart - x2) //difference from current profit and TrailStartChunks2 = max(0,round((Diff2 / StepSize) + RoundTO)) //number of STEPSIZE chunksProfitPerCent = 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 - TradeBarIF BarCount MOD BarNumber = 0 THENProfitPerCent = ProfitPerCent + BarPerCentENDIF//ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent)) //make sure ProfitPerCent doess not exceed 100%y2 = max(x2 * ProfitPerCent, y2) //y2 = % of max profitENDIFENDIFIF 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 THENSELL AT SellPrice STOPELSESELL AT SellPrice LIMITENDIFELSE////sell AT MARKET when EXITPRICE does not meet the broker's minimun distance from current price//SELL AT MarketENDIFENDIFIF 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 THENEXITSHORT AT ExitPrice STOPELSEEXITSHORT AT ExitPrice LIMITENDIFELSE////ExitShort AT MARKET when EXITPRICE does not meet the broker's minimun distance from current price//EXITSHORT AT MarketENDIFENDIF08/22/2022 at 8:26 AM #199388Je l’aurais plutôt mis à la fin, mais davantage par discipline de mettre ce genre de décision de “dernier recours” en dernier le code étant lu de haut en bas que par nécessité spécifique, et/ou pour éviter de se creuser la tête pour voir si certaines lignes peuvent être écrites après, alors que si c’est ça qui est après tout, ça ira. Cela dit une décision de type “si 1000 bougies on cherche pas à savoir on sort”, il est assez probable sans tout lire que tu obtiennes le même résultat là où tu l’as mis…
-
AuthorPosts
Find exclusive trading pro-tools on