Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Trigger a code execution on Start of the Trading Day

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

    How to Trigger a code execution on Start of the Trading Day

    Hi,

    I want to execute few lines of code right after market opens e.g. check if price opened below yesterday's high etc.
    What is the way to detect that?
    I am building a strategy that uses multi-data Series.

    Please let me know if you have any question!

    Thanks
    G
    Last edited by gbajaj; 06-21-2021, 12:03 AM.

    #2
    Hello gbajaj,

    Thanks for your post.

    If you would like to execute code when right after the market opens, you could use Bars.IsFirstBarOfSession to determine if the current bar processing is the first bar updated in a trading session.

    In a multi-timeframe/multi-instrument script, you could use a BarsInProgress check to determine if the added series is processing and then check if Bars.IsFirstBarOfSession to determine if the current bar processing is the first bar of that added series.

    See the help guide documentation below for more information.
    Bars.IsFirstBarOfSession: https://ninjatrader.com/support/help...rofsession.htm
    BarsInProgress: https://ninjatrader.com/support/help...inprogress.htm
    Working with multi-timeframe/multi-instrument scripts: https://ninjatrader.com/support/help...nstruments.htm

    Let us know if we may assist further.
    <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

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    50 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    126 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    69 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X