Rank: Advanced Member
Groups: Registered, Registered Users, Unverified Users Joined: 3/9/2007(UTC) Posts: 35
Thanks: 1 times
|
Hello everyone.. Greetings!
Am encountering a problem. Was making a basic EA to show arrows whenever Stochastic gets overbought or oversold "first". But arrows are coming in all the candles until Stochastic moves out of that condition. How the formula can be modified to show just single arrow whenever Stochastic enters OB/OS region. Formula for OS that i used was simply Stoch(14,3)<20.
Best,
Nishant
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 3/6/2010(UTC) Posts: 113 Location: London
|
I'm assuming your overbought condition is Stoch(14,3)>80. There are many ways you can do this. Try something like: {Buy} Buy:=Stoch(14,3)<20; Sell:=Stoch(14,3)>80; BarsSinceBuy:=BarsSince(Ref(Buy,-1)); BarsSinceSell:=BarsSince(Ref(Sell,-1)); Buy AND BarsSinceBuy>BarsSinceSell; {Sell}
Buy:=Stoch(14,3)<20; Sell:=Stoch(14,3)>80; BarsSinceBuy:=BarsSince(Ref(Buy,-1)); BarsSinceSell:=BarsSince(Ref(Sell,-1)); Sell AND BarsSinceBuy<BarsSinceSell; The first four lines are the same for both buy and sell. The reason why there is a backward ref of 1 bar is because BarsSince would be zero for the current bar if that condition is true.
|
|
|
|
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.