Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calculating percentage of bar after bar opens

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

    Calculating percentage of bar after bar opens

    Hello all,

    I am really newbie on ninja trader script. I am trying to calculate certain percentage of current bar since this one opened. I am configuring the calculation as Calculate = Calculate.onEachTick but, my biggest challenge so far is on how to get the current price (price when the tick changes). I know that close[0] is for bar closed but I don't need to get that price but the one intrabar before it close to calculate on each tick until match with condition to trigger a long or short position depending on other conditions that I have in strategy.

    Thank you very much in advance for your time and answers.

    #2
    Hi, thanks for posting. The Close[0] price will represent the latest price in an OnEachTick script. You can use Print(); to print out the Close[0] value and you will see it printing the intrabar values:

    //OnBarUpdate:
    Print(Close[0]);

    Kind regards,
    -ChrisL

    Comment


      #3
      Thank you very much on your quick answer Chris L.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      90 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      135 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      119 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      69 views
      0 likes
      Last Post PaulMohn  
      Working...
      X