_SECTION_BEGIN("Overbought/Oversold/Warning Detail");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g,Hi %g,Lo %g, Close %g (%.1f%%)
Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
m = Param("Periods", 14, 7, 20, 1 );
n = Param("Average", 5, 3, 10, 1 );
Va1 = 0.1 * ( RSI( n ) - 50 );
Va2 = WMA( Va1, n );
Va3=exp(2*Va2);
Va4=(Va3-1)/(Va3+1);
gun = WMA(50*va4+50,2);
CCC=MA((CCI(m)+100)/2,3);
Buy4=IIf(Cross(Ccc,0) OR Cross(gun,3), 50,0);
Sell4=IIf(Cross(100,Ccc) OR Cross(97,gun), 50,0);
xClose = EMA((Open+High+Low+Close)/4,3) ;
xOpen = EMA((Ref(Open,-1) + Ref(xClose,-1))/2,3);
Temp = Max(High, xOpen);
xHigh = EMA(Max(Temp, xClose),3);
Temp = Min(Low,XOpen);
xLow = EMA(Min(Temp, xClose),3);
m = Param("Periods", 20, 10,30, 1 );
n = Param("Average", 5, 3, 10, 1 );
p= Param("Ratio", 1.5, 0.1, 2, 0.2 );
x1=Ref(C,-1);
x3=((3*WMA((C-LLV(L,m))/(HHV(H,m)-LLV(L,m))*100,5)-
2*WMA(WMA((C-LLV(L,m))/(HHV(H,m)-LLV(L,m))*100,5),3)-50)*p+50);
x4=(x3+x3)/2;
x5=WMA(C+(x4/50-1)*(MA(C,30)/20)*p,3);
x6=EMA(EMA(x5,3),3);
n1=n;
n2=2*n1;
n3=2*n1;
m=n1;
Var1=Ref(Close,-1);
Var3=WMA(Max(Close-Var1,0),n1)/WMA(abs(Close-Var1),n1)*100;
Var4=WMA(Max(Close-Var1,0),n2)/WMA(abs(Close-Var1),n2)*100;
Var5=WMA(Max(Close-Var1,0),n3)/WMA(abs(Close-Var1),n3)*100;
Var6=IIf(Cross(Var3,Var5),Low,Ref(Low,-BarsSince(Cross(Var3,Var5))));
Var7=IIf(Cross(Var5,Var3),High,Ref(High,-BarsSince(Cross(Var5,Var3))));
Var8=IIf(Close>=MA(Close,m),80,50);
Var9=IIf(Close>=MA(Close,m),50,20);
VarA=IIf(Var3<Var8 AND Ref(Var3,-1)>=Var8,HHV(Ref(High,-1),BarsSince(Var3>=Var8 AND Ref(Var3,-1)<Var8)-1),
Ref(HHV(Ref(High,-1),BarsSince(Var3>=Var8 AND Ref(Var3,-1)<Var8)-1), -BarsSince(Var3<Var8 AND Ref(Var3,-1))));
VarB=IIf(High>VarA,Low,Ref(Low,-BarsSince(High>VarA)));
VarC=IIf(High>VarA,Var3,Ref(Var3,-BarsSince(High>VarA)));
VarD=IIf(High>VarB AND Var3<VarC AND Var3<Var5,High,Ref(High,-BarsSince(High>VarB AND Var3<VarC AND Var3<Var5)));
VarE=IIf(Var3>Var9 AND Ref(Var3,-1)<=Var9,LLV(Ref(Low,-1),BarsSince(Var3<=Var9 AND Ref(Var3,-1)>Var9)-1),
Ref(LLV(Ref(Low,-1),BarsSince(Var3<=Var9 AND Ref(Var3,-1)>Var9)-1),-BarsSince(Var3>Var9 AND Ref(Var3,-1))));
VarF=IIf(Low<VarE,High,Ref(High,-BarsSince(Low<VarE)));
Var10=IIf(Low<VarE,Var3,Ref(Var3,-BarsSince(Low<VarE)));
Var11=IIf(Low<VarF AND Var3>Var10 AND Var3>Var5,Low,Ref(Low,-BarsSince(Low<VarF AND Var3>Var10 AND Var3>Var5)));
sup=Var11;
pres= VarD;
ave=(pres+sup)/2;
Plot(sup,"Sup",11,1);
Plot(pres,"Res",11,1);
Buy2 = (x6>Ref(x6,-1) AND (Cross(x6,sup) OR ( x6>Ref(x6,-1) AND Ref(x6,-1)<Ref(x6,-2) AND x6<ave)));
Sell2= x6<Ref(x6,-1) AND (Cross(pres,x6 ) OR ( x6<Ref(x6,-1) AND Ref(x6,-1)>Ref(x6,-2) AND x6>ave));
BuyOffSet = 18;
SellOffset = 18;
RegLength = 5;
BuyATRPeriod = 2;
SellATRPeriod = BuyATRPeriod;
ATRMultiplier = 0.5;
G8 = HHV(H-ATRMultiplier*ATR(BuyATRPeriod),BuyOffset);
G9 = LLV(L+ATRMultiplier*ATR(SellATRPeriod),SellOffset);
ave=(G8+G9)/2;
Var1=(Open+Low+High+Close)/4;
Var2=EMA(EMA(Close, 2), 2);
Var3=EMA(EMA(Var2, 5), 5);
sup1=EMA(EMA(Var1,5),2);
sup2= LLV(sup1,13);
sup3= LLV(Low,60)*1.02;
res1= HHV(sup1,13);
res2= HHV(sup1,60);
res3= HHV(High,60)*0.98;
nn=20;
mmm=120;
Ttt= ( H + L + 2 * C ) / 4;
CI= (Ttt -MA(Ttt,14)) / (0.015*StDev(Ttt,14));
CCCI=EMA(EMA(CI,3),3)+mmm;
Hh=HHV(H,nn);
Ll=LLV(L,nn);
MM=(Hh+Ll)/2;
CCCC=EMA(CCCI*(Hh-Ll)/(2*mmm)+Ll,3);
Plot(Hh,"Res",14,styleLine);
Plot(Ll,"Sup",14,styleLine);
Buy1 = Cccc>Ref(Cccc,-1) AND ((Cccc>Ref(Cccc,-1) AND Ref(Cccc,-1)<Ref(Cccc,-2) AND Cccc<ave) OR Cross(Cccc,Ll) OR Cross(Cccc,G9));
Sell1= Cccc<Ref(Cccc,-1) AND ((Cccc<Ref(Cccc,-1) AND Ref(Cccc,-1)>Ref(Cccc,-2) AND Cccc>ave) OR Cross(Hh,Cccc) OR Cross(G8,Cccc));
pfrom = Param("Price From", 0, 0, 1000, 0.5 );
pto = Param("Price To", 1000, 0, 1000, 0.5 );
Minv = Param("Minimum Volume (K)", 500, 0, 1000, 50);
dd = Param("Decimal Digits", 1.2, 1, 1.7, 0.1 );
Filter = (Buy1 OR Sell1) AND C>pfrom AND C<pto AND V>1000*Minv;
Title = StrFormat("\\c02 {{NAME}} | {{DATE}} | Open : %g | High : %g | Low : %g | Close : %g | Change = %.1f%% | Volume = " +WriteVal( V, 1.0 ) +" {{VALUES}}",O, H, L, C, SelectedValue( ROC( C, 1 )) );
SupResPeriod = Param("LookBack Period", 50, 0, 200,1);
SupResPercentage = Param("Percentage", 100, 0, 200,1);
PricePeriod = Param("Price Period", 16, 0, 200,1);
SupportLinecolor = ParamColor( "Support Color", colorGreen );
SupportLinestyle = ParamStyle("Support Style", styleThick|8|styleNoLabel);
ResistanceLinecolor = ParamColor( "Resistance Color", colorRed );
Resistancestyle = ParamStyle("Resistance Style", styleThick|8|styleNoLabel);
OverBought = Param("OverBought Above", 200, 0, 400,1);
OverSold = Param("OverSold Bellow", -200, -400, 0,1);
Smoother = Param("Trend Smoother", 5, 5, 20);
upcolor = ParamColor( "UpTrend Color", colorGreen );
Downcolor = ParamColor( "DownTrend Color", colorRed );
Warningcolor = ParamColor( "Warning/Watch Signal", colorBlue );
WatchColor = ParamColor( "Accumulation Zone", colorWhite );
EntryColor = ParamColor( "Entry Signal", colorAqua );
ProfitTakeColor = ParamColor( "Distribution Zone", colorYellow );
ExitColor = ParamColor( "Exit Signal", colorRed );
Lookback=SupResPeriod;
PerCent=SupResPercentage;
Pds =PricePeriod;
Var=MACD();
Up=IIf(Var>Ref(Var,-1),abs(Var-Ref(Var,-1)),0);
Dn=IIf(Var<Ref(Var,-1),abs(Var-Ref(Var,-1)),0);
Ut=Wilders(Up,Pds);
Dt=Wilders(Dn,Pds);
RSIt=100*(Ut/(Ut+Dt));
A1=RSIt; B2=RSI(pds); C3=CCI(pds); D4=StochK(pds); E5=StochD(pds);
F6=MFI(pds); G7=Ultimate(pds); H8=ROC(C,pds);
Osc=C3;
Value1 = Osc;
Value2 = HHV(Value1,Lookback);
Value3 = LLV(Value1,Lookback);
Value4 = Value2 - Value3;
Value5 = Value4 * (PerCent / 100);
ResistanceLine = Value3 + Value5;
SupportLine = Value2 - Value5;
baseline=IIf( Osc < 100 AND Osc > 10 ,50 ,IIf( Osc < 0 ,0,0));
n=Smoother;
ys1=(High+Low+Close*2)/4;
rk3=EMA(ys1,n);
rk4=StDev(ys1,n);
rk5=(ys1-rk3)*200/rk4;
rk6=EMA(rk5,n);
UP=EMA(rk6,n);
DOWN=EMA(up,n);
Oo=IIf(up<down,up,down);
Hh=Oo;
Ll=IIf(up<down,down,up);
Cc=Ll;
barcolor2=IIf(Ref(oo,-1)<Oo AND Cc<Ref(Cc,-1),upcolor,IIf(up>down,upcolor,downcolor));
SetBarFillColor( barcolor2);
Buy=Cross(up,OverSold) ;
Sell=Cross(OverBought,up) ;
PlotShapes (IIf(Buy, shapeUpArrow, shapeNone) ,colorRed,0,L,-5 );
PlotShapes (IIf(Sell, shapeDownArrow, shapeNone) ,colorBrightGreen,0,H,5 );
Buy3=IIf(Ref(oo,-1)<Oo AND Cc<Ref(Cc,-1),1,IIf(up>down,1,0)) AND (Buy1 OR Buy2 OR Buy4);
Short3 = barcolor2=IIf(Ref(oo,-1)<Oo AND Cc<Ref(Cc,-1),0,IIf(up>down,0,1)) AND ( Sell1 OR Sell2 OR Sell4);
Buy3 = ExRem(Buy3 ,Short3);
Short3 = ExRem(Short3,Buy3);
PlotShapes(Buy3 * shapeUpArrow , colorCustom12,0,L,-10);
PlotShapes(Short3 * shapeDownArrow , colorBlue,0,H,-10);
UP=EMA(rk6,n);
UPshape = IIf(UP >= OverBought OR UP<=OverSold, shapeHollowSmallCircle, shapeNone);
UPColor = IIf(UP>=210, ProfitTakeColor, IIf(UP<=-210, WatchColor, Warningcolor));
PlotShapes(UPShape, UPColor, 0, C, 0);
m = Param("Periods", 14, 7, 20, 1 );
n = Param("Average", 5, 3, 10, 1 );
Va1 = 0.1 * ( RSI( n ) - 50 );
Va2 = WMA( Va1, n );
Va3=exp(2*Va2);
Va4=(Va3-1)/(Va3+1);
gun = WMA(50*va4+50,2);
CCC=MA((CCI(m)+100)/2,3);
Buy4=IIf(Cross(Ccc,0) OR Cross(gun,3), 50,0);
Sell4=IIf(Cross(100,Ccc) OR Cross(97,gun), 50,0);
_SECTION_END();
GraphXSpace =10;
_SECTION_BEGIN("Price1");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();