Announcement

Collapse
No announcement yet.

MostRecentTrade() in Backtesting

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

  • MostRecentTrade() in Backtesting

    The MostRecentTrade() function is said not to work for historical data; however it appears to work fine when I replay tick files. Will MostRecentTrade() work properly if the EFS code is used for strategy backtesting. Maybe I don't understand what is meant by "historical data". Can you please clarify??
    Thanks,
    Dave

  • #2
    Hello Dave,

    getMostRecentTrade() will return a value during replay or back testing, however it is the current trade in real time, not the replay or back testing time. You cannot use this function in replay or for back testing for this reason. If you want to get the most recent trade price for the bar that is being processed during replay or back testing you should use close(0).
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      MostRecentTrade

      Thanks, Jason. That clarifies things about MostREcentTrade
      However, I have a new problem. I calculate a trend once per bar by using
      BARSTATE_NEWBAR && isLastBaronChart
      The code seems to work fine during tick replay, giving me many triggers and alerts. However, it I try to use the same trigger to activate Strategy.doLong I get no trades at all with backtesting.
      As near as I can tell, it seems to be related to my use of BARSTATE_NEWBAR.
      I have also observed a peculiarity during tick replay. Unless I hit "jump" once after I start tick replay, the code never executes, but once I hit "jump", it works fine.
      I could sure use some guidance or suggestions.
      Thanks,
      Dave

      Comment


      • #4
        Backtest failure with BARSTATE_NEWBAR

        I have written EFS code that uses tests for
        BARSTATE_NEWBAR and isLastBarOnChart so that most of my EFS calculations only occur once per bar. This works well during real time and tick replay, but seems to fail if I try to do Backtesting. Backtesting seems to ignore all of my calculations except those that occur on the last bar. How should I handle this???
        THanks,
        Dave

        Comment


        • #5
          Hello Dave,

          Regarding your back testing code. You need to post your formula. Please use the attachment feature when replying on-line.

          When you first enter tick replay you need to select one of the jump options and click "Jump" to start the replay. After that point, use "Play" and "Pause" to start and stop during replay.
          Jason K.
          Project Manager
          eSignal - an Interactive Data company

          EFS KnowledgeBase
          JavaScript for EFS Video Series
          EFS Beginner Tutorial Series
          EFS Glossary
          Custom EFS Development Policy

          New User Orientation

          Comment

          Working...
          X