Rank: Newbie
Groups: Registered, Registered Users Joined: 6/19/2006(UTC) Posts: 9 Location: USA
|
Ok i'm using MetaStock Pro with an auto trading platform. When a signal is generated in MetaStock my auto trader places the trade based on my indicator. I'm using a modified version of the "Equis - MACD" expert advisor for this. What i want to do is setup a second set of signals (besides the "BUY" and "SELL") which will tell my auto trader to go flat. This is what i want
when a "BUY" signal is triggered I want this to be followed by another
signal that will be set off when the price at the time of the "BUY" signal
has increased (or decreased) by 8 pips and then vice versa with "SELL" signals.
I would be happy to share all the details and formulas used in this once i get it working. So far i am getting about 60%+ successful trades but with this modification i'm sure i'd be closer to 90%. Any help would be greatly appreciated!
Josh
|
|
|
|
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)
|
Have a look at the forum.dll latch function. You can specify your entry and exit criteria in there, and combined with the ValueWhen() function, count the price movement from these levels.
wabbit :D
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 6/19/2006(UTC) Posts: 9 Location: USA
|
check it out this is what i got from Equis, works great.
bc:=Cross(MACD(),Mov(MACD(),9,E));
x:=H>=ValueWhen(1,bc,C+.0008);
x AND Ref(BarsSince(x)>BarsSince(bc),-1)
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 7/13/2006(UTC) Posts: 5
|
Because i am busy with a simular strategy i have some additional questions regarding this formula.
The first question: what exactly is the forum.dll latch function?
Second, i have some troubles understanding the BarsSince
bc:=Cross(MACD(),Mov(MACD(),9,E));
x:=H>=ValueWhen(1,bc,C+.0008);
x AND Ref(BarsSince(x)>BarsSince(bc),-1)
Can somebody explain to me the last line? It looks to me that BarsSince(bc) is never smaller then BarsSince(x), because the initial buysignal always happens before the actual period that it has increased with 8 pips.
|
|
|
|
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)
|
bigboom wrote:The first question: what exactly is the forum.dll latch function?
Originally posted by Patrick, the latch function in the Forum.dll (available from the downloads section) has a set of user conditions when a long trade is entered and exited, and when a short trade is entered and exited. Once a long trade has been entered, any subsequent long entry signals are ignored; if in a short trade, all subsequent short entry signals are ignore; if not in a trade, and exit signals are ignored etc etc etc. It solves a whole pile of coding problems.
I wrote an addendum to the code, but it has yet to be fully incorporated into the release versions of the Forum.dll Please check carefully the conditions under which you intend employing this use, and free, add-in.
bigboom wrote:Second, i have some troubles understanding the BarsSince
bc:=Cross(MACD(),Mov(MACD(),9,E));
x:=H>=ValueWhen(1,bc,C+.0008);
x AND Ref(BarsSince(x)>BarsSince(bc),-1)
'bc' is the Buy Condition. x is the exit condition (but it comes with a warning!!) The last line attempts to say "if not in a trade, then enter" [EDITED: because I am a numpty!]
Anyway, the warning... and the usefulness of the latch function.
Let's pretend the trade is entered on Day 1 when the MACD moves above the trigger and the price is at, say, 1.000. On Day 2 the price goes up to 1.006 which is not high enough to trigger the exit. On Day 3 the MACD falls below the trigger line. On Day 4 the MACD goes above the trigger line again, the price is 1.007; this trips the 'bc' condition but we are still in a trade, HOWEVER the 'x' value is reset to 1.007 (the price the last time 'bc' was true NOT the time 'bc' was true and we entered the trade!) + 0.008 = 1.015. The next day the price goes up to 1.010 (not a bad rise from the original price) then crashes to 1.000 i.e. you missed your profit!
The latch knows when the trade was entered and uses this value to set the exit price, any subsequent entry signals are ignored.
Hope this explanation helps.
Its late here (01:40 am) and I am very tired....
wabbit :D
<yawn>
|
|
|
|
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)
|
wabbit wrote:The last line attempts to say "if not in a trade, then enter"
No it doesn't !!
I told you its late... The code says, "If in a trade i.e the last entry was more recent that the last exit, AND the exit signal is triggered then exit...."
Sorry to confuse things....
I am going to bed!
|
|
|
|
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.