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

Why some of my indicators are not exposed to Strategy Builder

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

    Why some of my indicators are not exposed to Strategy Builder

    I have written a few indicators, and some are exposed (show up in the indicator list). I scanned over the past topics, and found some remarks over not supporting public variables (non plot ones). I have verified that my code don't include any public variables that are non plot. Any data I exposed outside is double, and uses either plot color or transparent color.

    The only difference I see between the one that show up is the number of variables, but I doubt it is the reason.

    Here are the wrapper code created by NT of the one that shows up (BWMACDBB) and one that doesn't (BWMSBase).

    1. BWMACDBB NT Auto Generate Wrapper Code which shows up in Strategy Builder:
    Code:
     namespace NinjaTrader.NinjaScript.Strategies
    {[INDENT]public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
    {[/INDENT][INDENT=2]public Indicators.BW4U.BWMACDBB BWMACDBB(int fastPeriod, int slowPeriod, int smothPeriod, double stdDevNumber)
    {[/INDENT][INDENT=3]return indicator.BWMACDBB(Input, fastPeriod, slowPeriod, smothPeriod, stdDevNumber);[/INDENT][INDENT=2]}
    
    public Indicators.BW4U.BWMACDBB BWMACDBB(ISeries<double> input , int fastPeriod, int slowPeriod, int smothPeriod, double stdDevNumber)
    {[/INDENT][INDENT=3]return indicator.BWMACDBB(input, fastPeriod, slowPeriod, smothPeriod, stdDevNumber);[/INDENT][INDENT=2]}[/INDENT][INDENT]}[/INDENT]
     }
    2. BWMSBase NT Auto Generate Wrapper Code which doesn't shows up in Strategy Builder:
    Code:
    namespace NinjaTrader.NinjaScript.Strategies
    {[INDENT]public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
    {[/INDENT][INDENT=2]public Indicators.BW4U.BWMSBase BWMSBase(int maxLookbackObjects, int swingStrength, bool useHighLowSwings, bool biasKeepLastBiasWhenZero, bool hTFUseChartBarType, BarsPeriodType hTFBarType, int hTFValue, int hTFValue2, int hTFBaseBarsPeriodValue, BiasRequirementType biasSTF1ReqTypeA, BiasRequirementType biasSTF1ReqTypeB, BiasRequirementType biasSTF1ReqTypeC, MovingAverageType biasSTF1MAFastType, int biasSTF1MAFastPeriod, MovingAverageType biasSTF1MASlowType, int biasSTF1MASlowPeriod, int biasSTF1MACDBBFastPeriod, int biasSTF1MACDBBSlowPeriod, int biasSTF1MACDBBSmothPeriod, double biasSTF1MACDBBStdDevNumber, BiasRequirementType biasSTF2ReqTypeA, BiasRequirementType biasSTF2ReqTypeB, BiasRequirementType biasSTF2ReqTypeC, MovingAverageType biasSTF2MAFastType, int biasSTF2MAFastPeriod, MovingAverageType biasSTF2MASlowType, int biasSTF2MASlowPeriod, int biasSTF2MACDBBFastPeriod, int biasSTF2MACDBBSlowPeriod, int biasSTF2MACDBBSmothPeriod, double biasSTF2MACDBBStdDevNumber, BiasRequirementType biasSTF3ReqTypeA, BiasRequirementType biasSTF3ReqTypeB, BiasRequirementType biasSTF3ReqTypeC, MovingAverageType biasSTF3MAFastType, int biasSTF3MAFastPeriod, MovingAverageType biasSTF3MASlowType, int biasSTF3MASlowPeriod, int biasSTF3MACDBBFastPeriod, int biasSTF3MACDBBSlowPeriod, int biasSTF3MACDBBSmothPeriod, double biasSTF3MACDBBStdDevNumber, BiasRequirementType biasHTF1ReqTypeA, BiasRequirementType biasHTF1ReqTypeB, BiasRequirementType biasHTF1ReqTypeC, MovingAverageType biasHTF1MAFastType, int biasHTF1MAFastPeriod, MovingAverageType biasHTF1MASlowType, int biasHTF1MASlowPeriod, int biasHTF1MACDBBFastPeriod, int biasHTF1MACDBBSlowPeriod, int biasHTF1MACDBBSmothPeriod, double biasHTF1MACDBBStdDevNumber, BiasRequirementType biasHTF2ReqTypeA, BiasRequirementType biasHTF2ReqTypeB, BiasRequirementType biasHTF2ReqTypeC, MovingAverageType biasHTF2MAFastType, int biasHTF2MAFastPeriod, MovingAverageType biasHTF2MASlowType, int biasHTF2MASlowPeriod, int biasHTF2MACDBBFastPeriod, int biasHTF2MACDBBSlowPeriod, int biasHTF2MACDBBSmothPeriod, double biasHTF2MACDBBStdDevNumber, BiasRequirementType biasHTF3ReqTypeA, BiasRequirementType biasHTF3ReqTypeB, BiasRequirementType biasHTF3ReqTypeC, MovingAverageType biasHTF3MAFastType, int biasHTF3MAFastPeriod, MovingAverageType biasHTF3MASlowType, int biasHTF3MASlowPeriod, int biasHTF3MACDBBFastPeriod, int biasHTF3MACDBBSlowPeriod, int biasHTF3MACDBBSmothPeriod, double biasHTF3MACDBBStdDevNumber)
    {[/INDENT][INDENT=3]return indicator.BWMSBase(Input, maxLookbackObjects, swingStrength, useHighLowSwings, biasKeepLastBiasWhenZero, hTFUseChartBarType, hTFBarType, hTFValue, hTFValue2, hTFBaseBarsPeriodValue, biasSTF1ReqTypeA, biasSTF1ReqTypeB, biasSTF1ReqTypeC, biasSTF1MAFastType, biasSTF1MAFastPeriod, biasSTF1MASlowType, biasSTF1MASlowPeriod, biasSTF1MACDBBFastPeriod, biasSTF1MACDBBSlowPeriod, biasSTF1MACDBBSmothPeriod, biasSTF1MACDBBStdDevNumber, biasSTF2ReqTypeA, biasSTF2ReqTypeB, biasSTF2ReqTypeC, biasSTF2MAFastType, biasSTF2MAFastPeriod, biasSTF2MASlowType, biasSTF2MASlowPeriod, biasSTF2MACDBBFastPeriod, biasSTF2MACDBBSlowPeriod, biasSTF2MACDBBSmothPeriod, biasSTF2MACDBBStdDevNumber, biasSTF3ReqTypeA, biasSTF3ReqTypeB, biasSTF3ReqTypeC, biasSTF3MAFastType, biasSTF3MAFastPeriod, biasSTF3MASlowType, biasSTF3MASlowPeriod, biasSTF3MACDBBFastPeriod, biasSTF3MACDBBSlowPeriod, biasSTF3MACDBBSmothPeriod, biasSTF3MACDBBStdDevNumber, biasHTF1ReqTypeA, biasHTF1ReqTypeB, biasHTF1ReqTypeC, biasHTF1MAFastType, biasHTF1MAFastPeriod, biasHTF1MASlowType, biasHTF1MASlowPeriod, biasHTF1MACDBBFastPeriod, biasHTF1MACDBBSlowPeriod, biasHTF1MACDBBSmothPeriod, biasHTF1MACDBBStdDevNumber, biasHTF2ReqTypeA, biasHTF2ReqTypeB, biasHTF2ReqTypeC, biasHTF2MAFastType, biasHTF2MAFastPeriod, biasHTF2MASlowType, biasHTF2MASlowPeriod, biasHTF2MACDBBFastPeriod, biasHTF2MACDBBSlowPeriod, biasHTF2MACDBBSmothPeriod, biasHTF2MACDBBStdDevNumber, biasHTF3ReqTypeA, biasHTF3ReqTypeB, biasHTF3ReqTypeC, biasHTF3MAFastType, biasHTF3MAFastPeriod, biasHTF3MASlowType, biasHTF3MASlowPeriod, biasHTF3MACDBBFastPeriod, biasHTF3MACDBBSlowPeriod, biasHTF3MACDBBSmothPeriod, biasHTF3MACDBBStdDevNumber);[/INDENT][INDENT=2]}
    
    public Indicators.BW4U.BWMSBase BWMSBase(ISeries<double> input , int maxLookbackObjects, int swingStrength, bool useHighLowSwings, bool biasKeepLastBiasWhenZero, bool hTFUseChartBarType, BarsPeriodType hTFBarType, int hTFValue, int hTFValue2, int hTFBaseBarsPeriodValue, BiasRequirementType biasSTF1ReqTypeA, BiasRequirementType biasSTF1ReqTypeB, BiasRequirementType biasSTF1ReqTypeC, MovingAverageType biasSTF1MAFastType, int biasSTF1MAFastPeriod, MovingAverageType biasSTF1MASlowType, int biasSTF1MASlowPeriod, int biasSTF1MACDBBFastPeriod, int biasSTF1MACDBBSlowPeriod, int biasSTF1MACDBBSmothPeriod, double biasSTF1MACDBBStdDevNumber, BiasRequirementType biasSTF2ReqTypeA, BiasRequirementType biasSTF2ReqTypeB, BiasRequirementType biasSTF2ReqTypeC, MovingAverageType biasSTF2MAFastType, int biasSTF2MAFastPeriod, MovingAverageType biasSTF2MASlowType, int biasSTF2MASlowPeriod, int biasSTF2MACDBBFastPeriod, int biasSTF2MACDBBSlowPeriod, int biasSTF2MACDBBSmothPeriod, double biasSTF2MACDBBStdDevNumber, BiasRequirementType biasSTF3ReqTypeA, BiasRequirementType biasSTF3ReqTypeB, BiasRequirementType biasSTF3ReqTypeC, MovingAverageType biasSTF3MAFastType, int biasSTF3MAFastPeriod, MovingAverageType biasSTF3MASlowType, int biasSTF3MASlowPeriod, int biasSTF3MACDBBFastPeriod, int biasSTF3MACDBBSlowPeriod, int biasSTF3MACDBBSmothPeriod, double biasSTF3MACDBBStdDevNumber, BiasRequirementType biasHTF1ReqTypeA, BiasRequirementType biasHTF1ReqTypeB, BiasRequirementType biasHTF1ReqTypeC, MovingAverageType biasHTF1MAFastType, int biasHTF1MAFastPeriod, MovingAverageType biasHTF1MASlowType, int biasHTF1MASlowPeriod, int biasHTF1MACDBBFastPeriod, int biasHTF1MACDBBSlowPeriod, int biasHTF1MACDBBSmothPeriod, double biasHTF1MACDBBStdDevNumber, BiasRequirementType biasHTF2ReqTypeA, BiasRequirementType biasHTF2ReqTypeB, BiasRequirementType biasHTF2ReqTypeC, MovingAverageType biasHTF2MAFastType, int biasHTF2MAFastPeriod, MovingAverageType biasHTF2MASlowType, int biasHTF2MASlowPeriod, int biasHTF2MACDBBFastPeriod, int biasHTF2MACDBBSlowPeriod, int biasHTF2MACDBBSmothPeriod, double biasHTF2MACDBBStdDevNumber, BiasRequirementType biasHTF3ReqTypeA, BiasRequirementType biasHTF3ReqTypeB, BiasRequirementType biasHTF3ReqTypeC, MovingAverageType biasHTF3MAFastType, int biasHTF3MAFastPeriod, MovingAverageType biasHTF3MASlowType, int biasHTF3MASlowPeriod, int biasHTF3MACDBBFastPeriod, int biasHTF3MACDBBSlowPeriod, int biasHTF3MACDBBSmothPeriod, double biasHTF3MACDBBStdDevNumber)
    {[/INDENT][INDENT=3]return indicator.BWMSBase(input, maxLookbackObjects, swingStrength, useHighLowSwings, biasKeepLastBiasWhenZero, hTFUseChartBarType, hTFBarType, hTFValue, hTFValue2, hTFBaseBarsPeriodValue, biasSTF1ReqTypeA, biasSTF1ReqTypeB, biasSTF1ReqTypeC, biasSTF1MAFastType, biasSTF1MAFastPeriod, biasSTF1MASlowType, biasSTF1MASlowPeriod, biasSTF1MACDBBFastPeriod, biasSTF1MACDBBSlowPeriod, biasSTF1MACDBBSmothPeriod, biasSTF1MACDBBStdDevNumber, biasSTF2ReqTypeA, biasSTF2ReqTypeB, biasSTF2ReqTypeC, biasSTF2MAFastType, biasSTF2MAFastPeriod, biasSTF2MASlowType, biasSTF2MASlowPeriod, biasSTF2MACDBBFastPeriod, biasSTF2MACDBBSlowPeriod, biasSTF2MACDBBSmothPeriod, biasSTF2MACDBBStdDevNumber, biasSTF3ReqTypeA, biasSTF3ReqTypeB, biasSTF3ReqTypeC, biasSTF3MAFastType, biasSTF3MAFastPeriod, biasSTF3MASlowType, biasSTF3MASlowPeriod, biasSTF3MACDBBFastPeriod, biasSTF3MACDBBSlowPeriod, biasSTF3MACDBBSmothPeriod, biasSTF3MACDBBStdDevNumber, biasHTF1ReqTypeA, biasHTF1ReqTypeB, biasHTF1ReqTypeC, biasHTF1MAFastType, biasHTF1MAFastPeriod, biasHTF1MASlowType, biasHTF1MASlowPeriod, biasHTF1MACDBBFastPeriod, biasHTF1MACDBBSlowPeriod, biasHTF1MACDBBSmothPeriod, biasHTF1MACDBBStdDevNumber, biasHTF2ReqTypeA, biasHTF2ReqTypeB, biasHTF2ReqTypeC, biasHTF2MAFastType, biasHTF2MAFastPeriod, biasHTF2MASlowType, biasHTF2MASlowPeriod, biasHTF2MACDBBFastPeriod, biasHTF2MACDBBSlowPeriod, biasHTF2MACDBBSmothPeriod, biasHTF2MACDBBStdDevNumber, biasHTF3ReqTypeA, biasHTF3ReqTypeB, biasHTF3ReqTypeC, biasHTF3MAFastType, biasHTF3MAFastPeriod, biasHTF3MASlowType, biasHTF3MASlowPeriod, biasHTF3MACDBBFastPeriod, biasHTF3MACDBBSlowPeriod, biasHTF3MACDBBSmothPeriod, biasHTF3MACDBBStdDevNumber);[/INDENT][INDENT=2]}[/INDENT][INDENT]}[/INDENT]
      }

    #2
    Hello Shai Samuel,

    Thank you for your post.

    As long as your indicator has a plot added, that indicator will be an option in the Strategy Builder. For more information about AddPlot():



    I have created an IndicatorPlotExample script that adds a plot called ExamplePlot. If you import this script via Control Center > Tools > Import > NinjaScript Addon, you will be able to see the indicator from the Strategy Builder in the Indicators list. The wrapper code is not related to the availability of an indicator from within the Strategy Builder, it is used to create the indicator constructors and work with cached indicators. Please verify that the indicators you are looking to use in the Strategy Builder do indeed have plots added.

    Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      Thank for your response Emily.

      Yes, I do have plots. See the code below.

      To check if it is making any difference, I did change one of the plots from transparent to gold, and there was no difference.

      I guess there is a different reason.

      Code:
      #region #### Plot Functions ####
      protected int AddChartPlot(Brush brush, string name)
      {
      return AddChartPlot(new Stroke(brush), name);
      }
      
      protected int AddChartPlot(Stroke stroke, string name, PlotStyle plotStyle = PlotStyle.Line)
      {
      if (stroke==null) Print("***** stroke=null !!! StrokeInit() was not called !!! *****");
      
      AddPlot(stroke, plotStyle, name);
      int plotInx = Plots.Count()-1;
      
      return plotInx;
      }
      #endregion
      
      
      ...
      
      
      private void PlotsSetup()
      {
      Stroke StrokeTransparent = new Stroke(Brushes.Transparent);
      ShowTransparentPlotsInDataBox = true;
      
      plotCurBar_STF = AddChartPlot(StrokeTransparent, "CurBar_STF");
      plotSwingBar_STF = AddChartPlot(StrokeTransparent, "SwingBar_STF");
      plotSwingVal_STF = AddChartPlot(new Stroke(Brushes.Gold), "SwingVal_STF");
      plotSwingLen_STF = AddChartPlot(StrokeTransparent, "SwingLen_STF");
      plotWavePoint_STF = AddChartPlot(StrokeTransparent, "WavePoint_STF");
      plotCurBar_HTF = AddChartPlot(StrokeTransparent, "CurBar_HTF");
      plotSwingBar_HTF = AddChartPlot(StrokeTransparent, "SwingBar_HTF");
      plotSwingVal_HTF = AddChartPlot(StrokeTransparent, "SwingVal_HTF");
      plotSwingLen_HTF = AddChartPlot(StrokeTransparent, "SwingLen_HTF");
      plotWavePoint_HTF = AddChartPlot(StrokeTransparent, "WavePoint_HTF");
      plotShowedBias = AddChartPlot(StrokeTransparent, "ShowedBias");
      }
      
      ...
      
      #region State.Configure
      case State.Configure:
      AddHigherTimeFrame();
      // Plots
      PlotsSetup();
      break;
      #endregion
      Last edited by Shai Samuel; 08-26-2022, 12:35 AM.

      Comment


        #4
        Hello Shai Samuel,

        Thank you for your patience.

        It appears my example did not properly attach to my previous reply. I have attached it here for your reference.

        IndicatorPlotExample_NT8.zip

        This example "IndicatorPlotExample" shows how adding a plot would be done. If you have a specific question on this, please modify the example to illustrate.

        Please let me know if I may be of further assistance.
        Emily C.NinjaTrader Customer Service

        Comment


          #5
          Thank you Emily,

          It turns out I was using the form of AddPlot using Stroke. As soon as i switched to the form using brush, it showed up in Strategy Builder.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Segwin, 05-07-2018, 02:15 PM
          14 responses
          1,789 views
          0 likes
          Last Post aligator  
          Started by Jimmyk, 01-26-2018, 05:19 AM
          6 responses
          837 views
          0 likes
          Last Post emuns
          by emuns
           
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          6 responses
          3,293 views
          1 like
          Last Post jgualdronc  
          Started by Touch-Ups, Today, 10:36 AM
          0 responses
          13 views
          0 likes
          Last Post Touch-Ups  
          Started by geddyisodin, 04-25-2024, 05:20 AM
          11 responses
          63 views
          0 likes
          Last Post halgo_boulder  
          Working...
          X