I saw a code somewhere here… and unfortunately I can’t find it anymore. It’s about the following: If my strategy makes a loss of, say, 1% during the day, the strategy should stop working for that day and only start working again the next day. Optionally, the strategy should pause for that day if it has a following number of losing trades. Both individually or combined. Can someone help me please?
Hi Phoentzs
You can use this, but keep in mind that it works like everything at close, so if by any chance you have a loss of 0.95% it does not freeze, but make another trade and if the next one loses 2% on the day you have lost 2.90%.
DailyLoss=1
once StopDay=1
If intradaybarindex=0 then
ProfitDay=STRATEGYPROFIT
StopDay=1
endif
If StrategyProfit<=ProfitDay-DailyLoss*(close/100) then
StopDay=0
endif
IF not longonmarket AND StopDay =1 and Conditions THEN
Ciao
Mauro T.
Thanks Mauro Can I just put the code in front of the strategy code, i.e. at the beginning?
I normally put it on my terms ….. above here.
IF not longonmarket AND StopDay =1 and Conditions THEN
hello
Mauro T.
Hi phoentzs
Here is a version which robertogozzi kindly wrote which works on a monthly basis, and can be adapted to run on a daily basis. It currently runs on notional value of loss;
Max loss per month