// Downloaded From https://www.WiseStockTrader.com
_SECTION_BEGIN("Price");
Plot( C, "Close", ParamColor("Color", colorGrey50 ), styleNoTitle | ParamStyle("Style") | GetPriceStyle( ) ); 
_SECTION_END( );

SetChartOptions( 0, chartShowArrows| chartShowDates );

SetChartOptions( 0, chartShowArrows| chartShowDates );

_SECTION_BEGIN("Fractal");
UpFractal= ValueWhen(
 (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,-3) <= Ref(L, -4)) AND
 (Ref(L,-3) <=  Ref(L, -2)) AND
 (Ref(L,-3) <=  Ref(L, -1)) AND
 (Ref(L,-3) <=  L), Ref(L,-3));
Buy  = (Ref(C,-1)<=UpFractal) AND C>UpFractal;
//Buy  = (Ref(C,-1)<=UpFractal) AND C>UpFractal AND V >= MA(V,20);
Sell = (Ref(C,-1)>=DownFractal) AND C<DownFractal;



//tick
tick=IIf( C<=200,1,
     IIf(C>=200 AND C<=500,5,
     IIf(C>=500 AND C<=2000,10,
     IIf(C>=2000 AND C<=5000,25,
     IIf(C>5000,50,0))) ));

Plot(Ref(UpFractal, 2), "spekulative buy jika tembus", ParamColor("resistance",colorBlue), ParamStyle("Up Fractal Style", styleLine|styleNoTitle));
Plot(Ref(DownFractaL,3), "cutloss jika tembus",ParamColor("suport",colorRed), ParamStyle("Down Fractal Style", styleLine|styleNoTitle));
PlotShapes(IIf( Buy,shapeUpArrow ,Null), ParamColor("Color of Buy Arrow", colorBrightGreen) , 0, H,20);
PlotShapes( IIf(Sell,shapeDownArrow,Null) ,ParamColor("Color of Sell Arrow", colorRed), 0, L, 20);

color = IIf( Buy, ParamColor("Background Color for Buy", colorDarkGreen) , IIf( Sell, ParamColor("Background Color for Sell", colorDarkRed) , IIf(C>UpFractal-3* tick AND C<=UpFractal, ParamColor("Background Color for Ready to Buy", colorPaleTurquoise) , IIf(C<DownFractal+ 3*tick AND C>=DownFractal, ParamColor("Background Color for Ready to Sell", colorTan),colorBlack))));
SetChartBkColor( LastValue(color) );
AlertIf( Buy, "SOUND C:\\Program Files\\AmiBroker\ \RekamSuara\ \Beli.wav", "Audio alert", 2 );
AlertIf( Sell, "SOUND C:\\Program Files\\AmiBroker\ \RekamSuara\ \Jual.wav", "Audio alert", 2 );

SetChartOptions( 0,chartShowArrows|chartShowDates );

Title = 
EncodeColor( colorGrey50) +
Name()+ "   "+Date()+
"   O " + "= "+O+
"   H "+"= "+H+
"   L "+"= "+L+
"   C "+"= "+C+
"   Change "+"= "+ WriteVal(ROC( C,1),1.2) + "  %  "+

EncodeColor( colorBlue) +" ~  spekulative buy jika tembus   " +WriteVal(Ref( Upfractal, 2),1.0)+
EncodeColor( colorRed) +"  ~  cutloss jika tembus  " +WriteVal(Ref( Downfractal, 3),1.0);

_SECTION_END( );


_SECTION_BEGIN("Exploration");
//Filter = (Buy OR Sell) AND V > 0; /*AND (C>=PriceFrom AND C<=PriceTo) AND V>0; */

Filter = (Buy  OR Sell) AND V > 5000;
AddTextColumn( WriteIf(Buy,"Buy", WriteIf(Sell, "Sell", "")), "Trade", 1.0);
AddColumn( UpFractal, "resistance");
AddColumn( DownFractal, "suport");
AddColumn( C, " Close");

_SECTION_END( );

_SECTION_BEGIN("Background Name");
GfxSetOverlayMode( 1);
GfxSelectFont("Tahoma", Status("pxheight")/40 );
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ParamColor( "Warna", colorLightGrey ) );
GfxSetBkMode( 0); // transparent
GfxTextOut( "Mirip Yang Mahal", Status("pxwidth")/8, Status("pxheight")/10 );
GfxTextOut( "Dibuat Lucu oleh Timur Langit", Status("pxwidth")/5.7, Status("pxheight")/6 );
GfxTextOut( "Ide Lucu nya dari SofiaLiaw", Status("pxwidth")/6, Status("pxheight")/4.2 );

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( );