How to detect the first tick of a new bar?

Questions about MultiCharts and user contributed studies.
cael
Posts: 89
Joined: 06 Sep 2006
Has thanked: 2 times

How to detect the first tick of a new bar?

Postby cael » 07 Sep 2006

I wrote an indicator that needs to know the first tick of a new bar. How do I do that?

The question aside, I actually tried a very simple

if (H=L) then { first tick of new bar }

but was surprized to find that this does not trigger when the market is ticking fast! (Of course if I could get the print function to work I might be more sure :)

Chris
Posts: 150
Joined: 17 Nov 2005

Postby Chris » 08 Sep 2006

cael,

you can use the reserved word Barstatus for your purpose.

Barstatus returns 0 for the first tick, 1 for a normal-tick, and 2 for bar-close.

Code: Select all

If BarStatus = 0 then { first tick of new bar }


This should do it.

Chris


Return to “MultiCharts”