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

Notification

Icon
Error

Options
Go to last post Go to first unread
William  
#1 Posted : Wednesday, April 26, 2006 6:44:20 PM(UTC)
William

Rank: Newbie

Groups: Registered, Registered Users
Joined: 5/14/2005(UTC)
Posts: 4

Hello, I am trying to figure out a way to have several price filters and one entry signal built into an indicator. For me, i like to look at the indicator before i do an exploration and i am not exactly sure how to lay it all out. The problem i am having is that i am getting "1s" that last longer than a stochastic cross, so it doesnt seem to be using that as the primary signal. I have listed the indicator i was using to create the signal, i would greatly appreciate any help in making it more responsive to the stochastic cross. Please excuse my crude programming: Filter #1 Highest High Value 250 in the past 30 sessions My Code Alert(C>Ref(HHV(H,250), -1),30) Filter #2 Price is close to 50-day moving average My Code Alert(CLOSE - Mov(C,50,S) <= ATR(21)*.5,10) OR Alert(Mov(C,50,S) - CLOSE <= ATR(21)*.5,10) AND Filter #3 50-DMA is greater than 200 Mov(C,50,S) > Mov(C,200,S) Filter #4 30-DMA > 50-DMA My Code Mov(C,30,S) > Mov(C,50,S) Signal Stochastics cross above 20 in the past 2 sessions Alert(Cross(Stoch(9,3),20),2) Full Formula and "logic" If( Alert(C>Ref(HHV(H,250), -1),30) AND Alert(CLOSE - Mov(C,50,S) <= ATR(21)*.5,10) OR Alert(Mov(C,50,S) - CLOSE <= ATR(21)*.5,10) AND Alert(Cross(Stoch(9,3),20),2) AND CLOSE > Mov(C,200,S) AND Mov(C,50,S) > Mov(C,200,S) AND Mov(C,30,S) > Mov(C,50,S) ,1,0)
wiked  
#2 Posted : Thursday, May 4, 2006 2:34:37 AM(UTC)
wiked

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 31

The problem is being caused by your OR condition. MetaStock does all ANDs, then it calculates the ORs. This is causing MetaStock to evaluate your signal as: If( ( Alert(C>Ref(HHV(H,250), -1),30) AND Alert(CLOSE - Mov(C,50,S) <= ATR(21)*.5,10) ) OR ( Alert(Mov(C,50,S) - CLOSE <= ATR(21)*.5,10) AND Alert(Cross(Stoch(9,3),20),2) AND CLOSE > Mov(C,200,S) AND Mov(C,50,S) > Mov(C,200,S) AND Mov(C,30,S) > Mov(C,50,S) ) ,1,0) Since this is not the condition you are looking for, you should add parenthesis to force the correct OR calculation. Also, in this case, the IF is not needed. Your formula can be written as: Alert(C>Ref(HHV(H,250), -1),30) AND (Alert(CLOSE - Mov(C,50,S) <= ATR(21)*.5,10) OR Alert(Mov(C,50,S) - CLOSE <= ATR(21)*.5,10)) AND Alert(Cross(Stoch(9,3),20),2) AND CLOSE > Mov(C,200,S) AND Mov(C,50,S) > Mov(C,200,S) AND Mov(C,30,S) > Mov(C,50,S) This should give you the result you are wanting
William  
#3 Posted : Monday, May 8, 2006 10:25:50 PM(UTC)
William

Rank: Newbie

Groups: Registered, Registered Users
Joined: 5/14/2005(UTC)
Posts: 4

Ahhhh, i see thank you very much for you help.
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.