Problem while Plotting Buy sell signal on Real time System

Please help me to resolve this issue.

whenever the code is executed it will plot shape on current candle (Time Frame 5 min).
instead of that it need to plot when candle is completely closed not on running candle

DayChange = Day() != Ref(Day(), -1);
DayChange[0] = True;
HSDayChange = HighestSince(DayChange, H);
LSDayChange = LowestSince(DayChange, L);
HSDayChangePrev = ValueWhen(DayChange, Ref(HSDayChange, -1));
LSDayChangePrev=ValueWhen(DayChange,Ref(LSDayChange,-1));

Buy1 = C> Ref(HighestSince(DayChange ,H), -1);
Buy=C>HSDayChangePrev  AND   C>Ref(HighestSince(DayChange ,H), -1);
Sell=C<LSDayChangePrev AND C <Ref(LowestSince(DayChange ,L), -1);

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-20);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-30);                      
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-25);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=20);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30);                      
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25);
1 Like

Shift your Entry to next Bar.
Buy = Ref(Buy,-1); BuyPrice=ValueWhen(Buy,O);

DayChange = Day() != Ref(Day(), -1);
DayChange[0] = True;
HSDayChange = HighestSince(DayChange, H);
LSDayChange = LowestSince(DayChange, L);
HSDayChangePrev = ValueWhen(DayChange, Ref(HSDayChange, -1));
LSDayChangePrev=ValueWhen(DayChange,Ref(LSDayChange,-1));

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

LastBar = BarIndex() == LastValue(BarIndex());

Buy = Buy and NOT LastBar;
Sell = Sell and NOT LastBar;

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-20);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-30);                      
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-25);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=20);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30);                      
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25);
3 Likes

@codejunkie Thanks finally My problem is resolved

1 Like