Stop at X bars
Forums › ProRealTime English forum › ProOrder support › Stop at X bars
- This topic has 5 replies, 2 voices, and was last updated 7 years ago by Inertia.
Viewing 6 posts - 1 through 6 (of 6 total)
-
-
05/15/2017 at 5:57 AM #35522
Hi guys,
I am seeking for a bit of help please:
What should be written where to have the position stopped (closed) X bars after the entry?
Coding for me is close to Chinese (with all the respect I have for this great country ;).
FYI: careful: This strategy does not perform well all the time…
Thank you for your help.
DJ
1234567891011121314151617181920212223242526272829303132333435363738394041//-------------------------------------------------------------------------// Code principal : MOM DD 9%//-------------------------------------------------------------------------// Définition des paramètres du codeDEFPARAM CumulateOrders = False // Cumul des positions désactivé// Annule tous les ordres en attente et ferme toutes les positions à 0:00, puis empêche toute création d'ordre avant l'heure "FLATBEFORE".DEFPARAM FLATBEFORE = 090000// Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"DEFPARAM FLATAFTER = 220000// 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éetimeEnterBefore = time >= 090000// 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éetimeEnterAfter = time < 220000// 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 = Momentum[12](close)c1 = (indicator1 >= indicator1[4])indicator2 = BollingerBandWidth[20](close)c2 = (indicator2 > indicator2[4])indicator3 = Williams[14](close)c3 = (indicator3 > indicator3[2])IF (c1 AND c2 AND c3) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THENBUY 1 CONTRACT AT MARKETENDIF// Conditions pour fermer une position acheteuseindicator4 = 2*((DHigh(1) + DLow(1) + DClose(1))/3) - DLow(1)c4 = (close CROSSES OVER indicator4)IF c4 THENSELL AT MARKETENDIF// Stops et objectifsSET STOP pLOSS 35Edited by moderator to make PRT code format appear, please use the <> button in your new messages toolbar to insert PRT code
05/15/2017 at 4:59 PM #35618It has been answered many times already in the past on forums. You need to use TRADEINDEX and make a comparison with the actual BARINDEX, that’s all you need 🙂
123IF BARINDEX-TRADEINDEX(1)>5 AND LongOnMarket THENSELL AT MARKETENDIF1 user thanked author for this post.
05/15/2017 at 9:40 PM #3564505/16/2017 at 10:56 AM #3568505/16/2017 at 10:58 AM #3568705/16/2017 at 1:00 PM #35705 -
AuthorPosts
Viewing 6 posts - 1 through 6 (of 6 total)
Find exclusive trading pro-tools on
Similar topics: