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!
See more
See less

Partner 728x90

Collapse

Plot Candlesticks

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

    Plot Candlesticks

    Hi,

    I have an indicator that does some calculations and I would like to plot the results as OHLC in the form of candlesticks. How would i do that?

    Thanks for any assistance.

    Ian

    #2
    Hello IanC28,

    I have been working on a sample and will follow up tomorrow when I finish it.

    Thank you for your patience.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hello IanC28,

      I put together the attached indicator which takes the Open, High, Low, and Close value of each of the FAANG’s (Facebook, Apple, Amazon, Netflix, and Google), multiples the value of the OHLC for FB, AAPL, NFLX by 7 for weighting purposes, and gets the sum for the OHLC. Within OnRender I use DrawLine to plot the wick of the candle using the High and Low sum values, and DrawRectangle to draw the candle body using the open and close sums.

      To modify this example and pass your desired values to the candlestick, you would want to see lines 81-85 within the code.

      So, for example if you wanted to set the Open of the candlestick equal to the primary series Open*3, you would replace line 82,

      Code:
      xOpens[0] = Opens[1][0] * 7 + Opens[2][0] *7	+ Opens[3][0]  + Opens[4][0] * 7  + Opens[5][0];
      With,

      Code:
      xOpens[0] = Opens[0][0] * 3;
      Please let us know if you need further assistance.
      Attached Files
      Last edited by NinjaTrader_AlanP; 06-28-2017, 01:37 PM.
      Alan P.NinjaTrader Customer Service

      Comment


        #4
        Thanks Alan that was very useful. The comments in the file were very useful.

        Sorry for the delay in getting back to you . . I have been on a short break.

        I have tweaked the code a bit to resolve an issue with some plots being curtailed.

        I want to draw lines on the plot and use snaps. Is that possible?

        There is a NT7 script that uses Plots() instead of OnRender(). I tried converting this code, but was not getting very far. It can use snaps.

        It would also be useful to be able to use the data with MACD if that is possible.


        Thanks

        Ian

        Comment


          #5
          Hello IanC28,

          You could add plots to the indicator I put together similar to how I set a plot equal to the closing price for the purpose of displaying the last price on the price axis. This should give you the functionality that a plot would yield in terms of drawing lines.

          You could also use the following method for drawing lines using OnRender,


          If you’d like to apply the MACD indicator to the indicator I put together, you would add MACD to the chart, and for the Input Series, you would select CandlesStickPolotOfIndicatorValuesFAANGs. This will display the MACD of the indicator series.

          I am unaware of a script that uses plots instead of OnRender however I would encourage you to ch3eck the following link for examples,



          Please let us know if you need further assistance.
          Alan P.NinjaTrader Customer Service

          Comment


            #6
            How is the candelstick plot in the new 'Order Flow Cumulative Delta' indicator created? Is the code similar to the attachment in posts #3 or is there an alternative way to achieve this?

            /poseidon_sthlm

            Comment


              #7
              Hello poseidon_sthlm,

              Thank you for your post.

              Both the file in post #3 and the Heiken Ashi 8 indicator demonstrate how to build the bars in OnRender() similar to how the Order Flow Cumulative Delta builds it's bars.

              You can find the Heiken Ashi 8 indicator at the following link: http://www.ninjatrader.com/support/f...d=7&linkid=730

              Please let me know if you have any questions.

              Comment


                #8
                Hi Patrick / Alan,

                With regards to post #3 above, I am not able to find the code for the sample indicator. Please let me know where I can find it.

                Thanks so much.

                Comment


                  #9
                  Hi, thanks for posting.

                  The Example that was posted was deleted or removed. Alan has since moved to a different department in the company. Use AddDataSeries to add each FANG company listed to get data from each:


                  We have a guide on multi time frame/instrument scripts here:


                  Best regards.
                  Chris L.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by algospoke, Today, 06:40 PM
                  0 responses
                  10 views
                  0 likes
                  Last Post algospoke  
                  Started by maybeimnotrader, Today, 05:46 PM
                  0 responses
                  8 views
                  0 likes
                  Last Post maybeimnotrader  
                  Started by quantismo, Today, 05:13 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post quantismo  
                  Started by AttiM, 02-14-2024, 05:20 PM
                  8 responses
                  168 views
                  0 likes
                  Last Post jeronymite  
                  Started by cre8able, Today, 04:22 PM
                  0 responses
                  10 views
                  0 likes
                  Last Post cre8able  
                  Working...
                  X