NinjaTrader Support Forum  
X

Attention!

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


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 07-29-2007, 02:06 PM   #1
grd974
Senior Member
 
Join Date: Apr 2007
Location: , ,
Posts: 124
Thanks: 0
Thanked 0 times in 0 posts
Default '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 ?
grd974 is offline  
Reply With Quote
Old 07-29-2007, 02:10 PM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Try putting it in the OnBarUpdate() section.
NinjaTrader_Josh is offline  
Reply With Quote
Old 07-29-2007, 03:02 PM   #3
grd974
Senior Member
 
Join Date: Apr 2007
Location: , ,
Posts: 124
Thanks: 0
Thanked 0 times in 0 posts
Default

That works !
By the way, do you know how I code the file closing ?
I tried sw.close() but I got a compilation error.
grd974 is offline  
Reply With Quote
Old 07-29-2007, 03:18 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Try sw.Close() with a capital C.
NinjaTrader_Josh is offline  
Reply With Quote
Old 10-25-2012, 09:25 AM   #5
Nilesh Patel
Junior Member
 
Join Date: Oct 2012
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default 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
Nilesh Patel is offline  
Reply With Quote
Old 10-25-2012, 09:43 AM   #6
NinjaTrader_JC
NinjaTrader Customer Service
 
NinjaTrader_JC's Avatar
 
Join Date: Mar 2012
Location: Denver, CO
Posts: 1,192
Thanks: 134
Thanked 181 times in 180 posts
Default

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.
NinjaTrader_JC is offline  
Reply With Quote
Old 10-25-2012, 09:52 AM   #7
Nilesh Patel
Junior Member
 
Join Date: Oct 2012
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default

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
Nilesh Patel is offline  
Reply With Quote
Old 10-25-2012, 10:04 AM   #8
NinjaTrader_JC
NinjaTrader Customer Service
 
NinjaTrader_JC's Avatar
 
Join Date: Mar 2012
Location: Denver, CO
Posts: 1,192
Thanks: 134
Thanked 181 times in 180 posts
Default

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.
NinjaTrader_JC is offline  
Reply With Quote
Old 10-25-2012, 10:16 AM   #9
Nilesh Patel
Junior Member
 
Join Date: Oct 2012
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks JC

I will attempt the process.

Best regards
Nilesh Patel is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -6. The time now is 09:50 AM.