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

Newly Created Strategies Not Showing Up in List

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

    Newly Created Strategies Not Showing Up in List

    I have recently created a few strategies that are not in the list when I attempt to add them to the chart. They are visible and editable from Editor, and they are in the bin/custom/Strategies folder, but not in the list to be loaded. What could be the problem?

    Also, I moved some older strategies out of the bin/custom/Strategies folder in an attempt to archive them and clean up my strategies list, but the strategies I moved still show up in the list and I can still add them to the charts. What am I doing wrong?

    Thanks in advance!

    #2
    Well, I found out what the problem was. See below if you care to.

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {

    //SMA1 = SMA(Close, 14); //This, uncommented, prevented this strategy from showing up in the list to be added to a chart.
    //SMA2 = SMA(Close, 28); //This, uncommented, prevented this strategy from showing up in the list to be added to a chart.

    Comment


      #3
      Hello Trader146,

      Thanks for your notes.

      Indicator objects, such as "private SMA SMA1;" should be instantiated in OnStateChange() when the State == State.DataLoaded, not in State.SetDefaults.

      See the SampleMACrossOver reference sample that comes default with NinjaTrader for an example of this.

      To view the script open a New > NinjaScript Editor window, open the Strategies folder, and double-click on the SampleMACrossover file.
      Brandon H.NinjaTrader Customer Service

      Comment


        #4
        Thank you!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by samish18, Today, 11:26 AM
        0 responses
        1 view
        0 likes
        Last Post samish18  
        Started by Trader146, 03-29-2024, 01:22 PM
        2 responses
        14 views
        0 likes
        Last Post Trader146  
        Started by tsantospinto, 04-12-2024, 07:04 PM
        7 responses
        126 views
        0 likes
        Last Post aligator  
        Started by futtrader, 04-21-2024, 01:50 AM
        5 responses
        56 views
        0 likes
        Last Post NinjaTrader_Eduardo  
        Started by PeakTry, Today, 10:49 AM
        0 responses
        2 views
        0 likes
        Last Post PeakTry
        by PeakTry
         
        Working...
        X