Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

addplots to fib retracement drawing tools.

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

    addplots to fib retracement drawing tools.

    I am trying to add plot to an indicator that auto draw a fib retracement using the ninjatrader internal drawing tools. How do I go about in extracting the price level and set it to the plots so I can use it in a strategy?

    Are this the steps I need to take?

    1) under setdefault add...
    AddPlot(new Stroke(Brushes.Gray, DashStyleHelper.Dash, 1), PlotStyle.Line, "p1");
    AddPlot(new Stroke(Brushes.Gray, DashStyleHelper.Dash, 1), PlotStyle.Line, "p2");
    AddPlot(new Stroke(Brushes.Gray, DashStyleHelper.Dash, 1), PlotStyle.Line, "p3");
    AddPlot(new Stroke(Brushes.Gray, DashStyleHelper.Dash, 1), PlotStyle.Line, "p4");
    AddPlot(new Stroke(Brushes.Gray, DashStyleHelper.Dash, 1), PlotStyle.Line, "p5");
    AddPlot(new Stroke(Brushes.Gray, DashStyleHelper.Dash, 1), PlotStyle.Line, "p6");

    2) under onbarupdate, after draw fib, add...

    fib=Draw.FibonacciRetracements(this,"fib",IsAutoSc ale,barsSinceLow,Low[barsSinceLow],barsSinceHigh,High[barsSinceHigh]);
    ClearOutputWindow();
    foreach (PriceLevel p in fib.PriceLevels)
    {

    if (p.Value == 0)
    {
    p1[0] = p.GetPrice(fib.StartAnchor.Price, fib.EndAnchor.Price - fib.StartAnchor.Price, false);
    }

    if (p.Value == 23.6)
    {
    p2[0] = p.GetPrice(fib.StartAnchor.Price, fib.EndAnchor.Price - fib.StartAnchor.Price, false);
    }

    if (p.Value == 38.2)
    {
    p3[0] = p.GetPrice(fib.StartAnchor.Price, fib.EndAnchor.Price - fib.StartAnchor.Price, false);
    }

    if (p.Value == 50)
    {
    p4[0] = p.GetPrice(fib.StartAnchor.Price, fib.EndAnchor.Price - fib.StartAnchor.Price, false);
    }

    if (p.Value == 61.8)
    {
    p5[0] = p.GetPrice(fib.StartAnchor.Price, fib.EndAnchor.Price - fib.StartAnchor.Price, false);
    }

    if (p.Value == 76.4)
    {
    p6[0] = p.GetPrice(fib.StartAnchor.Price, fib.EndAnchor.Price - fib.StartAnchor.Price, false);
    }
    }


    this is what I get (attached images)

    I dont see the lvls on my price chart, I also see the gray lines where I assume the 23.6% lvl is, but not for any other levels.

    I assume I did something wrong here.
    Attached Files
    Last edited by ssjaznguy; 03-21-2021, 10:02 PM.

    #2
    Hello ssjaznguy,

    Thank you for your post.

    Please see the attached example script, PlotAndPrintFibRetracementValuesExample, which demonstrates how to plot each Fibonacci Retracement price level on a chart. It is important to note how the Plot properties are set up for each individual plot (p1 uses Values[0], p2 uses Values[1], p3 uses Values[2], etc..).

    See the help guide documentation below for more information.
    AddPlot - https://ninjatrader.com/support/help...t8/addplot.htm
    Fibonacci Retracements - https://ninjatrader.com/support/help...tracements.htm

    Let us know if we may assist further.
    Attached Files
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    661 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    376 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    110 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    574 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    580 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X