IntraBarPersist does not work when using offsets.

Questions about MultiCharts and user contributed studies.
bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

IntraBarPersist does not work when using offsets.

Postby bowlesj3 » 09 Jul 2008

The IntraBarPersist Does not really work the way I had hoped. It seems that if you start using offsets such as Date[Offset] in your code it starts to set variables back to zero at the start of the intraday minute bar even when you have put in this IntraBarPersist reserve word. So in the end the only thing one can trust is to get a variable set by a GV, do the update on the variable then immediately send it out to the GV so that the next time you get it you can trust it to have held its value by once again getting it from the GV. For the IntraBarPersist to truly work it needs to be completely removed from the MaxBarsBack table thinking (a true programming variable just like the GV and just like all the other programming languages I have worked with which do not have a problem doing. I think the original EL programmers go a little carried away with the built in table idea. Oh well. A few days lost. At least there is a solution. In effect the GV solution is pretecting the variable from the EL weakness.

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Can help.

Postby bowlesj3 » 09 Jul 2008

As I work out the revised code it occured to me that the IntraBarPreserve can be used to reduce the number of GV Get commands to one per minute or maybe less depending on this [offset] problem. The GV ensures that at least if EL decides to reset your variable to zero you can get it back but the if test minimizes the number of GV calls.

Code: Select all

Variable: IntraBarPreserve MyVarGV(0),

If LastBarOnChart then
begin
If MyVarGV = 0 then
MyVarGV = GV_GetNamedInt("GVname",0);
end;

I You want to change MyVarGV then also send out the GV.

As far as solving this problem I think this brand new classic reserve word shoud be used.

Variable MeASimpleVariableSoAllTheTimeLeaveMeTheHellAloneEL MyVariable(0);

However you need to put a smily at the end of that reserve word so EL does not get mad at you and figure out another way to trip you up :-)

User avatar
RobotMan
Posts: 375
Joined: 12 Jul 2006
Location: Los Altos, California, USA
Has thanked: 31 times
Been thanked: 13 times
Contact:

Postby RobotMan » 10 Jul 2008

I like the new reserved word. :D


Bob Perry
Los Altos, CA


Return to “MultiCharts”