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

Custom candle drawing

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

    Custom candle drawing

    Hi,

    I am writing and indicator that custom paints candlestick bodies and wicks (attached indicator). When the bars are painted by Ninjatrader, it correctly paints the first bar on the chart as a full bar (first attached picture). However, when I apply my custom drawing, the first bar is always cut in half (second and third picture).

    I have tried using BarWidth and GetBarPaintWidth to see if that would make a difference and BarWidth seems to be the most accurate. I am obviously doing something wrong but for some reason cannot figure out how to get this going well, maybe I have been staring at the problem too long :-)

    Has anyone had or solved this problem maybe? Any help would be highly appreciated.

    Regards,
    John
    Attached Files

    #2

    CandleOutlineBrushes[0] = pCandleStrongColorBar;


    BarBrush = pCandleStrongColorBar;


    The only way I think you can have the wick Color is to goto dataseries and change the wick color. I have been trying to find the command line but I can not find any on my indicators.



    Comment


      #3
      Thank you for the answer ballboy11 , my problem is not with the color of the candle wicks though. If you look at the attached screenshots you will see the first bar on the chart is basically cut in half with my custom drawing every time.

      Have you maybe come across this before?

      Comment


        #4
        I see your issue. I think it is you chart control if you look a the time below and as soon as the time disappears on the chart the following candle renders left. as soon as the new time appears the candle wil centre

        Comment


          #5
          Hello JohnSteinberg,

          Thank you for your note.

          Since you’re only seeing this on the first bar of the chart, you may need to write logic that if the first candle on the chart, add a margin offset to your drawing logic for the wick.

          If you'd like to provide the full code I can take a look and see if anything jumps out..

          To export a NinjaScript from NinjaTrader 8 do the following:
          From the Control Center window select Tools -> Export -> NinjaScript...
          Click Add>Select the indicator>OK>Export.
          Then attach that file you saved; under My Docs>NT8>Bin>Custom>Select the downloaded .zip file.

          I look forward to your reply.
          Alan P.NinjaTrader Customer Service

          Comment


            #6
            Hi Alan,

            Thanks for your reply. The full code is attached to the first post. It is my base indicator I exported from NinjaTrader. Just a side note, the problem is not with the wick of the drawing I am making but rather that the first candle is always cut in half. This does not happen with candle drawing native in NT. I guess I might be using the wrong mid point and candle widths, but not sure what else to use.

            I would really appreciate any help you can provide.

            Kind Regards,
            John

            Comment


              #7
              Hello John,

              I added logic which checks if this is the first bar and if so, add a offset to the wick.

              I've attached screen shots of the differences which looks resolved when you add the following on line 114 of the script,

              Code:
              if(arrayWalker == ChartBars.FromIndex)
              barMidX=    (barMidX+barPaintWidth/2);
              Please let us know if you need further assistance.



              Attached Files
              Alan P.NinjaTrader Customer Service

              Comment


                #8
                Hi Alan,

                Thank you very much, exactly what I was after. Really appreciate the help.

                Kind Regards,
                John

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by ghoul, Today, 06:02 PM
                2 responses
                13 views
                0 likes
                Last Post ghoul
                by ghoul
                 
                Started by jeronymite, 04-12-2024, 04:26 PM
                3 responses
                44 views
                0 likes
                Last Post jeronymite  
                Started by Barry Milan, Yesterday, 10:35 PM
                7 responses
                20 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by AttiM, 02-14-2024, 05:20 PM
                10 responses
                180 views
                0 likes
                Last Post jeronymite  
                Started by DanielSanMartin, Yesterday, 02:37 PM
                2 responses
                13 views
                0 likes
                Last Post DanielSanMartin  
                Working...
                X