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

how calculate a body of a candel?

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

    #16
    Oh, maybe you want the number of "ticks"?

    On the ES the "tick size" is 0.25 -- so you need to divide 6.25 by 0.25, which gives you 25 ticks.

    On the ES, 1 point is 4 ticks, so each tick is 0.25.

    Anyways,
    NinjaScript has this value automatically calculated for you, always use the "TickSize" variable.

    Try this code instead,
    Code:
    protected override void OnBarUpdate()
    {
    
        if (CurrentBar == 14)
        {
            Print((Open[0]-Close[0])/TickSize);
        }
    }

    Comment


      #17
      no probably what i want is not possible like NJ like MT i explain what i find
      example: i have a candel in chart 6C , the candel have body long 0.5 cm ,( i use rule over the screen ), the position of this candel is 14 , in chart ES have a candel in position 7 that have a body long 0.5 cm ( i use rule over the screen ) , but if i use Print((Open[0]-Close[0])/TickSize); etc... return a different value (is right ) but for my eye for find pattern is the same candel , exist some method to mesure body (also if i zoom o not zoom a chart ) regardless instruments ? thankz

      Comment


        #18
        Sorry, I am still confused as to what you are trying to do.
        Are you trying to get the height of the candle body in terms of centimeters?
        Are you saying MetaTrader has code that allows you to do this?

        Candlesticks are not measured in inches or centimeters.

        I know of no NinjaTrader calculation that you can apply that would return
        a value expressed in centimeters.

        Even if there were a calculation that gave you centimeters, I don't
        understand the practical value of the resulting number.

        Why is this calculation in centimeters important to you?
        What are you trying to do with the answer?
        Last edited by bltdavid; 04-22-2020, 04:00 PM. Reason: Add more context to my confusion ...

        Comment


          #19
          centimeter is only for example for have a comparison between the two graphs.(metatrader can mesure xy graph ChartTimePriceToXY but if you change a setting (like zooming) of graph change a value ) but after this parentesis of MT.
          the problem was born when i ask my self if is possible have a screener for match some particular pattern , if i use for identify the candel,the price-open and price-close i can find it only in one insdtruments because if i find a big candel in ES have a value 26 , in 6C the same dimention of my eye recognize is -0.00027 this 2 candel have value different but NJ draw identical, and then my eye recognize the same pattern in 2 different instruments , i want understund if is possible create a scanner-pattern for do in all instruments. i hope explain good thankz again for support

          Comment


            #20
            You'll have to identify patterns in dimensions supplied by the chart, not in dimensions using your eyes.

            If you see the same size "identical" candle in ES and 6C, this is entirely coincidental.

            Comment


              #21
              There is no way to compare the ruler measurements of candles because they are shown only as a visible size depending on the chart size, the high to low scaling of the number of visible candles, etc. You could count the number of ticks from the high to low of a candle: (High[7] - Low[7]) / TickSize
              Since the minimum movement of a candle is one price tick/pip you can kind of compare sizes between different Instruments.

              PS Never measure something on your screen. It is useless.
              eDanny
              NinjaTrader Ecosystem Vendor - Integrity Traders

              Comment


                #22
                bltdavid , so i think is not correct (for my opinion ) because when i do trading the first interface that all trade in the world use is eye and monitor if candel is not reliable ,do a trading is an alchemia, if i use fix dimention and fix resolution of the screen the chart (always for my opinion) should be the same (if exist equal candel of course) . it would be nice exist somthing fix , because , suppose you look a Black evening star pattern , and you tell at script the first candel must be 100 (body), but maybe in 6C is correct but inES no and you must rearrange all script for all instruments.

                Comment


                  #23
                  The only way to measure a bar is by ticks.In order to see the visual size of the ticks on a chart to compare to another chart, the chart has to be squared up so that a tick height is the same as the bar spacing. If multiple charts are set up the same way, a larger candle on one chart is actually larger than on another chart but you need to have the charts sized the same and the same number of candles in the viewable chart. Here is an example of two charts with the same candle spacing and squared up so the visible tick sizes are the same. This is also the way to see real angles on your chart. Now you can compare between the two visually. The easier way is to measure in code with the number of ticks in the candlestick.

                  Click image for larger version

Name:	SquaredCharts.png
Views:	196
Size:	55.9 KB
ID:	1096435
                  Last edited by eDanny; 04-24-2020, 12:26 PM.
                  eDanny
                  NinjaTrader Ecosystem Vendor - Integrity Traders

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by rocketman7, Today, 02:12 AM
                  1 response
                  15 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by briansaul, Today, 05:31 AM
                  1 response
                  12 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Started by PaulMohn, Today, 03:49 AM
                  1 response
                  12 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by frslvr, 04-11-2024, 07:26 AM
                  6 responses
                  106 views
                  1 like
                  Last Post NinjaTrader_BrandonH  
                  Started by trilliantrader, 04-18-2024, 08:16 AM
                  6 responses
                  26 views
                  0 likes
                  Last Post trilliantrader  
                  Working...
                  X