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

Extract third-party indicator data.

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

    Extract third-party indicator data.

    public partial class Atrapados : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
    {

    private mzFootprint MzFlow;
    private mzVolumeDelta MzDelta;

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Escriba la descripción de su nuevo Indicador personalizado aquí.";
    Name = "Atrapados";
    Calculate = Calculate.OnEachTick;
    IsOverlay = false;
    DisplayInDataBox = true;
    DrawOnPricePanel = true;
    DrawHorizontalGridLines = true;
    DrawVerticalGridLines = true;
    PaintPriceMarkers = true;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    //Disable this property if your indicator requires custom values that cumulate with each new market data event.
    //See Help Guide for additional information.
    IsSuspendedWhileInactive = true;
    }
    else if (State == State.Configure)
    {
    }
    else if (State == State.DataLoaded)
    {
    }
    }

    protected override void OnBarUpdate()
    {
    //if (CurrentBars[0] < 1)
    // return;

    if (MzFlow != null && MzDelta != null)
    {
    double mzDeltaValue = MzDelta.__Volume[0];
    var mzFlowValue = MzFlow.AbsoprtionResistanceZoneSound[0];
    Print("MzFlow Value: " + mzFlowValue);
    Print("MzDelta Value: " + mzDeltaValue);
    }


    }​
    }​
    Could you help me extract the data, I get a call error in OnBarUpdate, reference to an object not established
    Last edited by franatas; 09-07-2023, 11:45 AM.

    #2
    Hello franatas,

    Thank you for your post.

    When working with third-party indicators, it is up to the developer to decide what is and is not exposed for use in other scripts. You should be able to access any public plots created in the script, but other values are not guaranteed to be available from other scripts. For more info on using 3rd party indicators:


    To determine which line of code is causing the error, you could add print statements every couple of lines of code and identify which print is the last to send to the NinjaScript Output window prior to the error. This could help to narrow down which value is coming back null (object reference not set to an instance of an object) and help you to debug/troubleshoot further. You could add checks for null references to help prevent this type of error, but as far as accessing the values from the third-party script you may need to reach out to the developer for more info on what values are and are not exposed. We have a page about checking for null references here::


    Thank you for using NinjaTrader.
    Emily C.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    5 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    14 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    13 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,982 views
    3 likes
    Last Post jhudas88  
    Working...
    X