Dolfan
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!
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
NinjaTrader
Candlestick deep dive
Collapse
X
-
Candlestick deep dive
I would like to create an indicator or strategy where I use the data from a candlestick/renko/tick/OHLC or any bar. For a candlestick I would like to be able to extract the data separately between the body, the 2 wicks (upper and lower) and the full range (sum of all three). The data extracted would include but is not limited to ticks, volume, bid/ask, time (for non time based bars), and perhaps other data. Can someone give me guidance on how I might proceed here? I am not a skilled programmer so I would be starting with the strategy/indicator builder. Eventually I can see where I would have to unlock the code, but small steps moving forward. Any help at all is appreciated.
DolfanTags: None
-
What do you want to do with this data? Do you want to display it on chart, either in a number, a historgram or something else? Do you want to print this data to the output window, where you can copy it and past it in an excel file?
Do you want to have it streamed directly to a text or csv file?
-
Hello Dolfan,
Thanks for your post.
I may suggest using the Strategy Builder to generate small condition and action sets so you can click the View Code button and see the resulting syntax. This can be helpful along side looking into C# programming materials. We have some limited educational C# information in the NinjaTrader 7 Help Guide, but you can find more robust C# materials external to NinjaTrader.
Strategy Builder 301 (publicly available) - https://www.youtube.com/watch?v=HCyt90GAs9k
Once familiar with the framework, I suggest then to create a simple indicator that plots a value, or exports data with a StreamWriter. You may reference the AddPlot documentation below for how to add a plot and assign a plot a value. I have also linked an example that uses a StreamWriter to write data to file.
AddPlot - https://ninjatrader.com/support/help...8/?addplot.htm
SampleStreamWriter - https://ninjatrader.com/support/help...o_write_to.htm
With all of this understood, you will know how to make an indicator and present or extract data. Another educational resource on accessing price data can be found below. this would be how you can work with OHLCV data in the script.
Working with Price Series - https://ninjatrader.com/support/help...ice_series.htm
Time[0] can be referenced to get the timestamp of a bar.
Bid/Ask series can be added to the script. This would involve creating a Multi Time Frame indicator which would be more advanced. I have included some information on Multi Time Frame NinjaScripts and adding a Bid/Ask series below.
Multi Time Frame and Instruments - https://ninjatrader.com/support/help...nstruments.htm
Historical Bid/Ask Series - https://ninjatrader.com/support/help..._ask_serie.htm
We look forward to assisting.JimNinjaTrader Customer Service
Comment
-
Thanks Jim. I obviously haven't had time to go through all of this yet but a key part of my question is, can I break the data out from the 3 parts of a candlestick? This is very important to me. For example, any bar would have an ATR. What is the ATR of the body? What is the ATR of the upper wick? What is the ATR of the lower wick? The same questions would be asked of the other data points like volume. Can I write an algo that will extract a 'dissected' candlestick (or other) bar? Thanks for your input!
Dolfan
Comment
-
Hello Dolfan,
Yes, this is possible.
For example with ATR of the upper wick, you can create a custom Series object to hold the difference between the Open and the High for down bars and the Close and the open for up bars. Up bars can be defined when Close[0] > Open[0] and down bars can be defined as when Open[0] > Close[0].
You would create a Series<double> and assign it values (the differences calculated above) in OnBarUpdate, just like a plot. Then you would use that Series<double> as the input for the ATR indicator.
Please see below for what you can input into an indicator.
Valid Input for System Indicators - https://ninjatrader.com/support/help..._indicator.htm
We look forward to assisting.JimNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Perr0Grande, Today, 08:16 PM
|
0 responses
2 views
0 likes
|
Last Post
by Perr0Grande
Today, 08:16 PM
|
||
Started by elderan, Today, 08:03 PM
|
0 responses
4 views
0 likes
|
Last Post
by elderan
Today, 08:03 PM
|
||
Started by algospoke, Today, 06:40 PM
|
0 responses
10 views
0 likes
|
Last Post
by algospoke
Today, 06:40 PM
|
||
Started by maybeimnotrader, Today, 05:46 PM
|
0 responses
9 views
0 likes
|
Last Post Today, 05:46 PM | ||
Started by quantismo, Today, 05:13 PM
|
0 responses
7 views
0 likes
|
Last Post
by quantismo
Today, 05:13 PM
|
Comment