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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_BEGIN("HI LO");
//Previous Days HI LO //
DayH = TimeFrameGetPrice("H", inDaily, -1); DayHI = LastValue (DayH,1);// yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1); DayLI = LastValue (DayL,1); // yesterdays low
DayC = TimeFrameGetPrice("C", inDaily, -1); // yesterdays close
DayO = TimeFrameGetPrice("O", inDaily); // current day open
numbars = LastValue(Cum(Status("barvisible")));
hts = -33.5;
YHL = ParamToggle("Yesterday HI LO","Show|Hide",0);
if(YHL==1) {
Plot(DayL,"YL",colorRed,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH,"YH",colorGreen,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
// PlotText("-" , LastValue(BarIndex()-1), DayHI, colorTurquoise);
PlotText(" YH " , LastValue(BarIndex())-(numbars/Hts), DayHI, colorBlue);
PlotText(" YL " , LastValue(BarIndex())-(numbars/Hts), DayLI, colorRed);
}
_SECTION_BEGIN("BUY SELL");
TimeRange = ParamToggle("Time","NO|YES");
Starttime = Param("Starttime",091500,090000,235500,0);
Closetime = Param("Closetime",150500,153000,235500,0);
ExitToday = (Ref(DateNum(),1) > DateNum());
//-----AD COND----///
B1 = C > DayH ; // AND ADX() < 40; //"Buy condition"
S1 = C < DayL ; // AND ADX() < 40; //"Sell condition"
Sh1 = C < DayL ; // "Short Condition"
Co1 = C > DayH ;//"Cover Condition"
Buy = IIf(TimeRange==False,B1,B1 AND TimeNum() > Starttime AND TimeNum() < Closetime);
Sell = IIf(Timerange==False,S1,S1 AND TimeNum() > Starttime AND TimeNum() < Closetime);
se = IIf(TimeRange==False,Sh1,Sh1 OR TimeNum() > Closetime OR ExitToday) ;
be = IIf(Timerange==False,Co1,Co1 OR TimeNum() > Closetime OR ExitToday) ;
Buy=ExRem(Buy,se);
be = ExRem(se,Buy);
Sell=ExRem(Sell,be);
se = ExRem(be,Sell);
PlotShapes(IIf(Buy==1, shapeUpTriangle , shapeNone), colorBlue, 0,Low, Offset=-20);
PlotShapes(IIf(Sell==1, shapeDownTriangle, shapeNone), colorRed, 0,High, Offset=-20);
PlotShapes(IIf(SE==1, shapeDownArrow, shapeNone), colorRed, 0,Low, Offset=-80);
//PlotShapes(IIf(SE==1, shapeSmallCircle, shapeNone), colorGreen, 0,Low, Offset=60);
PlotShapes(IIf(BE==1, shapeUpArrow, shapeNone), colorGreen, 0,High, Offset=-80);
//PlotShapes(IIf(BE==1, shapeSmallCircle, shapeNone), colorBlue, 0,High, Offset=25);
_SECTION_END();
//alert and scan
Filter=Buy OR Sell;
//Filter= Cover OR Short;
AddColumn( Buy, "Buy", 1);
AddColumn(Sell, "Sell", 1);
AddColumn(Close,"Close",1.2);
AddColumn(Volume,"Volume",1.0);
//alerts
AlertIf( Buy, "SOUND C:\\Windows\\Media\\tada.wav", "Buy",1,1+2+4+8);
AlertIf( Sell, "SOUND C:\\Windows\\Media\\notify.wav", "Short",2,1+2+4+8);
AlertIf( Buy, "", "BUY @ " + H, 1 );
AlertIf( Sell, "", "SELL @ " + L, 2 );
_SECTION_END();
_SECTION_BEGIN("Wilders");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( Wilders( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();