// Downloaded From https://www.WiseStockTrader.com
_SECTION_BEGIN("camarilla levels");
//---- pivot points
DayH = TimeFrameGetPrice("H", inHourly, -1);		// yesterdays high
DayL = TimeFrameGetPrice("L", inHourly, -1);		//				low
DayC = TimeFrameGetPrice("C", inHourly, -1);		//				close
DayO = TimeFrameGetPrice("O", inHourly,-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, "",colorOrange,styleStaircase);
Plot(S1, "",colorYellow,styleStaircase);


//----
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();
_SECTION_BEGIN("");

P1 = Param( "MA01 Period", 5, 2, 200 );
P2 = Param( "MA02 Period", 10, 2, 200 );

MA01=MA(C,P1 );
MA02=MA(C,P2 );

RG=IIf(MA01>MA02,MA01-MA02,-(MA02-MA01));

PlotOHLC( MA02,RG+MA02,MA02,RG+MA02,"",23, styleCandle+4096); 
Plot( SelectedValue(C), "",IIf(SelectedValue(MA01)>SelectedValue(MA02),4,34),styleNoLine);


Title = EncodeColor(44)+Name() +"    ( "+Interval(2)+" )    "+EncodeColor(41 )+WriteVal( DateTime(), formatDateTime);

_SECTION_END();

_SECTION_BEGIN("MACD Exploration"); 
r1 = Param( "Fast avg", 12, 2, 200, 1 ); 
r2 = Param( "Slow avg", 26, 2, 200, 1 ); 
r3 = Param( "Signal avg", 9, 2, 200, 1 ); 
Z=Param("zig",1,0,10,0.1); 
  
  
Cond1 = Cross(MACD(r1,r2),Signal(r1,r2,r3)); 
  
Cond3 = Zig(C,z)>Ref(Zig(C,z),-4); 
Buy = Cond1 AND Cond3; 
  
Cond4 = Cross(Signal(r1,r2,r3),MACD(r1,r2)); 
  
Cond6 = Zig(C,z)<Ref(Zig(C,z),-4); 
Sell = Cond4 AND Cond6; 
Trigger = WriteIf(Buy, "Buy", "") + WriteIf(Sell, "Sell", ""); 
  
_N(Title = StrFormat("{{NAME}} {{DATE}} {{INTERVAL}}: O=%1.2f, H=%1.2f, L=%1.2f, C=%1.2f, V=%1.0f\n{{VALUES}}", O, H, L, C, V)); 
  
BG = IIf(Buy, colorPaleGreen, IIf(Sell, colorRose, colorDefault)); 
FG = IIf(Buy, colorDarkGreen, IIf(Sell, colorDarkRed, colorDefault)); 
  
if(Status("action") == actionIndicator) 
{ 
 
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorAqua, 0, L, Offset=-15); 
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorPaleGreen, 0,L, Offset=-25); 
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorDarkGreen, 0,L, Offset=-20); 
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRose, 0, H, Offset=15); 
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorPink, 0,H, Offset=25); 
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorRed, 0,H, Offset=-20); 
  
} 
  
if(Status("action") == actionExplore) 
  
Filter = Buy OR Sell; 
SetOption("NoDefaultColumns", True); 
  
AddTextColumn(Name(), "Symbol", 77, FG, BG, 120); 
AddColumn(DateTime(), "Date", formatDateTime, FG, BG, 100); 
AddColumn(TimeNum() ,"Time",1); 
AddColumn( C, "Close", 1.3 ); 
AddColumn( H, "High", 1.3 ); 
AddColumn(V, "Volume"); 
AddColumn(Ref(V,-1),"P-Vol"); 
AddColumn(V/Ref(V,-1)*100,"Increase in Vol"); 
AddColumn( Buy, "Buy", 1 ); 
AddColumn( Sell, "Sell", 1 ); 
  
shape = Buy * shapeHollowUpTriangle + Sell * shapeHollowDownTriangle; 
  

  
PlotShapes( shape, IIf( Buy, colorBlue, colorBlue ), 0, IIf( Buy, Low, High ) ); 
  
GraphXSpace = 7; 
  
shape = Buy * shapeUpTriangle + Sell * shapeHollowDownTriangle; 
  
  
PlotShapes( shape, IIf( Buy, colorBlue, colorBlue ), 0, IIf( Buy, Low, High ) ); 
  
GraphXSpace = 7; 
_SECTION_END(); 

_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, "",colorRed,styleStaircase);


//----
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();
_SECTION_BEGIN("");

P1 = Param( "MA01 Period", 5, 2, 200 );
P2 = Param( "MA02 Period", 10, 2, 200 );

MA01=MA(C,P1 );
MA02=MA(C,P2 );

RG=IIf(MA01>MA02,MA01-MA02,-(MA02-MA01));

PlotOHLC( MA02,RG+MA02,MA02,RG+MA02,"",23, styleCandle+4096); 
Plot( SelectedValue(C), "",IIf(SelectedValue(MA01)>SelectedValue(MA02),4,34),styleNoLine);


Title = EncodeColor(44)+Name() +"    ( "+Interval(2)+" )    "+EncodeColor(41 )+WriteVal( DateTime(), formatDateTime);

_SECTION_END();

_SECTION_BEGIN("ema");
Lk = EMA(Close,22);

GfxSelectFont("Georgia", Status("pxheight")/76);
GfxSetTextAlign( 6 );
GfxSetTextColor(colorGold);
GfxSetBkMode(0);
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/10 );

cx=Param("cxposn",885,0,500,1);
cy=Param("cyposn",16,0,500,1);
GfxSetBkColor(ColorRGB(200,50,100));
GfxSelectFont( "tohomabold",24,50, False);
GfxSetTextColor( colorYellow);
GfxSetTextColor( ColorHSB( 100, 10, 400) );
GfxTextOut("LTP. "+C+" ", cx, cy );

_SECTION_END();



;