_SECTION_BEGIN("Buy Sell Level Plots");
//===================Change below conditions to match yours ======================
Buy = Cross(EMA(C,5), C);
Short = Cross(C, EMA(C,5));
//================= Change the above conditions to match yours ================
Buy = ExRem(Buy,Short);
Short = ExRem(Short,Buy);
PlotShapes(Buy*shapeUpArrow,colorGreen,0,L,-25);
PlotShapes(Short*shapedownarrow,colorred,0,H,-25);
SLLimit = Param("SL Abs Points",35,1,100,1);
TP1 = Param("TGT1 Range %",1,0.5,5,0.25);//min is 0.5% and max is 5% with increaments of 0.25%
TP2 = Param("TGT2 Range %",1.5,0.5,5,0.25);//min is 0.5% and max is 5% with increaments of 0.25%
TP3 = Param("TGT3 Range %",2,0.5,5,0.25);//min is 0.5% and max is 5% with increaments of 0.25%
TP4 = Param("TGT4 Range %",2.5,0.5,5,0.25);//min is 0.5% and max is 5% with increaments of 0.25%
TP5 = Param("TGT5 Range %",3,0.5,5,0.25);//min is 0.5% and max is 5% with increaments of 0.25%
ShowBuySell = ParamToggle("Show Buy Sell Levels","Yes|No",1);
entry=0;
sig = Null;
sl = Null;
tar1 = 0;
tar2 = 0;
tar3 = 0;
tar4 = 0;
tar5 = 0;
bars = Null;
Clr = Null;
for(i=BarCount-1;i>1;i--)
{if((Buy[i] == 1) )
{
entry = C[i];
sig = "BUY";
BuyPrice = ValueWhen(entry, C[i]);
BuyPrice = ceil(BuyPrice*20)/20;
sl = BuyPrice-SLlimit;
sl = floor(sl*20)/20;
tar1 = BuyPrice+((entry*TP1)/100);
tar1 = floor(tar1*20)/20;
tar2 = BuyPrice+((entry*TP2)/100);
tar2 = floor(tar2*20)/20;
tar3 = BuyPrice+((entry*TP3)/100);
tar3 = floor(tar3*20)/20;
tar4 = BuyPrice+((entry*TP4)/100);
tar4 = floor(tar4*20)/20;
tar5 = BuyPrice+((entry*TP5)/100);
tar5 = floor(tar5*20)/20;
Clr = colorLime;
TxtClr = colorBlue;
Tgt1Clr = colorLightBlue;
Tgt2Clr = colorGreen;
Tgt3Clr = colorAqua;
Tgt4Clr = colorTurquoise;
Tgt5Clr = colorbluegrey;
bars = i;
i = 0;
}
if((Short[i] == 1))
{
sig = "SELL";
entry = C[i];
SellPrice = ValueWhen(entry, C[i]);
SellPrice = floor(SellPrice*20)/20;
sl = SellPrice+sllimit;
sl = ceil(sl*20)/20;
tar1 = SellPrice-((entry*TP1)/100);
tar1 = ceil(tar1*20)/20;
tar2 = SellPrice-((entry*TP2)/100);
tar2 = ceil(tar2*20)/20;
tar3 = SellPrice-((entry*TP3)/100);
tar3 = ceil(tar3*20)/20;
tar4 = SellPrice-((entry*TP4)/100);
tar4 = ceil(tar4*20)/20;
tar5 = SellPrice-((entry*TP5)/100);
tar5 = ceil(tar5*20)/20;
Clr = colorRed;
TxtClr = colorOrange;
Tgt1Clr = colorViolet;
Tgt2Clr = colorRed;
Tgt3Clr = colorplum;
Tgt4Clr = colorgrey40;
Tgt5Clr = colorcustom12;
bars = i;
i = 0;
}}
Offset = 5;
ssl = IIf(bars == BarCount-1, sl[BarCount-1], Ref(sl, -1));
sl = ssl[BarCount-1];
tar1=tar1[BarCount-1];
tar2=tar2[BarCount-1];
tar3=tar3[BarCount-1];
tar4=tar4[BarCount-1];
tar5=tar5[BarCount-1];
if(ShowBuySell)
{
Plot(LineArray(bars-Offset, entry, BarCount, entry,1), "Entry", Clr, styledashed|styleNoTitle|stylenolabel, Null, Null, Offset);
Plot(LineArray(bars-Offset, sl, BarCount, sl,1), "S/L", Clr, styledashed|styleNoTitle|stylenolabel, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "Trgt1", Clr, styledashed|styleNoTitle|stylenolabel, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "Trgt2", Clr, styledashed|styleNoTitle|stylenolabel, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "Trgt3", Clr, styledashed|styleNoTitle|stylenolabel, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar4, BarCount, tar4,1), "Trgt4", Clr, styledashed|styleNoTitle|stylenolabel, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar5, BarCount, tar5,1), "Trgt2", Clr, styledashed|styleNoTitle|stylenolabel, Null, Null, Offset);
for (i=bars; i <BarCount;i++)
{
PlotText(""+sig+"@"+Writeval(entry,1.2), BarCount+2,entry,Null,TxtClr);
PlotText("SL@"+WriteVal(sl,1.2), BarCount+2,sl,Null,ColorDarkYellow);
PlotText("T1@"+WriteVal(tar1,1.2), BarCount+2,tar1,Null,Tgt1Clr);
PlotText("T2@"+WriteVal(tar2,1.2), BarCount+2,tar2,Null,Tgt2Clr);
PlotText("T3@"+WriteVal(tar3,1.2), BarCount+2,tar3,Null,Tgt3Clr);
PlotText("T4@"+WriteVal(tar4,1.2), BarCount+2,tar4,Null,Tgt4Clr);
PlotText("T5@"+WriteVal(tar5,1.2), BarCount+2,tar5,Null,Tgt5Clr);
}
}
_SECTION_END();