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

Extending Stochastics not working when used in strategy AddChartIndicator

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

    Extending Stochastics not working when used in strategy AddChartIndicator

    I extended the built in indicator Stochastics to create a new indicator called StochasticsExtended.
    It works as expected when put on a chart as an indicator.
    However, when I try to use it in a strategy it fails to compile.

    See attached indicator and strategy that demonstrate this issue.

    Can you determine what is wrong here?

    Thanks,
    Gary Albers
    Attached Files

    #2
    Hello GaryAlbers,

    You are attempting to set many variables (that I think are inputs) that are not defined.

    Take a look at the compile errors and read what they are telling you.
    What do these say? (Please feel free to provide the text of the error message when you post so that this can be part of the discussion. The errors messages themselves are usually the most informative part about fixing an error.)

    PeriodD, PeriodK, and Smooth all need to be defined.

    I recommend starting with the Strategy Builder to create your inputs and basic logic. Then when any math or debugging is needed create a copy of the script and the unlock and manually code the copy.

    Below is a public link to a forum post with helpful information about getting started with NinjaScript.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      You are referring to code in the indicator which compiles fine because of the class declaration:
      Code:
      public class StochasticsExtended : Stochastics
      My indicator extends your Stochastics indicator and therefore those variables do not need to be declared in my code.

      The compilation error is in the strategy on line 59:
      Code:
      stochastic = StochasticsExtended();
      The compilation error text is:
      'NinjaTrader.NinjaScript.Indicators.StochasticsExt ended' is a 'type' but is used like a 'variable'.
      Can you please look a bit closer at the code?

      Gary
      Last edited by GaryAlbers; 12-24-2018, 08:30 PM.

      Comment


        #4
        Hello GaryAlbers,

        Extending another indicator class is not supported by NinjaTrader Support. (You may have trouble with the NinjaTrader Generated code which is looking for keywords in the script and you may have difficulties exporting)

        This thread will remain open for any community members that would like to assist with this undocumented/unsupported code.

        You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.


        There are no overload methods created to call your script with the inputs defined as there is no NinjaTrader generated code at the bottom.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by trilliantrader, 04-18-2024, 08:16 AM
        4 responses
        18 views
        0 likes
        Last Post trilliantrader  
        Started by mgco4you, Today, 09:46 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by wzgy0920, Today, 09:53 PM
        0 responses
        9 views
        0 likes
        Last Post wzgy0920  
        Started by Rapine Heihei, Today, 08:19 PM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by Rapine Heihei, Today, 08:25 PM
        0 responses
        10 views
        0 likes
        Last Post Rapine Heihei  
        Working...
        X