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 jxs_xrj, 01-12-2020, 09:49 AM
        6 responses
        3,290 views
        1 like
        Last Post jgualdronc  
        Started by Touch-Ups, Today, 10:36 AM
        0 responses
        9 views
        0 likes
        Last Post Touch-Ups  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        11 responses
        62 views
        0 likes
        Last Post halgo_boulder  
        Started by Option Whisperer, Today, 09:55 AM
        0 responses
        8 views
        0 likes
        Last Post Option Whisperer  
        Started by halgo_boulder, 04-20-2024, 08:44 AM
        2 responses
        25 views
        0 likes
        Last Post halgo_boulder  
        Working...
        X