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

Notification

Icon
Error

Options
Go to last post Go to first unread
david_j_nowak  
#1 Posted : Tuesday, March 8, 2005 5:09:40 AM(UTC)
david_j_nowak

Rank: Newbie

Groups: Registered, Registered Users
Joined: 11/19/2004(UTC)
Posts: 3

I just hacked together my first Expert Advisor. It combines the Parabolic SAR (for stop placement) with a 25d Mean Price Weighted Moving Average Crossover (for trend direction). I have attached a Acrobat format printout of the system. The Name, Buy/Sell Symbols and Trends field are accurate as well as the Ribbon definitions. The rest is just borrowed code from the Equis - Directional Movement Expert. What I am puzzled about is why the Buy/Sell arrrows repeat on a daily basis until the next opposite Buy/Sell signal on my chart. I just am after the first entry Buy/Sell signal arrow not a series of them peppered on my chart. Please help me! Dave Nowak An Expert Advisor Novice Writer
Patrick  
#2 Posted : Tuesday, March 8, 2005 3:05:51 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Change your buy formula to : Buy:=C>SAR(.02,.2) and C>Mov(MP(),25,W); Sell:=C<SAR(.02,.2) and C<Mov(MP(),25,W); Buy and Barssince(Ref(Buy,-1))>Barssince(Ref(Sell,-1) ) Change your sell formula to : Buy:=C>SAR(.02,.2) and C>Mov(MP(),25,W); Sell:=C<SAR(.02,.2) and C<Mov(MP(),25,W); Sell and Barssince(Ref(Buy,-1))<Barssince(Ref(Sell,-1) )
david_j_nowak  
#3 Posted : Thursday, March 17, 2005 5:13:48 AM(UTC)
david_j_nowak

Rank: Newbie

Groups: Registered, Registered Users
Joined: 11/19/2004(UTC)
Posts: 3

Thanks for the suggestion, Patrick. I used your suggested formulas. However, I still obtained a sprinkling of Sell and Buy arrows for each day that generated a Sell or Buy signals (see file attached). Do you have any other ideas of what I can do to eliminate redundant signals?
david_j_nowak  
#4 Posted : Thursday, March 17, 2005 5:16:00 AM(UTC)
david_j_nowak

Rank: Newbie

Groups: Registered, Registered Users
Joined: 11/19/2004(UTC)
Posts: 3

I have attached a sample plot using the expert advisor from last post.
Patrick  
#5 Posted : Friday, March 18, 2005 3:55:40 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
David, You used the formulae in your trends but you did not replace them for the signals that's why you still get multiple buy and sell signals Make sure you fix the formulae in both the symbol and alerts ... Patrick
minnamor  
#6 Posted : Wednesday, April 27, 2005 12:09:23 PM(UTC)
minnamor

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 126
Location: Italy

The above solution was very useful and could have been included in the MS manual. I have a system that includes an Entry point, a Profit Stop and a Loss Stop. Obviously, only one of the two stops can be triggered. How could this be handled?
Patrick  
#7 Posted : Wednesday, April 27, 2005 9:57:03 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Thank you :D In a similar fashion, you just end up creating a different STATE variable. Let's talk about a more complex version of the above where I have a Entry long, exit long, Enter Short, Exit short ... I would use something like this : EL:= ....; XL:=...; ES:=....; XS:=...; STATE:=If(EL,2,If(XL,1,If(ES,-2,If(XS,-1,Prev)))); Etc ... I think have something somewhere I will try to post it so you can get a better example. Patrick
Patrick  
#8 Posted : Thursday, April 28, 2005 3:10:55 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Here is the fixed version of the above, I actually tested this one so I hope I did not mess up :D {EnterLong} EnterLong:={Buy Condition}; ProfitStop:={Profit Stop Condition}; LossStop:={Stop Loss Condition}; Status:=If(EnterLong,3,If(ProfitStop,2,If(LossStop,1,PREV))); EL:=Cross(Status,2.5); PS:=Status=2 AND Ref(Status,-1)=3 ; LS:=Status=1 AND Ref(Status,-1)=3; EL {ProfitStop} EnterLong:={Buy Condition}; ProfitStop:={Profit Stop Condition}; LossStop:={Stop Loss Condition}; Status:=If(EnterLong,3,If(ProfitStop,2,If(LossStop,1,PREV))); EL:=Cross(Status,2.5); PS:=Status=2 AND Ref(Status,-1)=3 ; LS:=Status=1 AND Ref(Status,-1)=3; PS {LossStop} EnterLong:={Buy Condition}; ProfitStop:={Profit Stop Condition}; LossStop:={Stop Loss Condition}; Status:=If(EnterLong,3,If(ProfitStop,2,If(LossStop,1,PREV))); EL:=Cross(Status,2.5); PS:=Status=2 AND Ref(Status,-1)=3 ; LS:=Status=1 AND Ref(Status,-1)=3; LS Patrick
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.