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 Shansen, 08-30-2019, 10:18 PM
    25 responses
    949 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by JonesJoker, 04-22-2024, 12:23 PM
    8 responses
    41 views
    0 likes
    Last Post JonesJoker  
    Started by timko, Today, 06:45 AM
    0 responses
    3 views
    0 likes
    Last Post timko
    by timko
     
    Started by Waxavi, 04-19-2024, 02:10 AM
    2 responses
    39 views
    0 likes
    Last Post poeds
    by poeds
     
    Started by chbruno, Yesterday, 04:10 PM
    1 response
    44 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X