Rank: Newbie
Groups: Registered, Registered Users Joined: 12/20/2011(UTC) Posts: 1
|
Hi all,
I'm trying to create a formula to determine automatically the fibonacci retracement, using as high/low points most recent swings.
I wrote this formula to determine the swing high point, but it does not return anything (when i plot it i got nothing on screen).
Code:
HighestFIB:=
If(Ref(H,-2)
I used this code to set the hihgest point of the swing high, and not to make it change if the current high is higher than the swing point high.
I think something messes up if the first bars of the chart, and so it keep on with the 'else' of the 'if' function, i.e. always referring to 'Ref(HighestFIB,-1)'.
Any idea on how I could make it work?
thanks a lot^^
|
|
|
|
Rank: Advanced Member
Groups: Moderators, Registered, Registered Users, Subscribers Joined: 10/8/2010(UTC) Posts: 1,967
Thanks: 93 times Was thanked: 155 time(s) in 150 post(s)
|
You can not reference the previous value of highestFIB by name in the assignment of highestFIB. Instead, use the PREV variable as shown below.
top:=Ref(H,-2)<H AND Ref(H,-1)<H AND Ref(H,1)<H AND Ref(H,2)<H; highestFIB:= If(top, HighestSince(1,top, H), PREV); highestFIB
|
|
|
|
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.