Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by jaybedreamin, Today, 05:56 PM
    0 responses
    3 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    18 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    1 view
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    6 views
    0 likes
    Last Post Javierw.ok  
    Started by timmbbo, Today, 08:59 AM
    2 responses
    10 views
    0 likes
    Last Post bltdavid  
    Working...
    X