Announcement

Collapse
No announcement yet.

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 NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      56 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      133 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      73 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      45 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X