Hi everyone,
I am trying to put together a piece of code for a reverse order as a stop loss, and sometimes end it up losing three or four operations in a row in just one day.
It works most of the times, especially when we have a drastic fall or raise in price (i.e, crude). What I am trying to do is to take advantage of that strength of the market, reverse and follow the trend to mitigate my initial losses. I have check the backtest and there are few occasions when after one of two big candles the market loose strength and become lateral and the operations start going in the opposite/wrong direction.
I would like to limit these losses to two per day maximum, so can anyone tell me how I could stop the system after two consecutive losses the SAME DAY??????
Is that even possible??
Thanks,
Juan
WingParticipant
Veteran
once TradesToday=0
if time=000000 then
TradesToday=0
endif
If TradesToday>1 and positionperf(1)<0 and positionperf(2)<0 and onmarket=0
Quit
endif
// for every trade you make:
TradesToday=TradesToday+1
Something like that?
Hi Wing,
It seems perfect. I am going to try it and will let you know the results.
Thanks so much for your help.
Juan