Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Tick Bar timer

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

    Tick Bar timer

    I have a timer for tick bars in TradeStations easylanguage that I am tring to translate into Ninjascript. Here is the easylanguage code with my translations.

    // Timer
    BDT = BarDateTime; // Timestamp of the current bar
    PrevBDT = BarDateTime[1]; // Timestamp of the previous bar
    TimeinBar = maxlist(Absvalue((BDT - PrevBDT).Totalseconds astype double),1); // Time in bar in seconds, Maximum of either 1 second or number of seconds it took for the bar to form.

    Thank you for any assistance.

    #2
    Hello missionstrading,

    Thanks for your post.

    NinjaTrader comes with a BarTimer indicator by default that you could view the code of. To view the code, open a New > NinjaScript Editor window, open the Indicators folder, and double-click on the BarTimer file. If this indicator is insufficient, please clarify exactly why that is the case.

    You could find other bar timers or bar counters on the NinjaTrader Ecosystem User App Share links below.

    https://ninjatraderecosystem.com/use...rtimercounter/

    https://ninjatraderecosystem.com/use...ncybartimer-2/

    https://ninjatraderecosystem.com/use...sound-alert-2/

    https://ninjatraderecosystem.com/use...k3-indicators/

    https://ninjatraderecosystem.com/use...nload/barinfo/

    Please note that we are not able to assist with EasyLanguage code. NinjaTrader utilizes the C# programming language for developing indicators and strategies.

    The best way to begin learning NinjaScript is to use the Strategy Builder. With the Strategy Builder, you can set up conditions and variables and then see the generated code in the NinjaScript Editor by clicking the View Code button.

    Here is a link to our publicly available training videos, 'Strategy Builder 301' and 'NinjaScript Editor 401', for you to view at your own convenience.

    Strategy Builder 301 — https://www.youtube.com/watch?v=_KQF2Sv27oE&t=13s

    NinjaScript Editor 401 - https://youtu.be/H7aDpWoWUQs?list=PL...We0Nf&index=14

    I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript:
    https://ninjatrader.com/support/help..._resources.htm

    If you are new to C#, to get a basic foundation for the concepts and syntax used in NinjaScript I would recommend this section of articles in our help guide first:
    https://ninjatrader.com/support/help...g_concepts.htm

    And the MSDN (Microsft Developers Network) C# Language Reference.
    https://ninjatrader.com/support/help...erence_wip.htm

    Let me know if I may assist further.


    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Wow! Thanks Brandon. All that will definitely point me in the right direction.
      I appreciate the time you took to give such a thorough answer.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      579 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      554 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X