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

Re: EL Question on Print statement



PureBytes Links

Trading Reference Links

Thanks, Bob!  That's what was causing it.  I didn't realize that LastBarOnChart was reading time
rather than the selected tick compression.  I appreciate the help!

=============
Dave Nadeau
Fort Collins, CO

--- Bob Fulks <bfulks@xxxxxxxxxxxx> wrote:
> Looks as if you are using this on a tick-based chart and you have
> several ticks with the same time in minutes. The LastBarOnChart
> function is pretty stupid and just looks for the time of the last
> bar. If you have several bars with the same time stamp, it is true
> for all those bars.
> 
> You can use the following code to only print on the first such bar:
> 
>     Vars: LBInit(TRUE);
> 
>     if LastBarOnChart and LBInit then begin
>        <print statement>
>        LBInit = FALSE;
>     end;
> 
> This works OK if the values you are printing do not change on the
> other bars with the same time stamp.
> 
> If you REALLY need to do something only on the real last bar, I have
> never found a way to do that.  Maybe someone else has.
> 
> Also note that the LastBarOnChart function does not seem to work if
> you refer to the open on the next bar anywhere in your code. It seems
> to be waiting for the bar after the last bar on the chart - really
> clever...
> 
> Bob Fulks
>