Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding Indicator Plot on Secondary Time Series

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

    Adding Indicator Plot on Secondary Time Series

    Hi,

    I'm trying to add a daily indicator to a 30 minute chart through a strategy. I searched the forum for help and found a post on adding a plot and then setting Values[0][0] in OnBarUpdate and from that, I can get an SMA to work just fine. The problem is when I try to use the Swing indicator, it no longer works. It prints dots on the chart but they aren't accurate.

    Code:

    Code:
    if (State == State.SetDefaults)
    {​
    AddPlot(new Stroke(Brushes.Blue), PlotStyle.Dot, "DAILYSWING");
    }
    
    else if (State == State.Configure)
    {
    AddDataSeries(BarsPeriodType.Second, 15);
    AddDataSeries(BarsPeriodType.Day, 1);
    }​
    
    if (BarsInProgress == 0)
    {​
    Values[0][0] = Low[Math.Max(0, Swing(BarsArray[2], 2).SwingLowBar(0, 1, 1000))];
    }
    
    #region Properties
    [Browsable(false)]
    [XmlIgnore]
    public Series<double> DAILYSWING
    {
    get { return Values[0]; }
    }
    #endregion​
    If I just use "Values[0][0] = SMA(BarsArray[2], 50)[0]" instead, the SMA looks perfect.

    Any idea why? Appreciate any insight.

    #2
    Hello fiddich,

    The swing indicator would be an exception because it re writes past data to its plots so replotting it would result in different values. You can use its custom methods however those just find the swing instances after the fact, that wouldn't be helpful to plot it as it calculates. To incorporate the swing and a plot it you would essentially need to copy the swings code into your script and process it on the daily bars. You could have it plot values however the plots have the number of primary bar slots so it would not be the same as you would see it on a daily chart and you would need to make additional logic to carry over past values to new bars on the lower timeframe series.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    93 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    138 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    123 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    73 views
    0 likes
    Last Post PaulMohn  
    Working...
    X