Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to calculate ticks

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

    How to calculate ticks

    Hello,

    I just try to implement MoneyManagement filter for the custom strategy.
    And if initial risk of the entry is more than lets say 10 ticks --> skip that signal.

    For this I have to calculate somehow difference between two prices in ticks. How could I do this?
    Would be grateful for any advise or sample.

    #2
    Hello akushyn,

    Thanks for your note.

    When you have two prices that are exact tick sizes, these can be divided by the TickSize property.
    Use Math.Abs() to ensure you have a positive number.

    For example:
    Code:
    Print( Math.Abs(High[0] - Low[0]) / TickSize );
    
    if (( Math.Abs(High[0] - Low[0]) / TickSize > 10)
    {
    // execute code
    }
    Below is a link to the help guide on TickSize.
    http://ninjatrader.com/support/helpG...7/ticksize.htm


    If you are using two prices that do not have exact tick sizes, you can optionally use Instrument.MasterInstrument.Round2TickSize() to round these before dividing by the tick size.
    http://ninjatrader.com/support/helpG...trument_ro.htm
    Code:
    Print( Instrument.MasterInstrument.Round2TickSize(Math.Abs(SMA(High, 14)[0] - SMA(Low, 14)[0])) / TickSize );
    Last edited by NinjaTrader_ChelseaB; 06-24-2016, 02:23 PM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Very useful, thank you!

      And now, how to calculate risk in US dollars , cause some intsruments valued in EUR and some in USD? How to convert from EUR to USD ?

      Is there smth like TickValue?
      usdRisk = calculatedTicks * TickValue

      Comment


        #4
        Hello akushyn,

        There is a point value: Instrument.MasterInstrument.PointValue.

        For example on the ES the point value is 50. The tick size is .25. You can calculate the price per tick with (TickSize * Instrument.MasterInstrument.PointValue). For the ES this would be 12.5 per tick.

        Converting to different currencies would require a custom calculation. You may need a secondary series of forex data to get the current conversion rate between two currencies.
        There is not a function in NinjaTrader to return this information.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        57 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Today, 06:52 PM
        4 responses
        36 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Today, 07:39 PM
        0 responses
        7 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        19 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        9 views
        0 likes
        Last Post cre8able  
        Working...
        X