logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
tekken  
#1 Posted : Friday, September 30, 2016 4:07:50 PM(UTC)
tekken

Rank: Newbie

Groups: Registered Users, Subscribers
Joined: 9/29/2016(UTC)
Posts: 5

Thanks: 1 times

 

I'm trying to trigger a buy signal with:

 

Mov(C,5,E) > PREV

 

and the sell signal with:

 

Mov(C,5,E) < PREV

 

 

The idea was to buy when the moving avarage is rising and sell when falling. But the code doesn't work.

What's the proper way?

 

 

 

 

 

 

 

 

 

 


mstt  
#2 Posted : Friday, September 30, 2016 7:11:51 PM(UTC)
mstt

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 tekken Try these Buy and Sell signals. PREV is inappropriate to what you're trying to do. To explain my code for Buy, the current moving average is tested for higher than the previous bars moving average, and for Sell the current moving average is tested for lower than the previous bars moving average. The use of an Alert() function limits the signal to just one bar, thus eliminating a multiple succession.of unwanted extra signals {Buy} Buy:=Mov(C,5,E) > Ref(Mov(C,5,E),-1) ; Buy:=Buy AND Alert(Buy=0,2); Buy; {Sell} Sell:=Mov(C,5,E) < Ref(Mov(C,5,E),-1) ; Sell:=Sell AND Alert(Sell=0,2); Sell; Hipe this helps. Roy
thanks 1 user thanked mstt for this useful post.
tekken on 9/30/2016(UTC)
tekken  
#3 Posted : Friday, September 30, 2016 11:04:07 PM(UTC)
tekken

Rank: Newbie

Groups: Registered Users, Subscribers
Joined: 9/29/2016(UTC)
Posts: 5

Thanks: 1 times
Hi Roy, that code worked just fine. Explanation was also helpful, thanks!
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.