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

Multiple Time Frame and Bars Array

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

    Multiple Time Frame and Bars Array

    I am trying to trade from a MNQ chart using the price and indicator values from the NQ.
    MNQ is the primary series and NQ is the secondary series

    Question 1

    Will the code below reference the ADX indicator from the NQ and enter a trade on the MNQ?

    if ((BarsInProgress == 1)
    && (ADX1[0] < AdxValue))

    EnterLong(Convert.ToInt32(Contracts), Convert.ToString(EntryNameDtv));


    I was trying to use BarsArray under the primary series but was getting error messages compiling. I must not have defined the series properly.
    "ADX1 is a field but is used like a method"

    if ((BarsInProgress == 0)
    && (ADX1(BarsArray[1])[0] < AdxValue))

    I have reviewed the help guide on multiple time frames but I am missing something.

    I have been successful using an NQ chart as primary and entering the trades on the MNQ.
    But I would like to be able to see the indicators and manage the trade on one chart.
    Currently the indicators are on the NQ chart but if I want to manage the exit I have to do it on the MNQ chart.

    #2
    Hello sdauteil,

    Thank you for your post.

    You would have to specify the bars array to be used for the ADX when you assign the instance of it in State.DataLoaded for it to be calculated on the secondary NQ series:

    else if (State == State.DataLoaded)
    {
    ADX1 = ADX(BarsArray[1], myPeriod);

    }

    The issue would be that AddChartIndicator() will only work with indicators being plotted on the primary data series you have in your chart. So you could use the additional data series for the indicator for calculating your strategy logic, but you wouldn't be able to correctly add that to the chart from the strategy.

    You could add that data series within the hosted indicator, add that data series to the strategy as well, and have the indicator calculate on secondary data series and plot on primary.

    There's a note in our help guide regarding this:



    Please let us know if we may be of further assistance to you.


    Kate W.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by samish18, Today, 10:13 AM
    0 responses
    2 views
    0 likes
    Last Post samish18  
    Started by kenz987, Yesterday, 10:20 AM
    2 responses
    13 views
    0 likes
    Last Post kenz987
    by kenz987
     
    Started by nicthe, 08-23-2023, 07:53 AM
    7 responses
    196 views
    0 likes
    Last Post nicthe
    by nicthe
     
    Started by nicthe, Today, 09:24 AM
    0 responses
    5 views
    0 likes
    Last Post nicthe
    by nicthe
     
    Started by stalt, 12-28-2015, 01:36 PM
    6 responses
    1,536 views
    0 likes
    Last Post giulyko00  
    Working...
    X