// Downloaded From https://www.WiseStockTrader.com
SetChartOptions( 0, chartShowArrows|chartShowDates );

_SECTION_BEGIN("BW Buaya Lucu & Seru Timur Langit");

//SetChartBkGradientFill( colorWhite,colorWhite,colorWhite); 


_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Close %g {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
 
PriceStyle = GetPriceStyle();
 
PriceStyleOpt = ParamStyle("Price Style")|PriceStyle;
 
if (PriceStyle==styleCandle)
Plot( C, "Buaya Lucu & Seru Timur Langit", colorAqua, PriceStyleOpt); 
else
Plot( C, "Buaya Lucu & Seru Timur Langit", IIf( Close >= Ref(C, -1), colorBrightGreen, colorRed ),
 
PriceStyleOpt);
percentChange = 3;
ZZ = Zig(C,LastValue(PercentChange)) ; 
 
Plot(ZZ,"", colorBlue,styleLine|styleThick| styleNoLabel);
Plot(ZZ*0.9997,"", colorBlue,styleLine|styleThick| styleNoLabel);
Plot(ZZ*1.0003,"", colorBlue,styleLine|styleThick| styleNoLabel);
PivotLow = Ref(IIf(Ref(ROC(ZZ,1),-1) < 0 AND ROC(ZZ,1) > 0, 1, Null),1);
PivotHigh = Ref(IIf(Ref(ROC(ZZ,1),-1) > 0 AND ROC(ZZ,1) < 0, 1, Null),1);
PlotShapes( IIf(PivotLow,shapeCircle,0) ,colorBlue, 0, L,-12);
PlotShapes( IIf(PivotHigh,shapeCircle,0) ,colorCustom12, 0, H,12);
 
//Plot( EMA( C, 100 ), "EMA100", colorOrange, styleThick); 
//Plot( EMA( C, 200 ), "EMA200", colorCustom12, styleThick); 
//Plot( 0.999*EMA( C, 100 ), "", colorOrange, styleThick | styleNoLabel); 
//Plot( 0.999*EMA( C, 200 ), "", colorCustom12, styleThick | styleNoLabel); 
//Plot( 1.001*EMA( C, 100 ), "", colorOrange, styleThick | styleNoLabel); 
//Plot( 1.001*EMA( C, 200 ), "", colorCustom12, styleThick | styleNoLabel); 


 
A = (H+L)/2;

SlowMA=MA( A,34);
FastMA=MA( A,5);
AO=FastMA-SlowMA;
UpColor=AO >= Ref(AO,-1);
DnColor=AO < Ref(AO,-1);
 
UpFractal= ValueWhen(
(Ref(H,-2) > Ref(H, -4)) AND
(Ref(H,-2) > Ref(H, -3)) AND
(Ref(H,-2) > Ref(H, -1)) AND
(Ref(H,-2) > H), Ref(H,-2));
 
DownFractal= ValueWhen(
(Ref(L,-2) <= Ref(L, -4)) AND
(Ref(L,-2) <= Ref(L, -3)) AND
(Ref(L,-2) <= Ref(L, -1)) AND
(Ref(L,-2) <= L), Ref(L,-2));
 
UpFractalMax = Max(HHV(H,3),Ref(UpFractal,2));
DownFractalMin = Min(LLV(L,3),Ref(DownFractal,2));
Plot(UpFractalMax, "BF" ,33, styleThick);
Plot(DownFractalMin, "SF",11, styleThick);
 

PlotShapes( IIf(DownFractalMin>Ref(DownFractalMin,-1),shapeSmallCircle,0) ,colorBlue, 0, L,-2);
PlotShapes( IIf(DownFractalMin>Ref(DownFractalMin,-1),shapeHollowCircle,0) ,colorWhite, 0, L,-2);
PlotShapes( IIf(AO>0 AND C<Ref(DownFractalMin,-1),shapeSmallCircle,0) ,colorRed, 0, H,2);
PlotShapes( IIf(AO>0 AND C<Ref(DownFractalMin,-1),shapeHollowCircle,0) ,colorBlack, 0, H,2);
PlotShapes( IIf(AO<0 AND C<Ref(DownFractalMin,-1),shapeSmallCircle,0) ,colorRed, 0, H,2);
PlotShapes( IIf(AO<0 AND C<Ref(DownFractalMin,-1),shapeHollowCircle,0) ,colorBlack, 0, H,2);



AlligatorJaw = Ref(Wilders(A,13),-8);
AlligatorTeeth = Ref(Wilders(A,8), -5);
AlligatorLips = Ref(Wilders(A,5), -3);
 
Plot(AlligatorJaw, "", colorBlue, styleThick | styleNoLabel);
Plot(AlligatorTeeth,"", colorRed, styleThick | styleNoLabel);
Plot(AlligatorLips, "", colorDarkGreen,styleThick | styleNoLabel);

PlotOHLC( C,C,AlligatorLips,AlligatorLips, "", IIf(C>AlligatorLips,colorLime,colorRed), styleCloud| styleNoLabel);
PlotOHLC( AlligatorLips,AlligatorLips,AlligatorJaw,AlligatorJaw, "", IIf(AlligatorLips>AlligatorJaw,colorYellow,colorPink), styleCloud| styleNoLabel);
Buy= Cross(C,AlligatorLips);
Sell=Cross(AlligatorLips,C);

myStochD=StochD( 14 , 34, 8 );
myStochK=StochK( 14 , 34);
BuySto = Cross(myStochK, myStochD );
SellSto = Cross( myStochD, myStochK );
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
r4 = Param( "Wk slow", 8, 2, 200, 1 );
r5 = Param( "Wk fast", 17, 2, 200, 1 );
m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);




