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 NullPointStrategies, Today, 05:17 AM
      0 responses
      53 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      70 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X