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

Strategy shows in NinjaScript Explorer but not on the chart's list

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

    Strategy shows in NinjaScript Explorer but not on the chart's list

    Hi,
    In converting a NT 7 strategy to NT 8, everything compiles and the strategy shows up in the NinjaScript Explorer but not on the chart drop down list.

    I have the following as part of the OnStateChange():
    Code:
    protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    Description    = @"Enter Strategy Description";
                    Name        = "MyCustomStrategyName";
                    
                    Calculate                                   = Calculate.OnPriceChange;
                    IsEnabled = true;
                    EntriesPerDirection                            =    1;
                    IsInstantiatedOnEachOptimizationIteration     = false;
                    MaximumBarsLookBack                         = MaximumBarsLookBack.Infinite;
                    IsExitOnSessionCloseStrategy                = true;
                    ExitOnSessionCloseSeconds                     = 900;
                    SetStopLoss(CalculationMode.Ticks,20);
                    
                }
                else if (State == State.DataLoaded)
                {
                    cumProfitSeries                             = new Series<double>(this);
                }
            }
    I reviewed the help guide about OnStateChange() and didn't understand it all, so wonder if this is where the problem is causing the strategy not to show.

    Also, can you explain why the difference in these:
    Description = @"Enter Strategy Description";
    Name = "MyCustomStrategyName";
    and

    Description = NinjaTrader.Custom.Resource.NinjaScriptStrategyDes criptionSampleMACrossOver;
    Name = NinjaTrader.Custom.Resource.NinjaScriptStrategyNam eSampleMACrossOver;
    Thanks

    #2
    Hello,

    Thank you for posting.

    Can you tell me are you seeing any errors in either the Log tab of the control center or the Output Window?

    The included NinjaScript files will have NinjaTrader.Custom.Resource. for strings, this is for localization. you would not need to use NinjaTrader.Custom.Resource in your code or public properties. The way you have the Name now should be correct.

    If you are not seeing errors, could you provide the script its self or a complete view of the script?

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

    Comment


      #3
      Thanks Jesse for the prompt response. The problem was caused by the SetStopLoss being in the State.SetDefaults, so I placed it in State.Configure.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by ScottW, Today, 06:09 PM
      0 responses
      2 views
      0 likes
      Last Post ScottW
      by ScottW
       
      Started by Board game geek, 10-29-2023, 12:00 PM
      14 responses
      244 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Waxavi, 04-19-2024, 02:10 AM
      4 responses
      56 views
      0 likes
      Last Post sonia0101  
      Started by cmtjoancolmenero, Today, 03:58 PM
      0 responses
      9 views
      0 likes
      Last Post cmtjoancolmenero  
      Started by Segwin, 05-07-2018, 02:15 PM
      11 responses
      1,779 views
      0 likes
      Last Post aligator  
      Working...
      X