Barstatus[1] =2 when IOG = true

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Barstatus[1] =2 when IOG = true

Postby arjfca » 29 Aug 2011

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

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

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

Postby TJ » 29 Aug 2011

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.

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

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

Postby arjfca » 29 Aug 2011

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: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

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

Postby arjfca » 29 Aug 2011

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

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

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

Postby TJ » 29 Aug 2011

note different brackets.


Return to “MultiCharts”