[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting double plotting on last bar of monthly summary



PureBytes Links

Trading Reference Links

The following indicator program is run on a chart that has been
summarized by month. (I have produced this on the monthly summary
graph of $INDU but that doesn't seem to matter)  As you can see it
should only be called once, on the final month's bar, and it should plot
its values one bar beyond the final bar.

{--------------------------program start----------------------------}
Var: ThisMonth(0), ThisDate(0), ThisDay(0);

{Put a value on a monthly bar one beyond the last month}
if @Year(Date) = @Year(CurrentDate) and @Month(Date) = @Month(CurrentDate) then
Begin
	ThisMonth = @Month(Date);
	ThisDate  = @DayOfMonth(Date);
	ThisDay	  = @DayOfWeek(Date);
	print(file("d:\documents\bars.dbg"),
            "Date",ThisMonth,"/",ThisDate," of year",@Year(Date));
	
	Plot1[-1]( H, "AHigh" ) ;
End;
{--------------------------program end------------------------------}


This results in TWO values being plotted, one on the last monthly bar
and one (the correct one) one beyond the last month.

The print statement produces the following two lines:

Date      2.00/     28.00 of year    102.00
Date      2.00/     28.00 of year    102.00

This output shows that the indicator code is being called twice for the
final bar.  Actually I could live with this except for the two values
being plotted on different monthly bars when only one value should be
plotted.

Does anyone know why this is happening, and more importantly, how to
stop it?  Thanks in advance.