// Trading System
DEFPARAM flatafter = 172900
DEFPARAM CUMULATEORDERS = False
entryPrice = open - 2.4 * ABS(Low[4] - Close[4])
CondL1 = ABS(low - close[4]) >= AverageTrueRange[3](close)[2]
CondL2 = low[0] >= open
EntryCondLong = CondL1 or CondL2
ExitCondLong = DayOfWeek > 3
MaxCapital = 10000
ExpectedDailyVolatilityPercent = 2
NShares = MaxCapital * (ExpectedDailyVolatilityPercent /100)/ AverageTrueRange[5](close)
NShares = MIN(NShares, MaxCapital/entryPrice)
If not onmarket and EntryCondLong then
Buy NShares shares AT entryPrice limit
endif
If longonmarket then
TargPrL = (1 + 2.8/100.0) * TRADEPRICE
Sell AT TargPrL limit
If ExitCondLong then
Sell AT market
endif
endif
//
SET STOP %LOSS 10
a+