Discussions
»
Product and Service Development
»
MetaStock
»
Expert Advisor...limit # of entry signals?
Rank: Member
Groups: Registered, Registered Users Joined: 6/29/2007(UTC) Posts: 19
|
Howdy All!
I'm building an expert advisor to work with Price Headley's acceleration band concept. Here is my current "Long Entry" code in the expert advisor:
C>Mov((H*(1+2*((((H-L)/((H+L)/2))*1000)*0.001))), 20, S )
AND Ref(C,-1) > Ref(Mov((H*(1+2*((((H-L)/((H+L)/2))*1000)*0.001))), 20, S ),-1)
AND C>Mov((H*(1+2*((((H-L)/((H+L)/2))*1000)*0.001))), 80, S )
This essentially generates an "enter" signal for every bar that closes above the acceleration band.
How do I limit the entry signals to only one at a time? I'd like to see one defined entry point, instead of a long stream of green buy arrows when I look at a chart.
Thanks in advance.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 4/1/2006(UTC) Posts: 135 Location: Romania
|
howdy j32,
Design an exit and use the latch function availiable within forum.dll wich is downloadable free in this forum....acceleration band concept....i can`t wait to see someone saying that he has mathematicaly developed a hiperbolic relationship which could make u rich next morning.
*PP
www.draculasystems.com
|
|
|
|
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)
|
J32
As *PP has suggested, a latch is necessary if you want only one entry signal for each exit signal. However, if all you want to do is identify the leading edge of a contiguous block of signals then a check for the current value being TRUE and the previous value being FALSE is all that's required.
Entry:=C>Mov((H*(1+2*((((H-L)/((H+L)/2))*1000)*0.001))),20,S)
AND Ref(C,-1)>Ref(Mov((H*(1+2*((((H-L)/((H+L)/2))*1000)*0.001))),20,S ),-1)
AND C>Mov((H*(1+2*((((H-L)/((H+L)/2))*1000)*0.001))),80,S);
Entry AND Alert(Entry=0,2);
The result line could also be written as:
Entry AND Ref(Entry,-1)=FALSE;
Roy
MetaStock Tips & Tools
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 6/29/2007(UTC) Posts: 19
|
Thanks guys!
Roy, I think what you wrote for me is exactly what I'm looking for. I just downloaded the forum.dll and the tutorial that goes with it as well. That should keep me busy for a while.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Unverified Users Joined: 9/13/2004(UTC) Posts: 673 Location: Salt Lake City, UT
|
I believe the following formulas should also help for this. I did not create these formulas but figured I'd post them here to help out:
bc:=Ref(C,1)>C;{Replace with your Buy Condition}
sc:=Ref(C,1)<C;{Replace with your Sell Condition}
If( bc=1, 1, If(sc=1, -1, PREV))
3 state:
bc:=C > Mov(C,20,S)+1;{Replace with your Buy Condition}
be:=Cross(Mov(C,20,S),C);{Replace with your Buy Exit Condition}
sc:=C < Mov(C,20,S)-1;{Replace with your Short Condition}
se:=Cross(C,Mov(C,20,S));{Replace with your Short Exit Condition}
If( bc=1, 1, If(sc=1, -1, If(be OR se,0,PREV)))
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Discussions
»
Product and Service Development
»
MetaStock
»
Expert Advisor...limit # of entry signals?
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.