Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Need help with multiple plots displacement in one indicator

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

    Need help with multiple plots displacement in one indicator

    I am programming an indicator that uses three plots, and each of them has different displacement(offset) parameters.

    My code is as follows

    Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "Plot0"));
    Displacement = var1;
    Plots[0].Pen.Width = 2;
    Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "Plot1"));
    Displacement = var2;
    Plots[1].Pen.Width = 2;
    Add(new Plot(Color.FromKnownColor(KnownColor.Blue), PlotStyle.Line, "Plot2"));
    Displacement = var3;
    Plots[2].Pen.Width = 2;

    Displacement values for the third plot is greater than the other two plots. When I plot the indicator, it is using the highest value of displacement for the other two as well.

    Also from some previous threads on this forum I have read about offsetting indicator values by price (link is below)
    http://www.ninjatrader.com/support/f...ad.php?t=40838

    I will appreciate your help
    Thanks

    #2
    sherazwaqar, welcome to our forums here. Displacement is done on a per indicator and not per plot basis.
    You could either use different indicators or offset the dataseries value being plotted as outlined in the thread, for example don't plot the current value now, but the value from 2 bars back.

    Plot0.Set(myValue[2])

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    152 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    89 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    131 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    127 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    107 views
    0 likes
    Last Post CarlTrading  
    Working...
    X