// Downloaded From https://www.WiseStockTrader.com
_SECTION_BEGIN("Draw Camarilla Levels");
SetChartOptions(0,chartShowArrows|chartShowDates);
showcamarella=ParamList("Show Camarella Lines","YES|NO");
showcandlechart=ParamList("Show Candle chart","YES|NO");
showwhat=IIf(ParamList("Todays or Tomorrows Levels","Today|Tomorrow")=="Tomorrow",1,-1);

if (showcandlechart=="YES")
{
   Plot( C, "Close", ParamColor("Color", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
}
EMA10=EMA(C,10);
EMA3=EMA(C,3);
Plot(EMA10,"EMA10", colorWhite,styleLine|styleNoLabel);
Plot(EMA3,"EMA3", colorGreen,styleLine|styleNoLabel);

XH = TimeFrameGetPrice( "H", inDaily,showwhat);
XL = TimeFrameGetPrice( "L", inDaily,showwhat);
XC = TimeFrameGetPrice( "C", inDaily, showwhat );



r2=(((xh-xl)*1.1)/2)+xc;
r1=(((xh-xl)*1.1)/4)+xc;
s1=(xc-((xh-xl)*1.1)/4);
s2=(xc-((xh-xl)*1.1)/2);
n3=1;
tgt1=(1+.005*n3)*r2;
tgt2=(1+.01*n3)*r2;
tgt3=s2/(1+.005*n3);
tgt4=s2/(1+.01*n3);


if (showcamarella=="YES")
{
Plot(r1,"R1",colorGreen,styleLine|styleDashed|styleNoTitle);
Plot(r2,"R2",colorGreen,styleLine|styleDashed|styleNoTitle);
Plot(s1,"S1",colorRed,styleLine|styleDashed|styleNoTitle);
Plot(s2,"S2",colorRed,styleLine|styleDashed|styleNoTitle);
Plot(tgt1,"tgt1",colorYellow,styleLine|styleDashed|styleNoTitle);
Plot(tgt2,"tgt2",colorYellow,styleLine|styleDashed|styleNoTitle);
Plot(tgt3,"tgt3",colorYellow,styleLine|styleDashed|styleNoTitle);
Plot(tgt4,"tgt4",colorYellow,styleLine|styleDashed|styleNoTitle);
Plot(s1+(0.85*(r1-s1)),"int long target 2",colorBlue,styleLine|styleDashed|styleNoTitle);
Plot(s1+(0.65*(r1-s1)),"int long target 1",colorBlue,styleLine|styleDashed|styleNoTitle);
Plot(s1+(0.35*(r1-s1)),"int short target 1",colorPink,styleLine|styleDashed|styleNoTitle);
Plot(s1+(0.15*(r1-s1)),"int short target 2",colorPink,styleLine|styleDashed|styleNoTitle);
Buy=Cross(C,s1) OR Cross(C,r1) OR Cross(C,r2);
Sell=Cross(r1,C) OR Cross(s1,C) OR Cross(s2,C);
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorLime, colorRed ), 0, IIf( Buy, Low, High));