_SECTION_BEGIN("Chart Settings");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer Panel",colorPaleBlue));
SetChartBkGradientFill(ParamColor("Upper Chart",1),ParamColor("Lower Chart",23));
_SECTION_END();
_SECTION_BEGIN("Pilihan Charts");
EMA_SLOPE = ParamToggle("EMA_SLOPE", "Hide|Show",0);
BB_MACD = ParamToggle("BB_MACD", "Hide|Show",0);
BRESSERT = ParamToggle("BRESSERT", "Hide|Show",0);
INVERS_FICHER = ParamToggle("INVERS_FICHER", "Hide|Show",0);
STOKASTIK = ParamToggle("STOKASTIK", "Hide|Show",0);
CHAOS_FRACTAL = ParamToggle("CHAOS_FRACTAL", "Hide|Show",0);
STOCHRSI = ParamToggle("STOCHRSI", "Hide|Show",0);
SATURASYON = ParamToggle("SATURASYON", "Hide|Show",0);
RMO = ParamToggle("RMO", "Hide|Show",1);
SMOOT_RSI = ParamToggle("SMOOT_RSI", "Hide|Show",0);
RSI_DIVERGENCE = ParamToggle("RSI_DIVERGENCE", "Hide|Show",0);
TSI = ParamToggle("TSI", "Hide|Show",0);
_SECTION_END();
if(EMA_SLOPE==1)
{
_SECTION_BEGIN("EMA_SLOPE");
pds = Param("EMA Periods", 21, 1, 2520, 1);
Period= ParamList("Use as Input","Open|High|Low|Close|Volume",1);
if(Period=="Open"){x=Open;}
if(Period=="High"){x=High;}
if(Period=="Low"){x=Low;}
if(Period=="Close"){x=Close;}
if(Period=="Volume"){x=Volume;}
//Indicator
EMAx=EMA(x,pds);
//Slope
EMAprev=Ref(EMAx,-1);
y=Min(EMAx,EMAprev)/Max(EMAx,EMAprev);
EMAratio=(IIf(EMAx>EMAprev,2-y,y)-1)*100;
EMAper=IIf(EMAratio < 0, atan2(EMAratio,1)-360, atan2(EMAratio,1))*10/9; //This is where the problem lies
Signalx=EMA(EMAper,pds);
//Plots
Plot(Signalx, "Signal", colorGreen, styleLine|styleThick);
Plot(EMAper, "EMAper", colorRed, styleLine|styleThick);
_SECTION_END();
}
if(BB_MACD==1)
{
_SECTION_BEGIN("BB-MACD");
Length=Param( "Length ",4,2, 50,1);
Length1=Param( "Length1 ",5,2, 100,1);
LengthP=Param( "LengthP ",1,1, 100,1);
Phase=Param( "Phase", 2,2, 100,1);
A1=EMA(Close,Length) - EMA(Close,Length1);
BBtop=BBandTop(A1,10,1);
BBbot=BBandBot(A1,10,1);
Color=IIf(a1<0 AND a1>Ref(a1,-1), colorLime,IIf(a1>0 AND a1>Ref(a1,-1),colorBrightGreen,IIf(a1>0 AND a1<Ref(a1,-1),colorPink,colorRed)));
Plot(a1,"MACD",color,styleDots+styleLine);
Plot(BBtop,"BBtop",colorDarkGreen,styleDashed);
Plot(BBbot,"BBbot",colorDarkRed,styleDashed);
Plot(0,"",31,1);
P = ParamField("Price field",-1);
Plot(EMA( P,Phase ), _DEFAULT_NAME(), colorBlue, styleThick );
_SECTION_END();
}
if(BRESSERT==1)
{
_SECTION_BEGIN("DBS10");
Slw = Param("Slowing double stoch",3,1,5,1);
Pds = Param("Periods double stoch",10,3,21,1);
A = EMA((Close-LLV(Low,Pds))/ (HHV(H,pds)-LLV(L,Pds)),Slw)*100;
ind = EMA((A-LLV(A,pds))/(HHV(A,Pds)-LLV(A,Pds)),Slw)*100;
Upper=Param("Upper", 70, 50, 100, 1);
Lower=Param("Lower", 30, 0, 50, 1);
Plot( ind, "ind", ParamColor( "Color", colorRed ), ParamStyle("Style", styleThick) );
Plot(Upper,"Upper",ParamColor( "ColorUpper", colorRed ),styleLine);
Plot(Lower,"Lower",ParamColor( "ColorLower", colorRed ),styleLine);
_SECTION_END();
_SECTION_BEGIN("DBS5");
SetChartOptions(0,0,chartGrid10|chartGrid90);
Slw = Param("Slowing double stoch",3,1,5,1);
Pds = Param("Periods double stoch",5,3,21,1);
A = EMA((Close-LLV(Low,Pds))/ (HHV(H,pds)-LLV(L,Pds)),Slw)*100;
ind = EMA((A-LLV(A,pds))/(HHV(A,Pds)-LLV(A,Pds)),Slw)*100;
Upper=Param("Upper", 90, 50, 100, 1);
Lower=Param("Lower", 10, 0, 50, 1);
Plot( ind, "ind", ParamColor( "Color", colorGreen ), ParamStyle("Style", styleThick) );
Plot(Upper,"Upper",ParamColor( "ColorUpper", colorGreen ),styleLine);
Plot(Lower,"Lower",ParamColor( "ColorLower", colorGreen ),styleLine);
Title =FullName();
_SECTION_END();
}
if(INVERS_FICHER==1)
{
_SECTION_BEGIN("INVERS_FICHER");
Value1=0.1*(RSI(5)-50);
Value2=2*WMA(Value1,9);
ifish=(exp(Value2)-1)/(exp(Value2)+1);
color = IIf(Ref(ifish,-1)<ifish,colorGreen,IIf(Ref(ifish,-1)>ifish,colorRed,colorBlack));
//Plot(ifish,"Inverse Fisher Transform",color);
Plot(0.5,"",colorBrightGreen,1);
Plot(-0.5,"",colorRed,1);
Plot(ifish,"",Color,styleLine|styleThick);
PlotOHLC(ifish,ifish, 0.50,ifish, "",4, styleCloud | styleClipMinMax, 1.0 ,0.50);
PlotOHLC(ifish,ifish,- 0.50,ifish, "",6, styleCloud | styleClipMinMax, -0.50 ,-1.0);
_SECTION_END();
}
if(STOKASTIK==1)
{
_SECTION_BEGIN( "STOKASTIK" );
periods = Param( "Periods", 14, 1, 200, 1 );
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Dsmooth = Param( "%D avg", 3, 1, 200, 1 );
myStochD =StochD( periods , Ksmooth, DSmooth );
myStochK =StochK( periods , Ksmooth);
Overbought = 80 ;
Oversold =20 ;
Center = 50 ;
Buy1 = Cross(myStochK, Oversold ) ;
Buy2 = Cross(myStochK, Center ) ;
Sell1 = Cross( Overbought, myStochK );
Sell2 = Cross( Center, myStochK );
Plot( myStochD, "Stochastic %D"+_PARAM_VALUES( ), ParamColor( "ColorD", colorRed ), ParamStyle(" StyleD") );
Plot( myStochK, "Stochastic %K", ParamColor( "ColorK", colorWhite ), ParamStyle(" StyleK") );
PlotShapes(IIf( Sell1, shapeDownArrow , shapeNone), colorRed,0, Offset=Null) ;
PlotShapes(IIf( Sell2, shapeDownArrow , shapeNone), colorRed,0, Offset=Null) ;
PlotShapes(IIf( Buy1 , shapeUpArrow , shapeNone), colorGold,0, Offset=Null) ;
PlotShapes(IIf( Buy2 , shapeUpArrow , shapeNone), colorGold,0, Offset=Null) ;
Plot(Overbought, "",colorRed) ;
Plot(Oversold, "",colorGreen) ;
Plot(Center, "",colorWhite, styleDashed) ;
y0=LastValue( Trough(StochD( periods , Ksmooth, DSmooth ),1,2));
y1=LastValue( Trough(StochD( periods , Ksmooth, DSmooth ),1,1));
x0=BarCount - 1 - LastValue(TroughBars(StochD( periods , Ksmooth, DSmooth ),1,2));
price_start= Close[x0] ;
x1=BarCount - 1 - LastValue(TroughBars(StochD( periods , Ksmooth, DSmooth ),1,1));
price_end=Close[ x1];
Line = LineArray( x0, y0, x1, y1, 0 );
Plot( Line, "Support line", colorYellow );
Buy = y1>y0 AND price_end<price_start;
PlotShapes(shapeUpArrow * Buy, colorGreen,0, Line);
y00=LastValue( Peak(StochD( periods , Ksmooth, DSmooth ),1,2));
y11=LastValue( Peak(StochD( periods , Ksmooth, DSmooth ),1,1));
x00=BarCount - 1 - LastValue(PeakBars( StochD(periods , Ksmooth, DSmooth ),1,2));
price_start1= Close[x00] ;
x11=BarCount - 1 - LastValue(PeakBars( StochD(periods , Ksmooth, DSmooth ),1,1));
price_end1=Close[ x11];
Line = LineArray( x00, y00, x11, y11, 0 );
Plot( Line, "Resistance line", colorBrightGreen );
Sell = y11<y00 AND price_end1>price_start1;
PlotShapes(shapeDownArrow * Sell, colorOrange,0,Line) ;
PlotOHLC( myStochK,myStochK, 50,myStochK, "", colorDarkGrey, styleCloud | styleClipMinMax, Oversold , Overbought);
PlotOHLC( myStochD,myStochD, 50,myStochD, "", colorDarkRed, styleCloud | styleClipMinMax, Oversold , Overbought);
//Optimize
range = Optimize( "Range", 8, 8, 14, 1 );
Ksmooth = Optimize("%K smooth", 3, 2, 5, 1 );
Dsmooth = Optimize("%D smooth", 3, 2, 5, 1 );
Buy=Cross( StochK (range,Ksmooth) , StochD (range,Ksmooth, Dsmooth) );
Sell = Cross( StochD(range, Ksmooth,Dsmooth) , StochK(range, Ksmooth) );
_SECTION_END( );
}
if(CHAOS_FRACTAL==1)
{
_SECTION_BEGIN("CHAOS_FRACTAL");
High1 = Ref(High,-2);
High2 = Ref(High,-1);
High3 = Ref(High,0);
High4 = Ref(High,1);
High5 = Ref(High,2);
Low1 = Ref(Low,-2);
Low2 = Ref(Low,-1);
Low3 = Ref(Low,0);
Low4 = Ref(Low,1);
Low5 = Ref(Low,2);
Fractal = IIf((High3 > High1) AND (High3 > High2) AND (High3 > High4) AND (High3 > High5), 1,0);
Fractal = IIf((Low3 < Low1) AND (Low3 < Low2) AND (Low3 < Low4) AND (Low3 < Low5),
IIf(Fractal > 0, 0, -1), Fractal); //Fractal;
Plot(Fractal," Chaos Fractal",colorYellow,styleLine|styleThick);
PlotOHLC(fractal ,fractal ,0 ,fractal, "",24, styleCloud | styleNoRescale);
_SECTION_END();
_SECTION_BEGIN("isim");
GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/8 );
GfxSetTextAlign( 6 );
GfxSetTextColor( ColorHSB( 42, 42, 42 ) );
GfxSetBkMode(6);
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/12 );
GfxSelectFont("Tahoma", Status("pxheight")/18 );
GfxTextOut( "Cengiz SAHIN", Status("pxwidth")/2, Status("pxheight")/3 );
GfxSelectFont("Arial", Status("pxheight")/18 );
GfxTextOut( "Indikatör", Status("pxwidth")/2, Status("pxheight")/4 );
GfxSelectFont("Arial", Status("pxheight")/18 );
_SECTION_END();
}
if(STOCHRSI==1)
{
_SECTION_BEGIN("STOCHRSI");
period = 13;
Graph0=100*( ( RSI( period ) - LLV( RSI( period ) , period ) ) / ( ( HHV( RSI(
period ) , period ) ) - LLV(RSI( period ), period ) ) );
period = 24;
Graph0=100*EMA(( ( RSI( period ) - LLV( RSI( period ) , period ) ) / ( ( HHV( RSI( period ) , period ) ) - LLV(RSI( period ), period ) ) ), 3 );
UpperLine = 90;
LowerLine = 10;
r = RSI(24);
StoRSI = EMA(( r - LLV( r, 24 )) / (( HHV( r, 24 )) - LLV( r, 24 )), 3 ) * 100;
Plot( StoRSI , "StoRSI", colorWhite, styleThick);
GraphXSpace = 2;
_SECTION_END();
_SECTION_BEGIN("StochMACD");
StochMACD=100*(MACD()-LLV(MACD(),14))/(HHV(MACD(),14)-LLV(MACD(),14));
Plot(StochMACD,"StochMACD",colorBrightGreen,styleThick);
Plot(90,"",colorRed,styleLine);
Plot(50,"",colorYellow,styleDashed);
Plot(10,"",colorRed,styleLine);
_SECTION_END();
_SECTION_BEGIN("William's +");
R = ((HHV(H,14) - C) /(HHV (H,14) -LLV (L,14))) *-100;
Plot(R, "Williams %R", colorYellow, styleThick,styleOwnScale);
Plot(-10,"",colorRed,styleLine);
Plot(-90,"",colorRed,styleLine);
_SECTION_END();
_SECTION_BEGIN("Trend arrow");
n= Param("No. of Bars",3,2,8,1);
TrendUp = H > Ref(HHV(H,n),-1);
TrendDn = L < Ref(LLV(L,n),-1);
TrendUp = ExRem(TrendUp,TrendDn);
TrendDn = ExRem(TrendDn,TrendUp);
PlotShapes(TrendUp*shapeUpArrow,colorWhite);
PlotShapes(TrendDn*shapeDownArrow,colorRed);
_SECTION_END();
}
if(SATURASYON==1)
{
_SECTION_BEGIN("SATURASYON");
P=30;
CMO30=100*((Sum(IIf(C>Ref(C,-1),(C-Ref(C,-1)),0),P))-(Sum(IIf(C<Ref(C,-1),(Ref(C,-1)-C),0),P)))/((Sum(IIf(C>Ref(C,-1),(C-Ref(C,-1)),0),P)+(Sum(IIf(C<Ref(C,-1),(Ref(C,-1)-C),0),P))));
C1=DEMA(CMO30,30);
D_sat10=RSIa(C1,10);
D_sat5=RSIa(C1,5);
Plot(D_sat10,"",14,1);Plot(D_sat5,"",2,1);Plot(D_sat5-D_sat10,"",10,2);
//Ribbon Starts here
Cross(d_sat5,d_sat10)OR d_sat5 > d_sat10;//you define up rules
Cross(d_sat10,d_sat5)OR d_sat10 > d_sat5;//you define down rules
Buy =Cross(d_sat5,d_sat10);
Sell =Cross(d_sat10,d_sat5);
Filter= Buy OR Sell;
_SECTION_BEGIN("VAP");
segments = IIf(Cross(d_sat5,d_sat10) ,Cross(d_sat5,d_sat10), Cross(d_sat10,d_sat5));
PlotVAPOverlayA( segments , Param("Lines", 300, 100, 1000, 1 ), Param("Width", 100, 1, 100, 1 ), ParamColor("Color", colorGold ), ParamToggle("Side", "Left|Right" ) | 2 * ParamToggle("Style", "Fill|Lines", 0) | 4*ParamToggle("Z-order", "On top|Behind", 1 ) );
Plot(segments, "", IIf(Buy,colorYellow,colorRed), styleHistogram | styleOwnScale );
_SECTION_END();
_SECTION_END();
}
if(RMO==1)
{
_SECTION_BEGIN("RMO");
SwingTrd1 = 100 * (Close - ((MA(C,2)+
MA(MA(C,2),2)+
MA(MA(MA(C,2),2),2) +
MA(MA(MA(MA(C,2),2),2),2) +
MA(MA(MA(MA(MA(C,2),2),2),2),2) +
MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2) +
MA(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2),2)+
MA(MA(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2),2),2)+
MA(MA(MA(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2),2), 2),2)+
MA(MA(MA(MA(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2), 2),2),2),2))
/10))/(HHV(C,10)-LLV(C,10));
SwingTrd2=
EMA(SwingTrd1,30);
SwingTrd3=
EMA(SwingTrd2,30);
RMO= EMA(SwingTrd1,81);
Buy=Cross(SwingTrd2,SwingTrd3);
Sell=Cross(SwingTrd3,SwingTrd2);
Bull_Trend=EMA(SwingTrd1,81)>0;
Bear_Trend=EMA(SwingTrd1,81)<0;
Ribbon_kol=IIf(Bull_Trend,colorGreen, IIf(Bear_Trend,colorRed, colorBlack));
Plot(4, "ribbon", Ribbon_kol, styleOwnScale|styleArea|styleNoLabel, -0.5,100);
Impulse_UP= EMA(SwingTrd1,30) > 0;
Impulse_Down= EMA(SwingTrd1,81) < 0;
bar_kol=IIf(impulse_UP, colorBrightGreen, IIf(impulse_Down, colorRed,IIf(Bull_Trend, colorRed, colorBlue)));
Plot(Close,"Close",bar_kol,styleBar | styleThick );
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorBrightGreen, colorRed ),0, IIf( Buy, Low, High ) );
_SECTION_END();
}
if(SMOOT_RSI==1)
{
_SECTION_BEGIN("SMOOT_RSI");
Plot (EMA (RSI(7),5), "SmoothRSI", colorYellow,styleThick);
A=EMA (RSI(14),5);
B=EMA (RSI(21),5);
Plot(A,"",colorLime, styleLine|styleThick);
Plot(B,"",colorLime, styleLine|styleThick);
PlotOHLC( 0, A , B ,B , "Cloud", IIf(A > B ,colorBrightGreen,ColorRGB(150,0,50)), styleCloud|styleNoLabel);
Color30=IIf(V>EMA(V,10),colorBrightGreen,colorRed) ;
Color50=IIf(V>1.5*EMA(V,10),colorBrightGreen,colorRed);
Color70=IIf(V>2*EMA(V,10),colorBrightGreen,colorRed);
Plot (50, "", color50,styleDots, styleNoLabel);
Plot (30, "", color30, styleNoLabel);
Plot (70, "", color70, styleNoLabel);
Buy=Cross( EMA (RSI(7),5), EMA (RSI(21),5)) AND EMA (RSI(7),5)<50;
Filter =V > 1.5*EMA (V, 10)AND EMA (RSI(7),5)<40 AND Cross( EMA (RSI(7),5), EMA (RSI(21),5));
AddColumn(Close,"Close",1.2);
AddColumn(Volume,"Volume",1.0);
AddColumn(V/EMA(V,20),"Vspurt",1.0);
AddColumn( RSI(), "RSI", 1.2 );
AddColumn( ROC( Close, 15 ), "ROC(15)", 1.2 );
AddColumn( MFI(), "MFI", 1.2 );
AddColumn( OBV(), "OBV", 1.2 );
AddColumn( CCI(), "CCI", 1.2 );
AddColumn( Ultimate(), "Ultimate", 1.4 );
_SECTION_END();
}
if(RSI_DIVERGENCE==1)
{
_SECTION_BEGIN("RSI_DIVERGENCE");
GraphXSpace=7;
n=Param("% Reverse ",20,0,100,1);
Buy=Sell=0;
Var = Zig(RSI(), n);
t= Trough(RSI(), n, 1);
p= Peak(RSI(), n, 1);
x[0] =Var[0];
price[0] = C[0];
j=0;
// bearish divergence
for ( i=0; i<BarCount; i++)
{
if(Var[i] == p[i])
{
j++;
x[j] =Var[i];
price[j] =C[i];
if(x[j] <x[j-1] && price[j-1]< price[j])
Sell[i] =1;
}
}
// bullish divergence
for ( i=0; i<BarCount; i++)
{
if(Var[i] == t[i])
{
j++;
x[j] =Var[i];
price[j] =C[i];
if(x[j] >x[j-1] && price[j]<price[j-1])
Buy[i] =1;
}
}
Plot(Var, "",colorYellow,styleLine|styleThick);
PlotShapes ( IIf(Sell, shapeHollowStar, shapeNone), colorRed, 0 , Var,15);
PlotShapes( IIf(Buy, shapeHollowStar, shapeNone), colorBrightGreen, 0, Var,-15);
Title ="RSI Divergence" ;
_SECTION_END();
_SECTION_BEGIN("TEMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 200, 1, 10 );
Plot( TEMA( P, Periods ),"",colorBrightGreen,styleLine|styleThick);
_SECTION_END();
}
if(TSI==1)
{
_SECTION_BEGIN("TSI");
r = Param( "TSI period 'Length':", 25, 1, 100, 1 );
s = Param( "TSI period 'Smoothing':", 13, 1, 100, 1 );
sig = Param( "Signal period:", 7, 1, 100, 1 );
Mtm = C - Ref ( C, -1 );
AbsMtm = abs ( Mtm );
Num_T = EMA ( EMA ( Mtm, r ), s );
Den_T = EMA ( EMA ( AbsMtm, r ), s );
TSI = 100 * Nz ( Num_T / Den_T );
Plot( TSI, "TSI("+r+","+s+")", ParamColor( "Color", colorRed ), ParamStyle("Style") );
Plot(EMA(TSI,sig), "", colorLightBlue);
PlotGrid(0, colorLightGrey);
PlotGrid(25, colorLightGrey);
PlotGrid(-25, colorLightGrey);
_SECTION_END();
}
//**********Formulas End ***********