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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    73 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    152 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    100 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    288 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X