Announcement

Collapse
No announcement yet.

Multiple Strategies in Backtest

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple Strategies in Backtest

    does anybody know if it is possible to have the backtester read more than one strategy at a time,

    ie.

    if (system 1 entry == true)
    Strategy.isLong

    if (system 2 entry == true) // currently this would close system 1
    Strategy2.isShort

    if(system 2 exit == true) // but this will not reopen system 1 as
    strategy2.isCover // the strategy is now not in trade

    if(system1 exit == true)
    Strategy.isSell

  • #2
    shogun
    I don't believe the Strategy Analyzer can back test multiple strategies at the same time.
    Alex

    Comment


    • #3
      Alex thanks
      i did not think it was possible which is a pity as it would make it much more easy to check the true equity curve and max drawdown when using multiple strategies,

      Comment


      • #4
        shogun,

        I do the following all the time:

        Take the output of 4-5 EFS (using callFunction()) and use them in a strategy efs that tests how well the individual EFS's work as a system.

        I suspect this will work for you also.

        Garth
        Garth

        Comment


        • #5
          Garth Thanks

          that sounds like a interesting work around ,i have been trying to combine them in one efs which is just not working,

          would you have a example available for me to look at as i can not just grasp how you would combine them in the strategy efs.

          Comment


          • #6
            shogun,

            I don't really have anything I would want to share yet, though I was working on a template to release to these boards on how I build strategies. That project got interrupted by another, which in turn got interrupted by yet another...so it is getting pretty low in the stack.

            Here is the gist of just the "combining indicators" part. This is just an example...and I haven't checked it to make sure it would even pass correct syntax - but it is close.

            ===========================================
            // Grab the results of the indicators for this bar
            // Note that the indicators must pass the parameters in a return() statement for this to work

            // MyRegStudy.efs returns
            // [0] = Upper Band Value
            // [1] = Lower Band Value
            var MyRegStudy = callFunction("/MyFolder/MyRegStudy.efs", "main", MyParam1, MyParam2);

            // MyPivotStudy.efs returns
            // [0] = Pivot level
            // [1] = Pivot direction
            // [2] = Pivot Value
            var MyPivotStudy = callFunction ("/MyFolder/MyPivotStudy.efs", "main");

            nClose = close();

            // You MUST bulk check the indicators returns together AFTER all the indicators have been called, and AFTER prices (if needed) have been requested


            if (MyRegStudy == null || MyPivotStudy == null || nClose == null)
            return;

            if (MyPivotStudy[1] == 1){ // If my pivot is up
            if (nClose < MyRegStudy[1]) { // and close if below the lower regression line
            DoNewSignal(-1); // We go short
            }
            } else if (MyPivotStudy[1] == -1){ // If my pivot is down
            if (nClose > MyRegStudy[0]) { // and close if above the upper regression line
            DoNewSignal(1); // We go long
            }
            }
            =============================================

            DoNewSignal would implement the Strategy calls and/or implement some chart widget to show the direction of the trade. What I do is more complex than this for various reasons, but this is the basic's of how you can grab results for multiple EFS indicators.

            If you have problems/questions, let me know and I will try to help.

            Garth
            Garth

            Comment


            • #7
              thanks Garth

              when using multiple efs codes do you run them on the same chart or can you have them on different charts ,also for backtesting purposes will i have to put something in the code to align the efs codes to read the same bar at the same time or is this taken care of automatically,

              Comment


              • #8
                shogun,

                You will only run one EFS and that is the master efs, which in turn calls the others. You might want to load the others by hand to vrify the results of the master EFS, but it isn't manditory that you do so.

                In effect, this is the same as calling a built-in study from an EFS.

                Since you are only running one EFS, which in turn takes the results of the called EFS studies as input you don't have to worry about synching up bars.

                Note that this will not work for studies that run on multiple time frames. To do that you will have to rely on either universal global variables (set/get) or file I/O. At least until EFS2 is officially released.

                Garth
                Garth

                Comment


                • #9
                  Garth

                  thanks for your time i will put a efs together and see how i get on.

                  Comment

                  Working...
                  X