Barstatus[1] =2 when IOG = true

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1276
Joined: 23 Nov 2010
Has thanked: 722 times
Been thanked: 222 times

Barstatus[1] =2 when IOG = true

Hello

I want to test some data when last bar as ended.
To do so, I use

Code: Select all

`If barStatus[1] = 2 then begin...`

Problem is I got IOG = True. Then my tested bar is done on every tick.

How do I test for ended bar (BarStatus[1] = 2 ) when IOG = True

Hope I'm clear enough

Martin

TJ
Posts: 6834
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 979 times
Been thanked: 1968 times

Re: Barstatus[1] =2 when IOG = true

arjfca wrote:Hello

I want to test some data when last bar as ended.
To do so, I use

Code: Select all

`If barStatus[1] = 2 then begin...`

Problem is I got IOG = True. Then my tested bar is done on every tick.

How do I test for ended bar (BarStatus[1] = 2 ) when IOG = True

Hope I'm clear enough

Martin

you cannot use [1] on BarStatus.

theoretically BarStatus[1] is always = 2.
These users thanked the author TJ for the post:
arjfca

arjfca
Posts: 1276
Joined: 23 Nov 2010
Has thanked: 722 times
Been thanked: 222 times

Re: Barstatus[1] =2 when IOG = true

TJ,

As copied from the documentation
Usage
BarStatus(DataNum)
Where: DataNum - a numerical expression specifying the data number of the series
If DataNum is not specified, a value for the current data series will be returned.
Example
BarStatus(1) will return a value of 2 if the current tick in the data series with the data number 1 is
the closing tick of a bar

As I understand, when BarStatus[1] = 2 = the closing tick. It should be ok to be use to act upon the end of the previous bar. If not, how do you suggest to code it

Martin

arjfca
Posts: 1276
Joined: 23 Nov 2010
Has thanked: 722 times
Been thanked: 222 times

Re: Barstatus[1] =2 when IOG = true

TJ,

As copied from the documentation
Usage
BarStatus(DataNum)
Where: DataNum - a numerical expression specifying the data number of the series
If DataNum is not specified, a value for the current data series will be returned.
Example
BarStatus(1) will return a value of 2 if the current tick in the data series with the data number 1 is
the closing tick of a bar

As I understand, when BarStatus[1] = 2 = the closing tick. It should be ok to be use to act upon the end of the previous bar. If not, how do you suggest to code it

Martin

TJ
Posts: 6834
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 979 times
Been thanked: 1968 times

Re: Barstatus[1] =2 when IOG = true

note different brackets.
These users thanked the author TJ for the post (total 2):
arjfcakiasom