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 jaybedreamin, Today, 05:56 PM
      0 responses
      3 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      18 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      1 view
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      6 views
      0 likes
      Last Post Javierw.ok  
      Started by timmbbo, Today, 08:59 AM
      2 responses
      10 views
      0 likes
      Last Post bltdavid  
      Working...
      X