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 05-23-2011, 10:43 AM   #1
naked
Member
 
Join Date: Oct 2005
Location: , ,
Posts: 38
Thanks: 0
Thanked 1 time in 1 post
Default Zigzag Programming; write to file export

Hello, I am trying to figure out how to work with zigzag data. Can someone please help me with the following or provide some example code so I can be guided the right way?

I am transitioning from EasyLanguage, so please excuse any poorly structured syntax in this thread.

1. I am using the default ZIGZAG indicator on CL set to 0.50pts per new zigzag line.

2. I would like to export data from the zigzag transitions: time, high price (if zigzag up), low price (if zigzag down), and zigzag number (to answer the statement, "this is the n-th zigzag on the chart") into a CSV file.

3. I would like to create an "automatic" fibonacci retracement based on recent zigzag highs/lows. How do I call the n-th zigzags to calculate this?

If this indicator has already been created, then please link! If not, I will gladly supply my source to this forum.

Thanks much!!
naked is offline  
Reply With Quote
Old 05-23-2011, 11:01 AM   #2
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Hello naked,

One important thing to know when working with Zig Zag and similar indicators (Swing), is that they're repainting. Values accessed programatically will be different than what you see visually on a chart because of this. After future bars come in, the indicator is repainted and the values you see in the past are actually generated by values in the future. As such, you are likely to run into issues trying to get a useful real time value from it.

If you want to purse writing information to a file, these samples can help:
http://www.ninjatrader-support.com/v...ead.php?t=3475
http://www.ninjatrader-support.com/v...ead.php?t=3476
http://www.ninjatrader-support.com/v...ead.php?t=3477
NinjaTrader_RyanM is offline  
Reply With Quote
Reply

Tags
csv, zigzag lines

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
File write from Strategy abfc123 Strategy Development 8 11-17-2010 01:11 PM
Write the trades in a file soyjesus General Programming 2 06-07-2010 05:29 AM
Strange File write behavor?! mktrend General Programming 0 10-28-2008 08:43 PM
Historical interferes with file write? Burga1 Miscellaneous Support 4 05-14-2008 01:43 PM
Indicator: Using System.IO File properties to write to and read from a text file NinjaTrader_Josh Reference Samples 0 09-30-2007 10:48 PM


All times are GMT -6. The time now is 02:37 PM.