Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Candlestick deep dive

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    Dolfan

    #2
    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?

    Comment


      #3
      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


        #4
        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


          #5
          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 UltraNIX, Today, 10:38 AM
          0 responses
          1 view
          0 likes
          Last Post UltraNIX  
          Started by Photon66, Today, 09:49 AM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by jeff_dw, Today, 09:55 AM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Started by torch2k, Today, 10:17 AM
          0 responses
          5 views
          0 likes
          Last Post torch2k
          by torch2k
           
          Started by successnow, Today, 09:42 AM
          3 responses
          17 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X