//CODED BY GRIZZLY - AUG 2016// DEFPARAM CumulateOrders = True DEFPARAM Preloadbars = 2000 //INDICATORS// ema3 = exponentialaverage[200*2.3] ema2 = exponentialaverage[200*1.4] ema1 = exponentialaverage[200*1] Parabolic = SAR[0.001,0.001,0.2] myBaseLine, myConversionLine, mySpanA, mySpanB = CALL myichi[9 ,26 ,52 ,26] HH = highest[30](high) LL = lowest[30](low) Ranger = (HH-LL)<18*pipsize and abs(parabolic[0]-close)<50*pipsize and (abs(parabolic[0]-parabolic[1])<6*pipsize) C1 = Parabolic[0]>HIGH and Parabolic[0]>102.00 //RED SAR = SHORT IF USD/YEN > 102.00 C2 = Parabolic[0]myspana and myBaseLine>0 and myconversionline>0//BULLISH LONG C4 = myspanaopen[0]) and (high[0]-low[0]> 2*pipsize) and not onmarket and C1 and not (C3 or C4) //Lower Low Higher Close = Long HHLC = (High[0]>High[1] and close[0] 2*pipsize) and not onmarket and C2 and not (C3 or C4) //Higher High Lower Close = Short ExtremeDailyHigh = dailydelta>130 and not onmarket ExteremeDailyLow = dailydelta<-130 and not onmarket //TIME MGT - E.g Daily time restrictions & Do Not trade NFP days) Time1 = 010000 Time2 = 230000 if time = time1 then dayopen = open[0] else dayclose = close endif DailyDelta = (dayclose-dayopen)*100 TwoDayDelta = (dayclose-dayopen[1440])*100 Timer = time >= Time1 and time <= Time2 and (not (Day<8 and DayOfWeek=5)) and Sundayopen and Ranger Sundayopen = dopen(1)-dclose(1) < 100*pipsize CloseAll = (currenthour = 21 and currentdayofweek >= 0) or (Day<8 and DayOfWeek=5) // //MONEY MGT// MaxPositionA = 40 MaxPositionB = 80 RiskSwitch = 1 //1 = On, 0 = Off Ratio = 2 Equity = (Strategyprofit+20000) Risk = min(round(Ratio*Equity/100000)*RiskSwitch,MaxPositionA) Losses = positionperf(1)<0 and positionperf(2)<0 and positionperf(3)<0 Streak = positionperf(1)>0 and positionperf(2)>0 and positionperf(3)>0 if losses and strategyprofit<15000000 then n = max(abs(round(max(1+risk*0.75,risk*0.75))),1) elsif not losses then n = max(abs(round(max(7+risk,risk))),7) endif if Streak and strategyprofit>50000 then n = max(abs(round(max(5+risk*1.5,risk*1.5))),1) endif // //TIMERS// T1 = (barindex-tradeindex>=3) T2 = (barindex-tradeindex>=3) // //FALLACY - Runs are not statistically indepedent to trend// LLL = (tradeprice(1)>tradeprice(2) and tradeprice(3)>tradeprice(4) and tradeprice(4)>tradeprice(5) and tradeprice(5)>tradeprice(6) and Streak and positionperf(4)>0 and positionperf(5)>0) or dailydelta>100 or twodaydelta>120 SSS = (tradeprice(1)0 and positionperf(5)>0) or dailydelta<-100 or twodaydelta<-120 // //ENTER LONG - GREEN SAR// if Timer and (ema1>ema2 and ema2>ema3 and close>ema3 and c3) and c2 and T1 and not (LLL or LLHC or HHLC) then buy min(n,max(n,MaxPositionA)) contract at abs(breakeven+spread*pipsize) limit breakeven = parabolic if (timer or not timer) and T2 and longonmarket then sell at abs(breakeven+spread*pipsize) stop if Closeall and longonmarket then sell at market endif endif endif if T1 and (llhc or ExteremeDailyLow) then buy abs(min(n,max(n,MaxPositionA))) contract at market if T1 and close>=tradeprice then sell at abs(breakeven+spread*pipsize) stop endif endif // //ENTER SHORT - RED SAR// if Timer and (ema1(150*pipsize) //~70pip loss GappingProfit = abs(parabolic-close)>(150*pipsize) //~50pip gain if T1 and longonmarket and positionperf<0 and gappingLoss then sellshort min(round(n*1.5),MaxPositionB) contract at market //exitshort at parabolic stop - not included elsif T1 and shortonmarket and positionperf<0 and gappingLoss and c2 then buy min(round(n*1.5),MaxPositionB) contract at market //sell at parabolic stop - not included endif if T1 and longonmarket and positionperf>0 and gappingProfit then sellshort min(round(n*1.5),MaxPositionB) contract at market //exitshort at parabolic stop - not included elsif T1 and shortonmarket and positionperf>0 and gappingProfit and c2 then buy min(round(n*1.5),MaxPositionB)contract at market //sell at parabolic stop - not included endif //QUIT PROGRAM Floatingprofit = ((((close-positionprice)*pointvalue)*countofposition)/pipsize + strategyprofit) + FloatingprofitII = ((((close-positionprice)*pointvalue)*countofposition)/pipsize + strategyprofit) FastAverageFloating = average[5](Floatingprofit) SlowAverageFloating = average[300](FloatingprofitII) UHOH = (FastAverageFloating <= SlowAverageFloating) if strategyprofit<-105000 or UHOH then QUIT endif // //DEVELOPMENT & GRAPH AREA ****************************************** //graph mynumber coloured (200,0,0) as "delta" //graph twodaydelta coloured (10,0,50) as "risk" //graph threedaydelta coloured (222,10,0) as "c2" //HighWaterMark = (-200000*(risk/n)+equity)