in Search

How to detect the current or yesterday position

Last post 05-06-2008, 22:19 by wabbit. 4 replies.
Sort Posts: Previous Next
  •  04-29-2008, 23:54 27072

    How to detect the current or yesterday position

    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,
  •  04-30-2008, 1:13 27073 in reply to 27072

    Re: How to detect the current or yesterday position

    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 Big Smile [:D]


    MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC & MDK
    For custom MetaStock programming : http://www.wabbit.com.au
    My SkyPE status : wabbit.com.au SkyPE online status
    My SkyPE account : wabbit.com.au

  •  04-30-2008, 1:42 27074 in reply to 27073

    Re: How to detect the current or yesterday position

    Excellent Wabbit.
    I believe this is the solution to my current problem.

    Will let you know the the status.
    Cheers,

    gombong
  •  05-06-2008, 20:57 27136 in reply to 27074

    Re: How to detect the current or yesterday position

    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


  •  05-06-2008, 22:19 27137 in reply to 27136

    Re: How to detect the current or yesterday position

    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 for more information.)

    If this doesn't work for you, then I recommend that you investigate whether TradeSim might be a better solution for your system testing requirements?  (See http://www.compuvision.com.au/ for more information.)

    If neither of these work for you, you might have to get something custom built to meet your specific requirements.


    wabbit Big Smile [:D]



    MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC & MDK
    For custom MetaStock programming : http://www.wabbit.com.au
    My SkyPE status : wabbit.com.au SkyPE online status
    My SkyPE account : wabbit.com.au

View as RSS news feed in XML