Announcement

Collapse
No announcement yet.

30 min stochastic on 5 min chart

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

  • 30 min stochastic on 5 min chart

    I am trying to test a system using 5 minute and 30 minute stochastics on a 5 minute chart. The problem is that, when backtesting, the 30 minute stochastic only changes once every 30 minutes, whereas in real time it changes continuously.
    Is it possible to get the 30 minute stochastic to update every 5 minutes with the latest value from the 5 minute bar?
    Any help would be greatly appreciated.

  • #2
    Hello dgberridge,

    On the historical bars EFS only processes completed bars as you have described. There isn't a method available that will drill down into segments of the 30 min bar to get at the data you're asking for. This type of process can only be written for real time processing. For back testing purposes you will only be able to evaluate the data on a completed bar basis. One way to handle this is to you look for BARSTATE_NEWBAR of the 30 minute interval and then evaluate trade conditions on the most recently completed 30 minute bar using getBarStateInterval("30"). At that instance look at the -1 bar value of the 30 minute series and compare it to the -1 bar value of the 5 minute series.

    If you want to evaluate your trade conditions on each 5 minute bar then you should compare the 0 bar value of the 5 minute series to the -1 bar value of the 30 minute series. Depending on how your conditions are written you could also look at the -1 bar value of the 5 minute series. In either case you should not do a comparison of the 0 bar value of the 30 minute series. If you were to compare the 0 bar value of the 30 minute series you will be creating a forward looking condition, which will generate unrealistic results. In other words, on the first 5 minute bar of a new 30 minute interval, the 0 bar value of the 30-minute interval is 25 minutes in the future compared to the first 5 minute bar.
    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
      Jason
      Many thanks for the reply. For a realistic test, I really need to test every 5 minutes with the value that the 30-minute stochastic would have at that time.
      I am now using a longer 5-minute stochastic as a substitute for the 30-minute stochastic with reasonable results. On a 5-minute chart, I find that 84-6-3 with a 5 minute interval is similar to the real-time 14-1-3 with a 30-minute interval.

      Comment

      Working...
      X