// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// ---parameters
MaxDailyProfit=100 //Max daily profit allowed (in money)
once tradeon=1
// reset the current state of the strateygprofit each new day
If intradaybarindex=0 then
MyProfit=STRATEGYPROFIT
tradeon = 1
endif
// test if the strategyprofit of the day is currently above the daily profit allowed of below the daily loss allowed
If StrategyProfit>=MyProfit+MaxDailyProfit then
tradeon = 0
endif
IF tradeon=1 and rsi[14]crosses over 50 THEN
BUY 1 contract AT MARKET
ENDIF
IF tradeon=1 and rsi[14]crosses under 50 THEN
SELLSHORT 1 contract AT MARKET
ENDIF
//graph strategyprofit
//graph MyProfit+MaxDailyProfit coloured("orange")
//graph tradeon