Discussions
»
Product and Service Development
»
MetaStock
»
How to detect the current or yesterday position
Rank: Newbie
Groups: Registered, Registered Users Joined: 4/3/2008(UTC) Posts: 7
|
Hi,
Is there anyway that I can detect the current or yesterday position when I run the System Tester ?
Currently I am looking at Simulation.LongPositionCount and Simulation.ShortPositionCount, however the rules is not performing as I wanted to.
Could any expert in here share their pointer on which function is the best to detect current long/short position ?
Update- I think I need to use the Simulation.CurrentPositionSize, however everytime I use the function/variable, the Metastock does not give any test result.
Formula Example: MA15:= mov(c,15,s); Crossing:= l < MA15 and MA15 < h;
LongPos:= Simulation.CurrentPositionSize >= 0;
{Out signal}
OUT := ROC(mov(c,5,s),1,%) * ROC(mov(ref(c,-1),5,s),1,%) <=0;
Intermediate := If(LongPos And OUT,False,True); {Decision} Crossing AND c > MA15 AND Intermediate
Below is the error message : An MSX DLL is reporting an internal error. Referenced DLL:
"SIMULATION.CURRENTPOSITIONSIZE" DLL Message: References to current position
statistics in formulas other than the System Tester Sell and Buy to
Regards,
|
|
|
|
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)
|
Hi gombong,
Try using the Forum.dll latch which returns the state of the trade, 1 for long trade, -1 for short or 0 for no trades.
wabbit [:D]
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 4/3/2008(UTC) Posts: 7
|
Excellent Wabbit. I believe this is the solution to my current problem.
Will let you know the the status. Cheers,
gombong
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 4/3/2008(UTC) Posts: 7
|
Hi Wabbit, Thanks a bunch. I've manage to solve the prev issue in referencing yesterday position using the latch function as suggested earlier.
However, now I found another stumbling block again when I want to create a system with the cut loss strategy based on the entry price and yet referencing yesterday position as well since the system shall not enter the same position yesterday.
At the moment I am using Simulation.CurrentPositionPerformance function in my exit rule. However this function is not allowed to be used in the buy rule :(
Is there anybody that have a solution for this ?
Gombong
|
|
|
|
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)
|
Hi again Gombong, I think you might be rapidly approaching the limitations of MS and its EST. Although I have never tried this myself, you might try to incorporate Richard Dales excellent and free AdvancedStops addin as a input the forum latch function. (See http://www.tradernexus.com/advancedstop/advancedstop.html of these work for you, you might have to get something custom built to meet your specific requirements. wabbit [:D]
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Discussions
»
Product and Service Development
»
MetaStock
»
How to detect the current or yesterday position
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.