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 cre8able, Yesterday, 01:16 PM
    3 responses
    11 views
    0 likes
    Last Post cre8able  
    Started by Harry, 05-02-2018, 01:54 PM
    10 responses
    3,203 views
    0 likes
    Last Post tharton3  
    Started by ChartTourist, Today, 08:22 AM
    0 responses
    6 views
    0 likes
    Last Post ChartTourist  
    Started by LiamTwine, Today, 08:10 AM
    0 responses
    2 views
    0 likes
    Last Post LiamTwine  
    Started by Balage0922, Today, 07:38 AM
    0 responses
    5 views
    0 likes
    Last Post Balage0922  
    Working...
    X