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

AddChartIndicator in Strategy for Backtesting

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

    AddChartIndicator in Strategy for Backtesting

    Hi,
    first, my engish is far from perfect.

    i created an indicator, had some troubles but is solved all of them.
    The Indicator has multiple Plots, multble Timeframes and 13 Parameters.
    On some Situations, i will print a Dot as Symbol for Creating an Order to validate the Indicator.

    So i created a Strategy for Backtesting and i integrate the Indicator.
    And here starts my troubles
    I take Strategy "SampleMACrossOver" from NinjaTrade to check how it works.
    My Code:
    Code:
     public class StrategyIndicatorTest : Strategy
    {
    private NinjaTrader.NinjaScript.Indicators._Labandowsky_Indicator indikator;
    
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Strategy here.";
    Name = "StrategyIndicatorTest";
    // This strategy has been designed to take advantage of performance gains in Strategy Analyzer optimizations
    // See the Help Guide for additional information
    IsInstantiatedOnEachOptimizationIteration = false;
    }
    else if (State == State.DataLoaded)
    {
    indikator = new NinjaTrader.NinjaScript.Indicators._Labandowsky_Indicator(5, 25, 30, 35, 40, 45, 50, 55, 150, 60, 60, 200, 200); //// Error
    
    AddChartIndicator(indikator);
    }
    else if (State == State.Configure)
    {
    AddDataSeries("BTCUSD", Data.BarsPeriodType.Second, 1, Data.MarketDataType.Last);
    }
    }
    Error: NinjaTrader.NinjaScript.Indicators._Labandowsky_In dicator has no ctor with 13 parameters (CS1729)

    But in intellisense, all Parameters are shown, also in the code of the Indicator are 13 Parameters. I have no idea how i can solve this Problem.

    Can you help me with this Problem?
    Last edited by SpikeLGWG; 02-22-2021, 12:21 AM.

    #2
    Hello SpikeLGWG,

    The new keyword should not be used for indicators.
    Is _Labandowsky_Indicator an indicator or is this is custom class?
    If this is an indicator, remove the new keyword.

    May we have a screenshot of the Intelliprompt showing the overload signature for this?
    Put the cursor just in side the parenthesis, then on the keyboard hold Ctrl + Shift + Space. Then hit the Print Scr(een) button, last open MS Paint and click Edit -> Paste.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      haha,
      yes, it was the new Keyword.
      Click image for larger version  Name:	has_no_ctro.jpg Views:	0 Size:	100.8 KB ID:	1142953
      no, the compiletime error is solved and the indicator is called (i make some Printstatements in the indikator).

      // Edit
      this Issue is solved, i create a new Post for the next.
      Last edited by SpikeLGWG; 02-22-2021, 12:44 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Vietanhnguyen2hotmailcom, Yesterday, 10:29 AM
      4 responses
      23 views
      0 likes
      Last Post Vietanhnguyen2hotmailcom  
      Started by PhillT, 04-19-2024, 02:16 PM
      4 responses
      35 views
      0 likes
      Last Post PhillT
      by PhillT
       
      Started by ageeholdings, 05-01-2024, 05:22 AM
      5 responses
      37 views
      0 likes
      Last Post ageeholdings  
      Started by reynoldsn, Today, 02:34 PM
      0 responses
      13 views
      0 likes
      Last Post reynoldsn  
      Started by nightstalker, Today, 02:05 PM
      0 responses
      23 views
      0 likes
      Last Post nightstalker  
      Working...
      X