Announcement

Collapse
No announcement yet.

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.
      <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

      Comment


        #4
        Thank you!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        31 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        124 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        64 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        41 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X