Announcement

Collapse
No announcement yet.

AGET studies in strategies

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

  • AGET studies in strategies

    I'm trying to use an elliott study in a backtest strategy. The elliott.getValue(GetElliottStudy.MOSTRECENTWAVEBAR INDEX) always seems to return the very last wave on the chart instead of changing as bars are loaded. In addition, if you put a bar offset in the getValue call it seems to be ignored. The following code doesn't give you the bar index of the next most recent wave. This is unexpected. Is there a way to get the bar indexes of prior waves using the getValue calls? I know I could do it checking each bar with the WAVE and manually keep track of the bar index, but that would be a pain.

    Thanks,

    Steve
    PHP Code:
    var elliott = new GetElliottStudy(3000505350);

    function 
    preMain()
    {
        
    setStudyTitle("GET test1");
        
    setPriceStudy(true);
        
    setCursorLabelName("MOSTRECENTWAVE"0);
        
    setCursorLabelName("MOSTRECENTWAVEBARINDEX"1);
        
    setCursorLabelName("NEXTMOSTRECENTWAVEBARINDEX"2);
    }    
    function 
    main()
    {
        if(
    elliott.getValue(GetElliottStudy.MOSTRECENTWAVEBARINDEX) === null)
            return;
        
        
    // get the bar index of the most recent wave and look 1 past that for the next most recent wave bar index
        
    var elliott.getValue(GetElliottStudy.MOSTRECENTWAVEBARINDEX);
        return new Array(
    elliott.getValue(GetElliottStudy.MOSTRECENTWAVE)+" "
                         
    elliott.getValue(GetElliottStudy.MOSTRECENTWAVEBARINDEX)+" ",
                         
    elliott.getValue(GetElliottStudy.MOSTRECENTWAVEBARINDEXi-1)+" ");   


  • #2
    Steve
    As I understand it the MOSTRECENTWAVE and MOSTRECENTWAVEBARINDEX methods only return the current wave and related bar index and do not take a bar offset value. I believe you need to manually keep track of each wave and its bar index
    With regards to back testing a strategy that includes the Elliott study I am not sure how you will be able to do that using the Strategy Analyzer. As the Strategy Analyzer runs through historical data it will be looking at a completed wave count that is based on all the data present in the chart and that may be different from the wave count that would exist at the time the bar being tested was the last bar on the chart.
    The following screenshots show what the Strategy Analyzer will see as it runs through historical bars (top chart) and what the wave count was actually at a given time (bottom chart).
    As the bars are processed in back testing, EFS sees a wave 5 value while processing the 8/16/07 bar highlighted in the next chart. That value is taking into consideration the price action that is known on the future bars to the right.



    If the strategy were processing the 8/16/07 bar in real time, EFS would not have seen a wave 5, but a wave 3 as in the next image



    Unless the Strategy Analyzer is completely re-written so as to behave like Bar Replay I don't think you will be able to use it to back test an Elliott Wave strategy [or a strategy that includes Elliott waves]. Even then you will still need to take into account the dynamic nature of Elliott waves which means that the wave count can and will change on both historical and real time bars as the market evolves.
    Alex

    Comment


    • #3
      Alex,

      Thanks for the info. I wasn't aware that the backtester would use the "final" values. I guess I'll have to manually simulate the backtester by running bar replay and keeping track of trades myself.

      Basically I'm coding a Type II entry strategy and determining how various exit rules affect the profit/loss. Also looking at what I should do when the waves recount.

      I did end up writing a routine that would allow me to get historic wave information which I've included below for anyone who would like to have it. Also some example code showing how you could use it.

      PHP Code:
      ///////////////////////////////////////////////////////// 
      // This function gets the most recent wave seen starting  
      // from the given index and looking back from there.      
      //                                                        
      // inputs: index - the index of the bar to start looking  
      //                 from. Must be negative. For example    
      //                 -1 means start looking from the prior  
      //                 bar. -10 means start looking from 10   
      //                 bars back.                             
      //         vElliott - an elliott wave study reference     
      //                                                        
      // returns: An array whose first element is the major     
      //          bar seen. The second element is the bar index 
      //          for that bar. If we reach the end of the bars 
      //          then both array elements will return null.    
      //////////////////////////////////////////////////////////
      function GetMostRecentWaveInfo(indexvElliott)
      {
          
      // do some validation
          
      if(index 0)
              throw(
      "GetMostRecentWaveInfo: index must be negative or zero.");
          if(
      vElliott == null)
              throw(
      "GetMostRecentWaveInfo: Elliott study is null.");
          
          var 
      barIndex index;
          var 
      oldestBar getOldestBarIndex();
          
      // scan back thru bars looking for a major wave occurance
          
      while(barIndex oldestBar)
          {
              
      // check if this bar has a major wave assigned to it
              
      if(vElliott.getValue(GetElliottStudy.WAVEbarIndex) != null)
                  return new Array(
      vElliott.getValue(GetElliottStudy.WAVEbarIndex), barIndex);
                  
              
      // go back another bar
              
      barIndex--;
          } 
      // end while loop
          
          // we ran out of bars, so return null for both values
          
      return new Array(nullnull);
      // end function GetMostRecentWaveInfo 
      An example of calling the above code to get the indexes of the last wave 3, 4, and 5.

      PHP Code:
          // we should only come here if we already have a wave 5 marked
          
      if(Math.abs(GetMostRecentWaveInfo(0elliott)[0]) != WAVE5UP)
              return;
              
          
      nWave5Bar GetMostRecentWaveInfo(0elliott)[1];
          
      nWave4Bar GetMostRecentWaveInfo(nWave5Bar-1elliott)[1];
          
      nWave3Bar GetMostRecentWaveInfo(nWave4Bar-1elliott)[1]; 
      Enjoy,

      Steve

      Comment


      • #4
        Steve
        You are most welcome
        Alex

        Comment


        • #5
          Alex,

          Steve and I are working together on this and given the forward looking factor due to the dynamic nature of the wave count, wonderered what you thought about using the generic broker fuctions in tick and ( preferably) bar replay , ie., will the results recorded be approximate to actual trading results?

          I understand all of the availiable reports produced by the strategy object/back tester will not be available directly although could be calculated either in the EFS or manually.

          One reason I'm asking aside from my personal interest in AGET is I met with several people from eSignal yesterday regarding some AGET education broadcasts scheduled for www.forextv.com .

          One objective Steve and myself are trying to achieve here is determining what AGET strategies, specific currencies symbols, and time frames to feature in these broadcasts.

          Without having either the experience with AGET nor the ability to backtest a strategy I'm somewhat reluctant to use examples where I have no idea how they will perform in the future. People may very well start trading off the examples I illustrate and I'd like to give them the best chance of having those trades succeed. I've been trading Type II in some of the major currencies using short term tick charts the past few weeks with very good success so far, but not in sufficient enough quantity of trades to feel confident enough to share it.

          If you or anyone else more familiar with the AGET setups trading FOREX can make any general recomendations that would be appreciated: AGET strategy, time interval, FX Pair, etc.

          Obviously there are no "right" answers and clearly never any guarantees given the future uncertainty.

          I'm just looking for some general suggestions and interested in presenting examples that have a reasonable chance if folllowed of being successful in the future.

          Thanks,

          Glen
          Last edited by demarcog; 10-12-2007, 09:47 PM.
          Glen Demarco
          [email protected]

          Comment


          • #6
            Glen
            I would think that using the generic broker functions in either Tick or Bar Replay would approximate actual trading assuming the conditions are programmed correctly.
            With regards to your other questions I would suggest that you contact the specialists at eSignal Learning who in my opinion are best equipped to provide you with the information and the guidance you are seeking
            Alex

            Comment


            • #7
              Originally posted by Alexis C. Montenegro
              Glen
              I would think that using the generic broker functions in either Tick or Bar Replay would approximate actual trading assuming the conditions are programmed correctly.
              With regards to your other questions I would suggest that you contact the specialists at eSignal Learning who in my opinion are best equipped to provide you with the information and the guidance you are seeking
              Alex
              Hi Alex,

              Tick replay works great, but the few time I've tried bar replay with the same EFS it appeared that that prices recorded were of the realtime price, not the pricees I was seeing in the bar replay.

              I mistakenly thought perhaps the generic briker functions only worked with tick replay, so I'll try that again.

              Thanks very much for your help and for the link regarding my other questions, I realized as I was typing the question that this was perhaps not the appropriate place but knew you have used AGET extensively and was interested in anything you may have had to offer. I will follow up, thanks again for all your help, it is very much appreciated.

              Glen
              Glen Demarco
              [email protected]

              Comment


              • #8
                Glen
                I forgot that the generic broker functions retrieve real time prices only. Sorry for the confusion.
                For Bar Replay you will need to keep track of the strategy using your own formula variables.
                Alex

                Originally posted by demarcog
                Hi Alex,

                Tick replay works great, but the few time I've tried bar replay with the same EFS it appeared that that prices recorded were of the realtime price, not the pricees I was seeing in the bar replay.

                I mistakenly thought perhaps the generic briker functions only worked with tick replay, so I'll try that again.

                Thanks very much for your help and for the link regarding my other questions, I realized as I was typing the question that this was perhaps not the appropriate place but knew you have used AGET extensively and was interested in anything you may have had to offer. I will follow up, thanks again for all your help, it is very much appreciated.

                Glen

                Comment

                Working...
                X