Rank: Newbie
Groups: Registered, Registered Users Joined: 7/20/2010(UTC) Posts: 2
|
Hi all,
Please excuse my lack of Metastock coding experience in advance. I have read most of the formula primer and searched the community for an answer to my issue, but I've had little luck.
Anyway, on to the issue: I have programmed my trading system into the system tester and it seems fairly successful. One thing I have not been able to get right is a good-till-cancelled stop loss that stays in the system at the same price immediately after my buy/sell short order is executed. When I buy, I trade on a break above yesterday's high (i.e.C>ref(H,-1)) , when I short, I do do on a break below yesterday's low (i.e.C[
]
|
|
|
|
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)
|
You need to refer to the fixed stop price on the bar the trade was opened, which can be found using the Simulation.CurrentPositionAge function combined with the Forum.Ref function (Forum.dll is available in the files section of the forum). You might try something like: Code:
{Buy}
Cross(C,Ref(H,-1));
{Sell}
Cross(extfml("forum.ref",LLV(L,3),simulation.currentpositionage+1),L);
{Sell Short}
Cross(Ref(L,-1),C);
{Buy to cover}
Cross(H,extfml("forum.ref",HHV(H,3),simulation.currentpositionage+1));
wabbit [:D]
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 7/20/2010(UTC) Posts: 2
|
Hi Wabbit, thank you so much for the prompt and very informative response, it was spot on the money and I'm well on my way to perfecting the system!
|
|
|
|
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.