• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Prevent to enter new positions after ExitOnSessionCloseSeconds

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

    Prevent to enter new positions after ExitOnSessionCloseSeconds

    Hello,

    There is an example here but it calculates OnEachTick.

    https://ninjatrader.com/support/foru...-exit-on-close

    Can anyone provide an example of how this should be implemented OnBarClose in a simple manner ?

    For instance how can this be done if a variable stores the CurrentBar or resets a bool when ExitOnSessionCloseSeconds is called, so that no new orders can be open after this bar is reached or the bool is reset? Or if it's easier, how to reset a bool just before X seconds prior session close? Some examples will be appreciated.


    #2
    Hello roblogic,

    Thanks for your post.

    You can use a time filter in your code that only places trades within a specified time period, thus avoiding the issue entirely. The following example is written with Calculate.OnBarClose.

    Please see: https://ninjatrader.com/support/help...to_limit_t.htm
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Bionian, Today, 10:10 AM
    1 response
    10 views
    0 likes
    Last Post Emma1
    by Emma1
     
    Started by tonynt, Today, 10:47 AM
    0 responses
    7 views
    0 likes
    Last Post tonynt
    by tonynt
     
    Started by sgordet, Today, 10:01 AM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Started by D Trader, Today, 09:43 AM
    0 responses
    5 views
    0 likes
    Last Post D Trader  
    Started by rafaelabe1977, Today, 03:51 AM
    1 response
    10 views
    0 likes
    Last Post sledge
    by sledge
     
    Working...
    X