Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi-timeframe only show last bar

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

    Multi-timeframe only show last bar

    Hello,

    I am writing a multi-timeframe strategy. I basically have the strategy running on a minute interval. In the strategy I have added the 5,15,30,60,120,240,480 minute and 1 day timeframes.

    When I run the script it loads all data based on the 1 minute interval. So far so good. But I would only like to see the data of the most current 1 minute bar.

    Right now I loads 200 days of 1 minute data which is fine because I need to calculate indicator values for the different timeframes up to the daily (200 sma daily).

    I would like to write the values into a textfile which also works fine but now it write every single minute data row into the textfile.

    I am only interested in the value of the last 1 minute bar for all 9 timeframes.

    So I would like to know what the 1,5,15,30,60,120,240,480 minute and daily 20/50/200 simple moving averages are for the most current 1 minute bar.

    I figured I would just use something like
    Code:
     if DateTime.Now.ToString() == Time[0].ToSTring()
    but that doesnt work if you run the strategy in the weekend

    Anybody got any ideas?

    Again, I don't want to know the historical simple moving average values. Just for the current state. But I need to load all days because I use multitimeframes in one script.

    Love to hear suggestions.

    Thanks!

    #2
    I might have a solution. What if I put
    Code:
     if (Historical) { return; }
    at the top of my script. Now, when I load up the strategy it should not run for historical data right? And just write values for the next realtime value that comes up?

    Comment


      #3
      Hello siroki,

      Thank you for your post.

      That is correct, using Historical you can check to make sure the code only processes on real-time data.

      For information on Historical please visit the following link: http://www.ninjatrader.com/support/h...historical.htm

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      648 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      574 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X