Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add indicator based on Additional Bars to Primary Bars

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

    Add indicator based on Additional Bars to Primary Bars

    For example I have in Strategy

    Code:
    protected override void Initialize() 
    {
        Add(PeriodType.Minute, 3);
        Add(SMA(20));
    }
    if I'll add this strategy to 1 minutes chart... SMA will be based on 1 minute chart. Is it possible to display also SMA based on 3 minutes chart?

    In OnBarUpdate method we can write something like SMA(BarsArray[1], 20) to get value based on 3 minutes chart, but in Initialize method I can't write Add(SMA(BarsArray[1], 20)).

    PS: sorry, wrong section... need move it to Strategy Development
    Last edited by vadzim; 05-07-2015, 06:49 PM. Reason: wrong section... need move it to Strategy Development

    #2
    Hello vadzim,

    Thanks for your post.

    You are correct, the added indicator would be shown on the charts base period. You are adding a second dataseries to your strategy so that the strategy can use the (in this case) higher time frame.

    To display on a chart an SMA based on another period, you would actually need to add another data series to the chart and refer the SMA to the second dataseries. Here is a link to a video that goes through the steps to add a second data series, add the indicator, set the indicator to the second data series and then hide the second data series leaving only the indicator from the second data series on the primary series on the chart: https://www.youtube.com/watch?v=x_6B...A14C398CA140D7
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank you Paul...

      but I guess it's not possible to do such things as on video in strategy code, right?

      Comment


        #4
        Hello,

        Thanks for your reply.

        Correct.
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by GussJ, 03-04-2020, 03:11 PM
        15 responses
        3,271 views
        0 likes
        Last Post xiinteractive  
        Started by Tim-c, Today, 02:10 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Taddypole, Today, 02:47 PM
        0 responses
        2 views
        0 likes
        Last Post Taddypole  
        Started by chbruno, 04-24-2024, 04:10 PM
        4 responses
        51 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        10 responses
        403 views
        1 like
        Last Post beobast
        by beobast
         
        Working...
        X