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 Timeframes in Strategy Builder . . .

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

    Multiple Timeframes in Strategy Builder . . .

    I am working on building a strategy, but want to use a Longer Term indicator in addition to the Current Timeframe indicator.
    I am not clear on how to get this to work correctly and display on my chart. Say I am looking at SMA 50 for a 5 minute timeframe
    as my base, but also want to see the 15 minute SMA 50 displayed on my chart.

    Would I be better off coding an Indicator and using that in my Strategy, or can I do more than one timeframe in a Strategy?

    Thanks for the support.

    #2
    Hello ATMtrader0001,

    Thanks for your post.

    While you can certainly add a 15 minute data series and can use the SMA(50) of that data series in your strategy, you would not be able to plot that data series on the chart from the strategy builder.

    What I would suggest is adding the data series in the strategy builder and using it in your conditions.

    To see the indicator on the chart, I would add the 15 minute data series to the chart, (as a hidden data series) then apply a 50 period SMA to the hidden data series to display on the 5 minute chart. here is a link to a short video that walks through the process of adding a higher time frame and indicator and then hiding the data series: https://www.youtube.com/watch?v=XRGx...UEYKym&index=3
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Maybe I wasn't clear, I am not using the Strategy Builder (too limiting), but writing my own strategy code.

      Does that make a difference?

      Comment


        #4
        Hello ATMtrader0001,

        Thanks for your reply.

        My reply to you was based on the topic title of, "Multiple Timeframes in Strategy Builder . . .".

        However, no worries and thanks for clarifying that you are working directly in Ninjascript.

        Using the Ninjascript wizard, you can select new strategy and work through that to add the higher time frame as well as set up the plot needed (the wizard will create the structure for you).
        Then in the code section you can add a check to ensure you have enough bars loaded for each data series and then set it so that you plot only when BarsInProgress ==0 as this would be the chart bars and you would only want to plot when those bars call OnBarUpdate(). You would need to assign the higher time frame as the input to the SMA, for example: MyPlot[0] = SMA(Closes[1], 50)[0]; // assign the value of the 50 period SMA from the first added data series to the plot.

        Here is a link to the various wizards if you have not used them: https://ninjatrader.com/support/help...?ns_wizard.htm

        We also recommend a good review of this section of the help guide for multi time frame considerations: https://ninjatrader.com/support/help...nstruments.htm

        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by frankthearm, Today, 09:08 AM
        7 responses
        30 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by NRITV, Today, 01:15 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by maybeimnotrader, Yesterday, 05:46 PM
        5 responses
        25 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by quantismo, Yesterday, 05:13 PM
        2 responses
        18 views
        0 likes
        Last Post quantismo  
        Started by adeelshahzad, Today, 03:54 AM
        5 responses
        33 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X