intrabarpersist what bar timeframe if multiple data?

Questions about MultiCharts and user contributed studies.
KhaosTrader
Posts: 186
Joined: 10 May 2012
Has thanked: 14 times
Been thanked: 11 times

intrabarpersist what bar timeframe if multiple data?

Postby KhaosTrader » 04 Oct 2012

Hi,

if I have a variable declared variable: intrabarpersist MaxVal(10)

If I have two instruments with different times:

data1 is 5 minute AAPL
data2 is a 60 minute AAPL

Will intrabarpersist get reset at the 5 minute or the 1 hour? Can I control when it gets reset?

or does intrabarpersist never reset itself? is it like a static variable that keeps the value it holds between bars throughout the chart?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: intrabarpersist what bar timeframe if multiple data?

Postby Henry MultiСharts » 04 Oct 2012

Hello KhaosTrader,

Intrabarpersist never resets itself during the script calculation.
Signal is always applied to data1, data1 is the main trigger for signal re/calculation.

KhaosTrader
Posts: 186
Joined: 10 May 2012
Has thanked: 14 times
Been thanked: 11 times

Re: intrabarpersist what bar timeframe if multiple data?

Postby KhaosTrader » 04 Oct 2012

Ok so a variable that is declaired intrabarpersist will keep its value throughout the whole script calculation that means if i set a variable with intrabarpersist to "20" at the script open, it will hold that value 1000 bars in the future if the script has been running unless i change the value with code?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: intrabarpersist what bar timeframe if multiple data?

Postby Henry MultiСharts » 04 Oct 2012

Ok so a variable that is declaired intrabarpersist will keep its value throughout the whole script calculation that means if i set a variable with intrabarpersist to "20" at the script open, it will hold that value 1000 bars in the future if the script has been running unless i change the value with code?
Every "regular" variable will keep its value throughout the whole script calculation on all data series (if the value was assigned on the bar's close) until you assign a different value to it.

The difference between regular variable and IntraBarPersist variable is that regular variable's value is fixed on bar close and IntraBarPersist variable's value is fixed even inside bar.

KhaosTrader
Posts: 186
Joined: 10 May 2012
Has thanked: 14 times
Been thanked: 11 times

Re: intrabarpersist what bar timeframe if multiple data?

Postby KhaosTrader » 04 Oct 2012

I was under the impression that regular variables are reset every bar open.. is that right?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: intrabarpersist what bar timeframe if multiple data?

Postby Henry MultiСharts » 05 Oct 2012

Hello KhaosTrader,

Sorry, my reply was not clear enough.
Every "regular" variable will keep its value throughout the whole script calculation on all data series (if the value was assigned on the bar's close) until you assign a different value to it.

For example:
If you assign a value for regular variable inside bar (barstatus=1) - the variable value will not be kept on bar open/close (barstatus=0 and 2).
If you do the same with intrabarpersist variable-the value will be kept on all barstatus values (0,1,2).

KhaosTrader
Posts: 186
Joined: 10 May 2012
Has thanked: 14 times
Been thanked: 11 times

Re: intrabarpersist what bar timeframe if multiple data?

Postby KhaosTrader » 05 Oct 2012

ok lets clear it up more

i am reading a conflict, u say regular variable maintains value whole data series then u say value wont be kept after bar close...

can u give an example of a regular variable then an intrabarpersist variable, and how the intrabarpersist variable will maintain a value in what context that a regular variable wont... plz..


Return to “MultiCharts”