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

Data from different time frame same instrument

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

    Data from different time frame same instrument

    Hi;
    I am trying to get the average daily range of an instrument and use the number in a calculation on an intraday time frame of the same instrument to then plot a line.

    I have:
    in variables - private DataSeries drange;
    in initialize - Add(PeriodType.Day, 1); but I don't know how to reference this to calculate the daily range then store it as a series.
    drange = new DataSeries(this);

    What do I do in OnBarUpdate to get the 20 day average range? - It only needs to be calculated at the start of the session and then remain constant till the next session but the rest of my indicator updates on each tick.

    I have tried something like

    double range = SMA(Drange, Rangeperiod);

    with various calculations before hand but nothing seems to give me my value - I then plan to use it for something like

    targetup = SessionOpen + range

    I obviously cant get it to plot - can anybody point me in the right direction please Kooganam/Sledge et al !!

    Thanks in advance.

    #2
    Hello StockTraderBmp,

    Thank you for your post.

    I have attached a sample script that will show you how to calculate the Range of the Daily DataSeries and then plot that value.

    You will need to download and import into NinjaTrader.

    To Import

    * Download the indicator to your desktop, keep them in the compressed .zip file.
    * From the Control Center window select the menu File> Utilities> Import NinjaScript
    * Select the downloaded .zip file
    * NinjaTrader will then confirm if the import has been successful.


    Critical - Specifically for some indicators, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'

    Let me know if I can be of further assistance.
    Attached Files
    Cal H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by WeyldFalcon, 12-10-2020, 06:48 PM
    14 responses
    1,427 views
    0 likes
    Last Post Handclap0241  
    Started by Barry Milan, Today, 10:35 PM
    0 responses
    6 views
    0 likes
    Last Post Barry Milan  
    Started by DJ888, Yesterday, 06:09 PM
    2 responses
    9 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    40 views
    0 likes
    Last Post jeronymite  
    Started by bill2023, Today, 08:51 AM
    2 responses
    16 views
    0 likes
    Last Post bill2023  
    Working...
    X