Rank: Newbie
Groups: Registered, Registered Users Joined: 8/13/2010(UTC) Posts: 2
|
Consider this function in indicator.
if(IsDefined(ref(close,1), ref(close,1), PREV);
it shows perfectly.
However, if we write the following, it does not:
a:=if(IsDefined(ref(close,1), ref(close,1), PREV); a;
The indicator stop on yesterday data.
if i save the if(....) in "A" indicator, no problem in calling the "A" indicator.
Anyone could explain this?
Thanks!
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi
Once the syntax of your code is corrected the simple fact is that neither expression should work, but if one is more correct than the other it’s the second one. Nevertheless over the years I’ve come across several examples where named variables fail to output the correct or any result while unnamed variables work just fine.
The Ref(CLOSE,1) expression is always going to return N/A (no plot) on the last bar. Why? Because it’s forward referenced and on the last bar there is no data for it to look forward to. Since any N/A result within an expression (in this case the If() function) causes that expression to also return an N/A the "correct" response comes from the named variable, not the unnamed one.
I suspect that the unnamed PREV variable returns a zero as an incomplete result from the PREV function whereas the structure of the named variable allows the PREV expression to return a correct result, namely N/A. I’m just guessing though.
If there’s a point to your exercise it would seem to be to plot the following CLOSE except on the last bar plot the current CLOSE, and the code below does that.
D:=IsDefined(Ref(C,1));
If(D,ExtFml("Forum.Sum",Ref(C,1),1),C);
Roy
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 8/13/2010(UTC) Posts: 2
|
Hi Roy,
Thanks!. The Forum20.dll helps to solve the issue. Equis should include this as a standard dll :)
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.