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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    36 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    14 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    20 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    22 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X