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 Segwin, 05-07-2018, 02:15 PM
        14 responses
        1,789 views
        0 likes
        Last Post aligator  
        Started by Jimmyk, 01-26-2018, 05:19 AM
        6 responses
        837 views
        0 likes
        Last Post emuns
        by emuns
         
        Started by jxs_xrj, 01-12-2020, 09:49 AM
        6 responses
        3,294 views
        1 like
        Last Post jgualdronc  
        Started by Touch-Ups, Today, 10:36 AM
        0 responses
        13 views
        0 likes
        Last Post Touch-Ups  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        11 responses
        63 views
        0 likes
        Last Post halgo_boulder  
        Working...
        X