DEFPARAM CumulateOrders = false
TradeON = 1 //1=on, 0=off
MinLotti= 0.5 //0.5 Minimun lot size
Capital = 10000
Balance = Capital + StrategyProfit
Risk = 1 //1% risk
Offset = 1 * pipsize
Entry = average[30,0](close)
EntryL = Entry + Offset
EntryS = Entry - Offset
MyATR = AverageTrueRange[14](close)
LotSize = max(MinLotti,(Balance * Risk / 100) / MyATR)
IF OnMarket THEN
Entry = 0
EntryL = 0
EntryS = 0
ENDIF
IF Not OnMarket AND TradeON THEN
IF close > EntryL THEN
BUY LotSize CONTRACTS AT EntryL LIMIT
ELSE
BUY LotSize CONTRACTS AT EntryL STOP
ENDIF
IF close > EntryS THEN
SELLSHORT LotSize CONTRACTS AT EntryS STOP
ELSE
SELLSHORT LotSize CONTRACTS AT EntryS LIMIT
ENDIF
ENDIF
SET TARGET pPROFIT 300
SET STOP pLOSS 100