Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator not showing up in list - NinjaTrader 8

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

    Indicator not showing up in list - NinjaTrader 8

    Greetings - I just imported the SampleStreamWriter from this direct download link from NinjaTrader:

    https://ninjatrader.com/support/foru...3475&styleid=6

    And when I try and use the indicator, it doesn't show up in the list of available indicators. I've opened it and complied it. I've even copied all the code and built a new indicator under that name and recompiled and saved it. No dice - it's still not showing up in the list of available indicators.

    Any ideas?



    Edit - Also, I did modify it to print OHLC information, but that's it...here's the code

    namespace NinjaTrader.NinjaScript.Indicators
    {
    public class SampleStreamWriter : Indicator
    {
    private string path;
    private StreamWriter sw; // a variable for the StreamWriter that will be used

    protected override void OnStateChange()
    {
    if(State == State.SetDefaults)
    {
    Calculate = Calculate.OnBarClose;
    Name = "Sample stream writer";
    path = @"C:\[Removed file path]\Ninjatrader Export" + Instrument.FullName + ".txt";
    }
    // Necessary to call in order to clean up resources used by the StreamWriter object
    else if(State == State.Terminated)
    {
    if (sw != null)
    {
    sw.Close();
    sw.Dispose();
    sw = null;
    }
    }
    }

    protected override void OnBarUpdate()
    {
    if (CurrentBar == 0)
    sw = File.AppendText(path);
    sw.WriteLine((Time[0]) + " " + Open[0] + " " + High[0] + " " + Low[0] + " " + Close[0]);
    sw.Close();
    }
    }
    }
    Last edited by Moody1337; 01-23-2019, 07:51 AM.

    #2
    Nevermind. Null instrument name at that point in the code. Moved it to OnBarUpdate and everything's good.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    597 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    343 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    556 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    555 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X