Hi,
Is there any way to limit the max loss per month? For example, when backtesting I’d like a strategy to stop trading for the month if losses reach a certain level, then resume at the start of the following month.
Is this something that can be managed within the code?
Thank you very much
S
There you go:
ONCE MyProfit = 0
ONCE TradeON = 1
IF Month <> Month[1] THEN
MyProfit = STRATEGYPROFIT //store profits/losses at the beginning of each month
TradeON = 1 //enable trading each new month
ENDIF
IF (STRATEGYPROFIT - MyProfit) < -200 THEN //disable trading when losing > 200 currency units
TradeON = 0
ENDIF
MyLongConditions = close CROSSES OVER average[10,0](close)
IF MyLongConditions AND TradeON THEN
BUY 1 Contract at Market
SET TARGET pPROFIT 500
SET STOP pLOSS 100
ENDIF
//graph strategyprofit
//graph MyProfit
//graph TradeON coloured(255,0,0,255)
Grazie mille! I am very grateful for your help.