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 NullPointStrategies, Today, 05:17 AM
    0 responses
    53 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    70 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X