• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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.
    JoshNinjaTrader 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.
        JoshNinjaTrader 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 aslane, Today, 10:53 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post aslane
                  by aslane
                   
                  Started by bouncetherubble, Yesterday, 08:42 PM
                  1 response
                  12 views
                  0 likes
                  Last Post NinjaTrader_ChrisL  
                  Started by bortz, Yesterday, 08:18 AM
                  5 responses
                  35 views
                  0 likes
                  Last Post bortz
                  by bortz
                   
                  Started by GARZONJ, Yesterday, 09:02 PM
                  1 response
                  15 views
                  0 likes
                  Last Post NinjaTrader_ChrisL  
                  Started by siroya, Today, 06:32 AM
                  4 responses
                  19 views
                  0 likes
                  Last Post NinjaTrader_ChrisL  
                  Working...
                  X