![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Apr 2007
Location: , ,
Posts: 124
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Try putting it in the OnBarUpdate() section.
|
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Apr 2007
Location: , ,
Posts: 124
Thanks: 0
Thanked 0 times in 0 posts
|
That works !
By the way, do you know how I code the file closing ? I tried sw.close() but I got a compilation error. |
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Try sw.Close() with a capital C.
|
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Oct 2012
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Mar 2012
Location: Denver, CO
Posts: 1,192
Thanks: 134
Thanked 181 times in 180 posts
|
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.
JC
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Oct 2012
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Mar 2012
Location: Denver, CO
Posts: 1,192
Thanks: 134
Thanked 181 times in 180 posts
|
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.
JC
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Oct 2012
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks JC
I will attempt the process. Best regards |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need help with Drawing text | sisidemo | Indicator Development | 25 | 08-30-2007 12:01 PM |
| Record/playback historic bid/ask quotes | pjlegato | Suggestions And Feedback | 1 | 05-21-2007 07:25 AM |
| Hello world | grd974 | General Programming | 3 | 05-20-2007 04:36 PM |
| Automated Start Up and Record for later playback. | IanJB | Miscellaneous Support | 2 | 07-03-2006 04:29 AM |
| How to plot text (outside of bars) | richard | Indicator Development | 1 | 06-07-2006 08:31 PM |