// Downloaded From https://www.WiseStockTrader.com
SetPositionSize( 2000, spsShares ); // 2000 shares by default 
_SECTION_BEGIN("camarilla levels");
//---- pivot points
DayH = TimeFrameGetPrice("H", inDaily, -1);		// yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1);		//				low
DayC = TimeFrameGetPrice("C", inDaily, -1);		//				close
DayO = TimeFrameGetPrice("O", inDaily,-1);			// current day open
// camarilla pivots
if ( True )
{
A =  Optimize("X",Param("A",0.17,0.1,1,0.01),0.1,1,0.01);

R = DayH - DayL;	  // range
PP = (DayH + DayL +DayC+DayO)/4;
R1 = PP + (R * A);
S1 = PP - (R * A);
BT=R1+4*(R1-PP);
ST=S1-4*(PP-S1);
}

Plot(R1, "",colorGreen,styleStaircase);
Plot(S1, "",colorGreen,styleStaircase);
Plot(PP, "",colorBlue,styleDots+styleNoLine);
Plot(BT, "",colorBlue,styleDots+styleNoLine);
Plot(ST, "",colorBlue,styleDots+styleNoLine);



//----
Title = Name()+" SIMPLE PIVOT & FIBO"+Date()+ EncodeColor(colorRed)+"  Long Breakout above  "+WriteVal(R1,1.2)+"\n"+EncodeColor(colorRed)+"  Short breakout below  "+WriteVal(S1,1.2) 

;


Filter=1;
AddColumn(C,"cmp",1.2);
AddColumn(R1,"R4",1.2);
AddColumn(S1,"S4",1.2);
AddColumn(PP,"UP",1.2);
_SECTION_END();




Buy=Cover=Cross (C, R1);
Sell=Short= Cross (S1 ,C);

// plot arrows

shape = Buy * shapeUpArrow + Short * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );



SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );