AVTParticipant
Senior
Indicator is a PopGun marker. Every timeframe (based minute, hour, day, month, quarter) is calculated and therefore drawn correctly in the chart – except all weekly based data (like weekly, 2 weeks, 3 weeks…).
Code is simple
// Popgun: middle candle totally enclosed by previous and following candle
RangePointTop=Max(high[0],high[2])
RangePointBottom=Min(low[0],low[2])
Popgun=(high[0]>high[1] AND low[0]<low[1] AND high[1]<high[2] AND low[1]>low[2])
IF Popgun THEN
DRAWTEXT("PG", barindex, low-5, Dialog, Standard, 12) COLOURED(0,0,255)
DRAWSEGMENT(barindex-2,RangePointTop,barindex,RangePointTop) COLOURED(0,0,255) // high mark
DRAWSEGMENT(barindex-2,RangePointBottom,barindex,RangePointBottom) COLOURED(0,0,255) // low mark
ENDIF
Return
Incorrect weekly markers attached (I marked the correct lines with red, hope you can see it).
Any ideas what happens here? Thanks a lot.
It would be much easier if you add a vertical grid on the chart.
Your x axis is in Months and squinting my eyes and trying to line up there appears to be 4 or 5 bars in each month? Isn’t that correct? some months contain 4 Fridays and some months contain 5 Fridays?
Or am I misunderstanding your problem?
AVTParticipant
Senior
Thanks GraHal for your answer. I have changed the code for drawing a bit, so it might be easier to see where the problem is. The code should mark the Popgun (which is the outside of an inside) with an arrow and draw range lines for the 3-candle range (1st candle, inside, outside). This is working fine in all timeframes – except weekly. This is PRT 10.3, , IG live and it happens in index, forex, commodities but then again shares are correctly painted.
In the picture the first two columns are all correct, from second up to month (just one quarter but that’s also ok). The third column shows the weekly result and weekbased, like 2 weeks, 3 weeks … As you can see the PG is marked one candle too early and consequently the range too. In the code I added a line to tell the value of the PGs top which is correct in week.
I attach the script, so you can check. I have really no idea what is causing this.