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

    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.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        60 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        39 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        19 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        21 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        51 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X