_SECTION_BEGIN("!!!MY_S&R");
//PREPARED BY YASU222//
dojidiv =5;
CloseEqualOpen = ( High - Low ) / dojidiv > abs( Open - Close );
RefC = Ref( C, -1 );
RefO = Ref( O, -1 );
Up = C > O;
Down = C < O ;
UpDoji = CloseEqualOpen AND RefC > RefO;
DownDoji = CloseEqualOpen AND RefC < RefO;
colcond = IIf( up || updoji, colorBrightGreen, colorRed );
SetBarFillColor( colcond );
Plot( C, "Price", colcond, styleCandle );
A = Param("Average Periods",5,1,10,1);
N = Param("Short Periods",15,1,500,1);
Average = (Low+High+(2*Close))/4;
OP = EMA(Average,A);
B1 = HHV(OP,N);
S1 = LLV(OP,N);
avd=IIf(C>Ref(B1,-1),1,IIf(C<Ref(S1,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,S1,B1);
// line code
Plot(tsl, _DEFAULT_NAME(), colorTan, styleStaircase);
Buy1 = Cross(L,TSL) ;
Sell1 = Cross(TSL,H);
Buy = ExRem(Buy1,Sell1);
Sell = ExRem(Sell1,Buy1);
Short=Sell;
Cover=Buy;
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
AlertIf( Buy, "SOUND C:\\Windows\\Media\\Ding.chimes", "Audio alert", 2 );
AlertIf( Sell, "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2 );
_SECTION_END();