Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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])
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by benmarkal, Yesterday, 12:52 PM
    3 responses
    22 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by helpwanted, Today, 03:06 AM
    1 response
    17 views
    0 likes
    Last Post sarafuenonly123  
    Started by Brevo, Today, 01:45 AM
    0 responses
    11 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    6 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    244 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Working...
    X