Pause code until tomorrow
Forums › ProRealTime English forum › ProOrder support › Pause code until tomorrow
- This topic has 5 replies, 4 voices, and was last updated 4 years ago by youngus.
-
-
05/24/2019 at 6:33 PM #99391
Hello,
Would someone help me with the code that will make the strategy pause until tomorrow when a target profit is hit. I want to use it in timeframe 5 minutes.
The system will take trades but when a certain amount of profit is reached, the system will pause for the rest of the day and will continue tomorrow.Thank you
05/24/2019 at 6:46 PM #9939505/27/2019 at 7:24 AM #99486a certain amount of profit is reached
You mean profit of the current day?
05/29/2019 at 12:44 PM #99657Yes, I was meaning the current day, something like:
123if todayProfit > X thenpause strategy until tomorrowendifand the strategy will continue the day after because the todayProfit variable will be reinitialised to zero
Thank you
05/29/2019 at 12:56 PM #99659Hi Youngus,
I think you could use this
12345678910111213141516171819// STRATEGYPROFIT per DAY //////////////////////////////////////////////////////////////////////////////// It resets the variable each new dayIF INTRADAYBARINDEX = 0 THENstratprofit = STRATEGYPROFIT //saves the previous day Profitnomoretrading = 0ENDIF// Finishing DAILY operations when reaching target profit/lossIF (STRATEGYPROFIT-stratprofit)>=40 THEN //current day's profitSELL AT MARKETEXITSHORT AT MARKETnomoretrading=1ENDIFIF (STRATEGYPROFIT-stratprofit)<=-40 THEN //current day's lossSELL AT MARKETEXITSHORT AT MARKETnomoretrading=1ENDIFIn this case, when your operation is closed and your benefit is >=40 (currency, not points) your code will not launch any more orders. It also works for daily losses.
In order to do that you should include in every BUYING/SELLING order nometrading=0
123IF yourconditions AND nomoretrading=0 THENBUY 1 contract at marketENDIFI hope it is what you are looking for.
Regards
1 user thanked author for this post.
05/30/2019 at 5:54 PM #99724 -
AuthorPosts
Find exclusive trading pro-tools on