• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Obtaining values from a 3rd party indicator on the chart.

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

    Obtaining values from a 3rd party indicator on the chart.

    I am trying to get values from a 3rd party indicator, to use in a strategy I'm developing in NT8.
    Do I need to declare my own instance of the indicator in my strategy?
    Can I simply reference the 3rd party indicator (which is on the chart), to obtain values from it to determine actions?

    I get the following error when compiling my strategy in NT8:

    Cannot implicitly convert type 'NinjaTrader.NinjaScript.Indicators.ncatVolumeSpre adScalper' to 'NinjaTrader.NinjaScript.Indicators.Indicator'

    Portions of the code:
    ---------------------
    #region Variables
    Indicator myIndicator;
    #endregion

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    } else if (State == State.Configure)
    {
    myIndicator = ncatVolumeSpreadScalper("Enabled", "Enabled", "Enabled", "Enabled", 5, 20, 70, 25, 70, 200, 150, "19892", "Minutes", 5, false, 5);
    }
    }

    protected override void OnBarUpdate()
    {
    double ActiveHigh = (double)myIndicator.ActiveHigh[0];
    double LineBreakUp = (int)myIndicator.LinebreakUp[0];
    double LineBreakDown = (int)myIndicator.LinebreakDown[0];
    }

    #2
    Hello epete,

    Thanks for your post.

    ncatVolumeSpreadScalper would inherit from the Indicator class, but it has its own type which should not be confused with the type of Indicator. The indicator should be declared with its own type.

    As a best practice, we recommend to instantiate indicators in State.DataLoaded instead of referencing the indicator methods in OnBarUpdate. Indicators must also be programmed into the script to be accessed by the script. We would not advise searching through indicators on the chart to be used in your script.

    Performance Best Practices (See Referencing Indicator Methods) - https://ninjatrader.com/support/help...tm#Performance

    The Strategy Builder can be used to generate syntax for how we recommend to add and use indicators. If the indicator is compatible with the Strategy Builder, you could use this tool to add an indicator and then click View Code to see the resulting syntax. If it is not compatible, you could use the Strategy Builder to generate syntax for a system indicator and model your syntax off the generated code.

    Strategy Builder 301 - https://www.youtube.com/watch?v=HCyt90GAs9k

    Please let us know if we can be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      Can you provide the code needed to declare the indicator with its own type?

      Comment


        #4
        Hello epete,

        I do not have this indicator to verify, but you can observe the syntax for how other indicators are declared and you can use the Strategy Builder to create syntax if the indicator is supported in the Strategy Builder.

        Demo - https://drive.google.com/file/d/1F_J...w?usp=drivesdk

        I look forward to being of further assistance.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Jschmelz, Today, 04:45 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Marco  
        Started by sisenberg, Today, 08:06 PM
        1 response
        7 views
        0 likes
        Last Post sisenberg  
        Started by priceisking, Today, 07:44 PM
        0 responses
        5 views
        0 likes
        Last Post priceisking  
        Started by saltminer, Today, 06:06 PM
        0 responses
        5 views
        0 likes
        Last Post saltminer  
        Started by KennyK, Today, 05:25 PM
        0 responses
        7 views
        0 likes
        Last Post KennyK
        by KennyK
         
        Working...
        X