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 CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      478 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      319 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      258 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      342 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      309 views
      0 likes
      Last Post CarlTrading  
      Working...
      X