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

Notification

Icon
Error

Options
Go to last post Go to first unread
Sajeel  
#1 Posted : Tuesday, December 7, 2010 8:16:24 AM(UTC)
Sajeel

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2010(UTC)
Posts: 17

I am using the system tester to back test a method where keltner bands cross moving averages. I buy when the keltner bands cross the Moving Averages on the upside and sell when the kelner bands cross the moving averages on the downside.I have 2 moving averages. A simple moving average and an exponential moving average. The Keltner Indicator is as below: Mov((H+L+C)/3,10,S); Mov((H+L+C)/3,x,S) + Mov((H-L),10,S); Mov((H+L+C)/3,x,S) - Mov((H-L),10,S); Simple Moving average= Mov(C,10,S) Exponential Moving average= Mov(C,10,E) Now I have done the following in the system tester: BUY ORDER: Cross(Mov((H+L+C)/3,10,S) AND (Mov((H+L+C)/3,10,S)+Mov((H-L),10,S)) AND (Mov((H+L+C)/3,10,S)-Mov((H-L),10,S)),Mov(C,10,S) AND Mov(C,10,E)) SELL ORDER: Cross(Mov(C,10,S) AND Mov(C,10,E),Mov((H+L+C)/3,10,S) AND (Mov((H+L+C)/3,10,S)+Mov((H-L),10,S)) AND (Mov((H+L+C)/3,10,S)-Mov((H-L),10,S))) SELL SHORT ORDER: Cross(Mov(C,10,S) AND Mov(C,10,E),Mov((H+L+C)/3,10,S) AND (Mov((H+L+C)/3,10,S)+Mov((H-L),10,S)) AND (Mov((H+L+C)/3,10,S)-Mov((H-L),10,S))) BUY TO COVER ORDER: Cross(Mov((H+L+C)/3,10,S) AND (Mov((H+L+C)/3,10,S)+Mov((H-L),10,S)) AND (Mov((H+L+C)/3,10,S)-Mov((H-L),10,S)),Mov(C,10,S) AND Mov(C,10,E)) Is this correct? I would appreciate any help given. Thanks
johnl  
#2 Posted : Tuesday, December 7, 2010 6:47:58 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

I looked at the buy and sell signal code and found it a bit confusing.
Try organizing the code like:

a1:= condition 1;
a2:= condition 2;
a3:= condition 3;
a4:= condition 4;
a5:=a1*a2*a3*a4;
a5

instead of all those "and"s and it will be a lot easier to catch errors or conditions you
might want to change.


wabbit  
#3 Posted : Wednesday, December 8, 2010 1:22:34 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Looking so far at the long entry code, you're looking for the Cross() of two Boolean expressions, when both of them (except under very exceptional circumstances) will be 1, so Cross(1,1) is always false.


wabbit [:D]

henry1224  
#4 Posted : Wednesday, December 8, 2010 3:30:48 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
you have 3 bands, which band should the ma's cross?


Top:=Mov((H+L+C)/3,10,S) + Mov((H-L),10,S);
Midl:=Mov((H+L+C)/3,10,S);
Bot:=Mov((H+L+C)/3,10,S) - Mov((H-L),10,S);

SMA:= Mov(C,10,S) ;
EMA:= Mov(C,10,E) ;

If(Cross(Max(SMA,EMA),Top),1,
If(Cross(Bot,Min(SMA,EMA)),-1,0));

Sajeel  
#5 Posted : Wednesday, December 8, 2010 4:28:21 PM(UTC)
Sajeel

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2010(UTC)
Posts: 17

Thanks for getting back to me! I want all three bands to cross and trigger buy/Sell signals!
henry1224  
#6 Posted : Wednesday, December 8, 2010 6:17:51 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
Sajeel

you have 3 bands, which band should the ma's cross?


Top:=Mov((H+L+C)/3,10,S) + Mov((H-L),10,S);
Midl:=Mov((H+L+C)/3,10,S);
Bot:=Mov((H+L+C)/3,10,S) - Mov((H-L),10,S);

SMA:= Mov(C,10,S) ;
EMA:= Mov(C,10,E) ;

If(Cross(Max(SMA,EMA),Top),1,
If(Cross(Bot,Min(SMA,EMA)),-1,0));{will never give a signal}

the SMA and EMA cross back and forth the Midl band but never cross the top or fall below the Bot band

for the sma and ema to cross the keltner bands, you have to slow down the Keltner bands or speed up the sma and ema.They cannot be the same length
henry1224  
#7 Posted : Wednesday, December 8, 2010 6:51:08 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
this chart is just using the close for the crossing of 55 pd Keltner bands

UserPostedImage
Sajeel  
#8 Posted : Thursday, December 9, 2010 9:43:35 AM(UTC)
Sajeel

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2010(UTC)
Posts: 17

Thanks, The Moving averages would be longer periods than the bands. I used a value of 10 as a dummy value. I am just slightly confused how I would compute the formula's in the System Tester. According to your formula's you are only taking into account the Top and Bottom Bands, which makes sense. Since I want all 3 bands to cross before a signal is generated should I use the Bottom Band on the u[censored]de and the Top Band on the downside. If this is the case in the system tester is this how the formula's would sit: BUY ORDER: Top:=Mov((H+L+C)/3,10,S) + Mov((H-L),10,S); Midl:=Mov((H+L+C)/3,10,S); Bot:=Mov((H+L+C)/3,10,S) - Mov((H-L),10,S); SMA:= Mov(C,10,S) ; EMA:= Mov(C,10,E) ; Cross(Max(SMA,EMA),Bot) SELL ORDER: Top:=Mov((H+L+C)/3,10,S) + Mov((H-L),10,S); Midl:=Mov((H+L+C)/3,10,S); Bot:=Mov((H+L+C)/3,10,S) - Mov((H-L),10,S); SMA:= Mov(C,10,S) ; EMA:= Mov(C,10,E) ; Cross(Top,Min(SMA,EMA)) SELL SHORT ORDER: Top:=Mov((H+L+C)/3,10,S) + Mov((H-L),10,S); Midl:=Mov((H+L+C)/3,10,S); Bot:=Mov((H+L+C)/3,10,S) - Mov((H-L),10,S); SMA:= Mov(C,10,S) ; EMA:= Mov(C,10,E) ; Cross(Top,Min(SMA,EMA)) BUY TO COVER ORDER: Top:=Mov((H+L+C)/3,10,S) + Mov((H-L),10,S); Midl:=Mov((H+L+C)/3,10,S); Bot:=Mov((H+L+C)/3,10,S) - Mov((H-L),10,S); SMA:= Mov(C,10,S) ; EMA:= Mov(C,10,E) ; Cross(Max(SMA,EMA),Bot) ?
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.