Rank: Newbie
Groups: Registered Users, Subscribers Joined: 9/11/2016(UTC) Posts: 4
Thanks: 2 times
|
I am new here and learning to code. Can someone help in creating an exploration where the CLOSE crossed the LAST PEAK inside the Bollinger Bands? Also current CLOSE needs to be above the center of the Bollinger Band. I am trying as below..
pbrs :=PeakBars(1,CLOSE,3);
CLOSE>Mov(CLOSE, 20,S)
AND
Cross(CLOSE,Peak(1,CLOSE,3))
AND
REF(CLOSE,-pbrs) < Ref(BBandTop(C, 20, S, 2),-pbrs)
Thanks
|
|
|
|
Rank: Advanced Member
Groups: Moderators, Registered, Registered Users, Subscribers Joined: 10/8/2010(UTC) Posts: 1,960
Thanks: 92 times Was thanked: 155 time(s) in 150 post(s)
|
Hi,
You might want to try using LastValue to work around the use of constants issue, i.e.
pbrs:=LastValue(PeakBars(1,CLOSE,3));
CLOSE>Mov(CLOSE, 20,S) AND Cross(CLOSE,Peak(1,CLOSE,3)) AND Ref(CLOSE,-pbrs) < Ref(BBandTop(C,20,S,2),-pbrs)
There can be limitations with this, including the fact that the chart must be refreshed for the indicator to update (limiting its usefulness with realtime data, although that may be less an issue since you want to use it as an exploration). Some indicators can use the PREV function (+PREV-PREV) to work around some of these limitations, but you might want to experiment with the modified formula above to see if it works for you.
|
1 user thanked MS Support for this useful post.
|
|
|
Rank: Newbie
Groups: Registered Users, Subscribers Joined: 9/11/2016(UTC) Posts: 4
Thanks: 2 times
|
Awesome! Thanks for helping out.
It WORKS!
|
|
|
|
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.