TimeRange = ParamToggle("Time","No|Yes");
Starttime = Param("Starttime",100500,100500,235500,0);
Closetime = Param("Closetime",235500,100500,235500,0);
ExitToday = (Ref(DateNum(),1) > DateNum());
_SECTION_BEGIN("Buy Sell");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = EncodeColor(colorRed)+ "www.bstarplus.com " + 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() );
tO = TimeFrameGetPrice("O", inDaily);
BA=ceil((tO*.236/100)+tO);
DayO = TimeFrameGetPrice("O", inDaily);
SB=ceil(tO-(tO*.236/100));
DayO = TimeFrameGetPrice("O", inDaily);
BT1=ceil((tO*.455/100)+tO);
DayO = TimeFrameGetPrice("O", inDaily);
ST1=ceil(tO-(tO*.455/100));
DayO = TimeFrameGetPrice("O", inDaily);
BT2=ceil((tO*.786/100)+tO);
DayO = TimeFrameGetPrice("O", inDaily);
ST2=ceil(tO-(tO*.786/100));
DayO = TimeFrameGetPrice("O", inDaily);
BT3=ceil((tO*1/100)+tO);
DayO = TimeFrameGetPrice("O", inDaily);
ST3=ceil(tO-(tO*1/100));
DayO = TimeFrameGetPrice("O", inDaily);
BB=ceil(BA+3);
DayO = TimeFrameGetPrice("O", inDaily);
SS=ceil(SB-3);
DayO = TimeFrameGetPrice("O", inDaily);
Plot(BA, "BUY ABOVE",colorGreen,styleLine);
Plot(SB, "SELL BELOW",colorRed,styleLine);
Plot(to, "Daily open",colorBlack,styleDots+styleNoLine);
Plot(BB, "BB",colorYellow,styleLine);
Plot(SS, "SS",colorYellow,styleLine);
Plot(BT1, "BUY TARGET1",colorBlue,styleLine+styleNoTitle);
Plot(ST1, "SELL TARGET1",colorDarkRed,styleLine|styleNoTitle);
Plot(BT2, "BUY TARGET2",colorBlue,styleLine|styleNoTitle);
Plot(ST2, "SELL TARGET2",colorDarkRed,styleLine|styleNoTitle);
Plot(BT3, "BUY TARGET3",colorBlue,styleLine|styleNoTitle);
Plot(ST3, "SELL TARGET3",colorDarkRed,styleLine|styleNoTitle);
Plot(BB, "BB",colorYellow,styleNoLine);
//Buy=C>BA;
//Sell=C<SB;
//Buy = ExRem( Buy, Sell );
//Sell = ExRem( Sell, Buy );
B1 =C>BA;
S1 = C<SB;
Sh1 = C<SB;
Co1 = C>BA;
Buy = IIf(TimeRange==False,B1,B1 AND TimeNum() > Starttime AND TimeNum() < Closetime);
Sell = IIf(TimeRange==False,S1,S1 OR TimeNum() > Closetime OR ExitToday);
Short = IIf(Timerange==False,Sh1,Sh1 AND TimeNum() > Starttime AND TimeNum() < Closetime);
Cover = IIf(Timerange==False,Co1,Co1 OR TimeNum() > Closetime OR ExitToday);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
//PlotShapes(IIf(Buy==1, shapeUpArrow , shapeNone), colorGreen, 0,Low, Offset=-20);
//PlotShapes(IIf(Sell==1, shapeStar, shapeNone), colorRed, 0,High, Offset=30);
//PlotShapes(IIf(Short==1, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-20);
//PlotShapes(IIf(Cover==1, shapeStar, shapeNone), colorGreen, 0,Low, Offset=-30);
//PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Cover, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
//shape =Buy * shapeUpArrow +Sell * shapeDownArrow;
//PlotShapes( shape, IIf(Buy, colorLime, colorRed ), 0, IIf(Buy, Low, High));
Filter=Buy OR Sell;
AddColumn(Close,"CMP ",1.2);
AddColumn(Buy,"Buy",1.0);
AddColumn(Sell,"Sell",1.0);
_SECTION_END();
TimeRange = ParamToggle("Time","No|Yes");
Starttime = Param("Starttime",100500,100500,235500,0);
Closetime = Param("Closetime",235500,100500,235500,0);
ExitToday = (Ref(DateNum(),1) > DateNum());
_SECTION_BEGIN("Buy Sell");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = EncodeColor(colorRed)+ "www.bstarplus.com " + 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() );
tO = TimeFrameGetPrice("O", inDaily);
BA=ceil((tO*.236/100)+tO);
DayO = TimeFrameGetPrice("O", inDaily);
SB=ceil(tO-(tO*.236/100));
DayO = TimeFrameGetPrice("O", inDaily);
BT1=ceil((tO*.455/100)+tO);
DayO = TimeFrameGetPrice("O", inDaily);
ST1=ceil(tO-(tO*.455/100));
DayO = TimeFrameGetPrice("O", inDaily);
BT2=ceil((tO*.786/100)+tO);
DayO = TimeFrameGetPrice("O", inDaily);
ST2=ceil(tO-(tO*.786/100));
DayO = TimeFrameGetPrice("O", inDaily);
BT3=ceil((tO*1/100)+tO);
DayO = TimeFrameGetPrice("O", inDaily);
ST3=ceil(tO-(tO*1/100));
DayO = TimeFrameGetPrice("O", inDaily);
BB=ceil(BA+3);
DayO = TimeFrameGetPrice("O", inDaily);
SS=ceil(SB-3);
DayO = TimeFrameGetPrice("O", inDaily);
Plot(BA, "BUY ABOVE",colorGreen,styleLine);
Plot(SB, "SELL BELOW",colorRed,styleLine);
Plot(to, "Daily open",colorBlack,styleDots+styleNoLine);
Plot(BB, "BB",colorYellow,styleLine);
Plot(SS, "SS",colorYellow,styleLine);
Plot(BT1, "BUY TARGET1",colorBlue,styleLine+styleNoTitle);
Plot(ST1, "SELL TARGET1",colorDarkRed,styleLine|styleNoTitle);
Plot(BT2, "BUY TARGET2",colorBlue,styleLine|styleNoTitle);
Plot(ST2, "SELL TARGET2",colorDarkRed,styleLine|styleNoTitle);
Plot(BT3, "BUY TARGET3",colorBlue,styleLine|styleNoTitle);
Plot(ST3, "SELL TARGET3",colorDarkRed,styleLine|styleNoTitle);
Plot(BB, "BB",colorYellow,styleNoLine);
//Buy=C>BA;
//Sell=C<SB;
//Buy = ExRem( Buy, Sell );
//Sell = ExRem( Sell, Buy );
B1 =C>BA;
S1 = C<SB;
Sh1 = C<SB;
Co1 = C>BA;
Buy = IIf(TimeRange==False,B1,B1 AND TimeNum() > Starttime AND TimeNum() < Closetime);
Sell = IIf(TimeRange==False,S1,S1 OR TimeNum() > Closetime OR ExitToday);
Short = IIf(Timerange==False,Sh1,Sh1 AND TimeNum() > Starttime AND TimeNum() < Closetime);
Cover = IIf(Timerange==False,Co1,Co1 OR TimeNum() > Closetime OR ExitToday);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
//PlotShapes(IIf(Buy==1, shapeUpArrow , shapeNone), colorGreen, 0,Low, Offset=-20);
//PlotShapes(IIf(Sell==1, shapeStar, shapeNone), colorRed, 0,High, Offset=30);
//PlotShapes(IIf(Short==1, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-20);
//PlotShapes(IIf(Cover==1, shapeStar, shapeNone), colorGreen, 0,Low, Offset=-30);
//PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Cover, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
//shape =Buy * shapeUpArrow +Sell * shapeDownArrow;
//PlotShapes( shape, IIf(Buy, colorLime, colorRed ), 0, IIf(Buy, Low, High));
Filter=Buy OR Sell;
AddColumn(Close,"CMP ",1.2);
AddColumn(Buy,"Buy",1.0);
AddColumn(Sell,"Sell",1.0);
_SECTION_END();