Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi Timeframe - Limiting No. of Bars to Process

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

    Multi Timeframe - Limiting No. of Bars to Process

    For Context: I am new to the C# language but have many years in programming procedural languages and, more recently, some experience in Java Script (relating to the eSignal charting environment).

    My Query: I am developing a (somewhat complex) indicator designed to plot in a 1Minute timeframe. I now wish to add some logic to compare the current price to both the 50 & 200day SMAs. However, I don't wish to have to process 200 days worth of 1 minute bars just to get the 200 day SMA. My current understanding is restricted to knowing how to (simply) Add() the .Day series for the instrument.

    How would I best achieve my requirement? A few lines of sample code please.

    Many thanks. G

    #2
    Hello Griesha_uk,

    Thanks for your post and welcome to the forums.

    To get a 200 day and 50 day moving average you need to have more than 200 days of daily data to process. As this would be on a 1 minute chart indeed you would have a lot of minute bars to process (at least 288,000!!).

    What might be more efficient would be to capture the 200 period and 50 period values off of a daily chart with an indicator that could write that indicator's current day 200 and 50 moving average values to a text file, then have an another indicator on the 1 minute chart read that file and plot a horizontal line to represent each plot. I suspect you are not expecting these lines to change significantly during the intraday session so you could read them just once on say the session break.

    We have a working example of read and write indicators here:
    http://ninjatrader.com/support/forum...ead.php?t=3475
    http://ninjatrader.com/support/forum...ead.php?t=3476

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    596 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    343 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    556 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    554 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X