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?
intrabarpersist what bar timeframe if multiple data?
-
- Posts: 186
- Joined: 10 May 2012
- Has thanked: 14 times
- Been thanked: 11 times
- 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?
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.
Intrabarpersist never resets itself during the script calculation.
Signal is always applied to data1, data1 is the main trigger for signal re/calculation.
-
- Posts: 186
- Joined: 10 May 2012
- Has thanked: 14 times
- Been thanked: 11 times
Re: intrabarpersist what bar timeframe if multiple data?
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?
- 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?
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.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?
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.
-
- Posts: 186
- Joined: 10 May 2012
- Has thanked: 14 times
- Been thanked: 11 times
Re: intrabarpersist what bar timeframe if multiple data?
I was under the impression that regular variables are reset every bar open.. is that right?
- 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?
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).
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).
-
- Posts: 186
- Joined: 10 May 2012
- Has thanked: 14 times
- Been thanked: 11 times
Re: intrabarpersist what bar timeframe if multiple data?
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..
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..