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

'Hello World' as a text file record ?

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

    'Hello World' as a text file record ?

    I wrote down this code after msdn library, compiled it as an indicator, put it over a chart, ran Market Replay but it did not write to any file.

    public static void Main()
    {
    string path = @"C:\TEMP\MyTest.txt";
    if (!File.Exists(path))
    {
    using (StreamWriter sw = File.CreateText(path))
    {
    sw.WriteLine("Hello World");
    }
    }
    }

    Where is the error ?

    #2
    Try putting it in the OnBarUpdate() section.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      That works !
      By the way, do you know how I code the file closing ?
      I tried sw.close() but I got a compilation error.

      Comment


        #4
        Try sw.Close() with a capital C.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          How to write, save and retrieve bar-by-bar data (price, indicator etc) for each chart

          Kindly help!

          I am wanting to write, save and retrieve bar-by-bar data (price, indicator etc) for each different time frame chart.

          Kindly advise how i can do this or advise of who can help with this.

          Thank you

          Comment


            #6
            Hello Nilesh Patel,

            Welcome to the NinjaTrader Support Forums!

            You may view the following link to our Support Forums that gives a sample code that you can run to write to a file values.
            http://www.ninjatrader.com/support/f...ead.php?t=3475

            To get the values for each time frame you can apply the Indicator to each one individually or create a Multi-Time Frame code. For an example on a Multi-Time Frame code you can view SampleMultiTimeFrame strategy by going to Tools -> Edit NinjaScript -> Strategies and double click on the strategy.

            You may also view our Help Guide that goes Multi-Time Fame at the following link.
            http://www.ninjatrader.com/support/h...nstruments.htm

            Let us know if we can be of further assistance.
            JCNinjaTrader Customer Service

            Comment


              #7
              Hi JC

              Thanks for the reply. Sorry, i have no idea of how to go about coding including the steps to load it etc.

              I would appreciate detailed help with this.

              Your help/guidance is appreciated

              Comment


                #8
                Hello Nilesh Patel,

                To Import an indicator into NinjaTrader you may follow the steps below.
                1. Download the NinjaScript file (.zip) to your desktop
                2. From the Control Center window select the menu File -> Utilities -> Import NinjaScript
                3. Select the downloaded file
                4. Press the Open button

                We have a fully documented help guide which will help you get started with Ninja Script. You will find language references to all of the methods and functions you will be using their. You will also see a tutorial section which will help you create your first indicator and get you started with some of these concepts.

                A link to our Help Guide can be found below: http://www.ninjatrader.com/support/h...stribution.htm

                I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript: http://www.ninjatrader.com/support/h..._resources.htm

                We also have some Reference Samples online as well as some Tips and Tricks for both indicators and strategies:
                Click here to see our NinjaScript Reference Samples
                Click here to see our NinjaScript Tips

                There is a also a growing library of user submitted custom indicators (100+) that can be downloaded from our support form. Please look in the NinjaScript File Sharing section of our support forum as you may find what you are looking for there.

                Let us know if we can be of further assistance.
                JCNinjaTrader Customer Service

                Comment


                  #9
                  Thanks JC

                  I will attempt the process.

                  Best regards

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Barry Milan, Today, 10:35 PM
                  1 response
                  8 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by WeyldFalcon, 12-10-2020, 06:48 PM
                  14 responses
                  1,428 views
                  0 likes
                  Last Post Handclap0241  
                  Started by DJ888, Yesterday, 06:09 PM
                  2 responses
                  9 views
                  0 likes
                  Last Post DJ888
                  by DJ888
                   
                  Started by jeronymite, 04-12-2024, 04:26 PM
                  3 responses
                  40 views
                  0 likes
                  Last Post jeronymite  
                  Started by bill2023, Today, 08:51 AM
                  2 responses
                  16 views
                  0 likes
                  Last Post bill2023  
                  Working...
                  X