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

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 geddyisodin, Today, 05:20 AM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by Max238, Today, 01:28 AM
    3 responses
    32 views
    0 likes
    Last Post Max238
    by Max238
     
    Started by timko, Today, 06:45 AM
    2 responses
    13 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by habeebft, Today, 07:27 AM
    0 responses
    6 views
    0 likes
    Last Post habeebft  
    Started by Tim-c, Today, 03:54 AM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Working...
    X