// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
REM Money Management
Capital = 40000
Risk = (a)
StopLoss = Myrange //
Myrange = (AverageTrueRange[14](close) * 5)
REM Calculate contracts
equity = Capital + StrategyProfit
maxrisk = round(equity*Risk)
PositionSize = abs(round((maxrisk/StopLoss)))
// Conditions to enter long positions
indicator1 = Volume
c1 = (indicator1 > 200000)
indicator2 = Average[40](close)
indicator3 = Average[120](close)
c2 = (indicator2 > indicator3)
indicator5 = (highest[40] (high[1]))
c4 = (close >= indicator5)
IF c1 AND c2 AND c4 THEN
BUY PositionSize SHARES AT MARKET
ENDIF
// Conditions to exit long positions
IF CLose Crosses Under ChandeKrollStopUp[20,20,4] THEN
SELL AT MARKET
ENDIF
// Stops and targets