M0=IIf(AO<-120,IIf(AO>Ref(AO,-1) AND Ref(AO,-1)<Ref(AO,-2),1,0),0);
PlotShapes( IIf(M0,shapeSmallCircle,0) ,colorWhite, 0, L,-2);
PlotShapes( IIf(M0,shapeHollowCircle,0) ,colorDarkGreen, 0, L,-2);

R3a=Cross(m1,s1) AND m1<0;
PlotShapes(IIf(R3a,shapeCircle ,Null),colorBlack,0,L,-30);
PlotShapes(IIf(R3a,shapeDigit0 ,Null),colorWhite,0,L,-30);
PlotShapes(IIf(R3a,shapeUpArrow,Null),colorWhite,0,L,-15);


H1=Cross(AO,0);
PlotShapes(IIf(H1,shapeCircle ,Null),colorBlack,0,L,-45);
PlotShapes(IIf(H1,shapeDigit1 ,0) ,colorGold, 0, L,-45);
PlotShapes(IIf(H1,shapeUpArrow ,0) ,colorGold, 0, L,-30);

A00=IIf(AO<0,IIf(BuySto,1,0),0);
PlotShapes( IIf(A00,shapeSmallCircle,0) ,colorWhite, 0, L,-2);
PlotShapes( IIf(A00,shapeHollowCircle,0) ,colorDarkGreen, 0, L,-2);

Z01=IIf(AO>0,IIf(SellSto,1,0),0);
PlotShapes( IIf(Z01,shapeSmallCircle,0) ,colorRed, 0, H,2);
PlotShapes( IIf(Z01,shapeHollowCircle,0) ,colorBlack, 0, H,2);

A11=IIf(AO>120,IIf(AO<Ref(AO,-1) AND Ref(AO,-1)>Ref(AO,-2),1,0),0);
PlotShapes( IIf(A11,shapeSmallCircle,0) ,colorRed, 0, H,2);
PlotShapes( IIf(A11,shapeHollowCircle,0) ,colorBlack, 0, H,2);


I2=Cross(m1,s1) AND m1>0;
PlotShapes(IIf(I2,shapeCircle ,Null),colorBlack,0,L,-45);
PlotShapes(IIf(I2,shapeDigit2 ,Null),colorLime,0,L,-45);
PlotShapes(IIf(I2,shapeUpArrow,Null),colorLime,0,L,-30);

//Zero crossover down

R3=Cross(s1,m1) AND m1>0;
PlotShapes(IIf(R3,shapeCircle ,Null),colorBlack,0,H,25);
PlotShapes(IIf(R3,shapeDigit3 ,Null),colorRed,0,H,25);
PlotShapes(IIf(R3,shapeDownArrow,Null),colorRed,0,H,-10);


// crossover below zero

I4=Cross(0,m1);
PlotShapes(IIf(I4,shapeCircle ,Null),colorBlack,0,H,30);
PlotShapes(IIf(I4,shapeDigit4 ,Null),colorCustom12,0,H,30);
PlotShapes(IIf(I4,shapeDownArrow,Null),colorCustom12,0,H,-15);


N41=Cross(0,AO);
PlotShapes(IIf(N41,shapeCircle ,Null),colorBlack,0,H,45);
PlotShapes(IIf(N41,shapeDigit4 ,0) ,colorCustom12, 0, H,45);
PlotShapes(IIf(N41,shapeDownArrow ,0) ,colorCustom12, 0, H,-30);

//SetChartBkColor( Color00); 
color = IIf( C > AlligatorLips, IIf( C>AlligatorJaw, colorDarkYellow, colorSeaGreen), IIf(AlligatorJaw>AlligatorLips, colorDarkRed, colorTan));
SetChartBkColor( LastValue(color) );

C13=Param("fonts",20,10,30,1 );
C14=Param("left-right",2.1,1.0,5.0,0.1 );
C15=Param("up-down",12,1,20,1 );
Miny = Status("axisminy");
Maxy = Status("axismaxy");
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");

GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/8 );
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( colorDarkGrey );
GfxSetBkMode(0); // transparent
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/12 );
GfxSelectFont("Tahoma", Status("pxheight")/18 );
//GfxTextOut( IndustryID(1), Status("pxwidth")/2, Status("pxheight")/4 );

GfxSelectFont("Tahoma", Status("pxheight")/18 );
GfxSelectFont("Tahoma", Status("pxheight")/36 );
//GfxTextOut( "chartistsbd.net", Status("pxwidth")/2, Status("pxheight")/3 );//GfxSelectFont("Aparajita", Status("pxheight")/C13*1 );
//GfxTextOut( IndustryID(1), Status("pxwidth")/2, Status("pxheight")/C15*2.3 );

GfxSelectFont("Aparajita", Status("pxheight")/C13*1.1 );
GfxSetTextColor( ColorHSB( 50, 50, 50 ) );
GfxTextOut( FullName(), Status("pxwidth")/2, Status("pxheight")/C15*10.5);

_SECTION_END();