Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Timeinforce syntax

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

    Timeinforce syntax

    Is it possible to to use the Timeinforce syntax to cancel an unfilled limit order after 4 bar or a set number of tick? This is addictive.

    Texasguy

    #2
    Hello Texasguy,

    Welcome to the support forums.

    The TIF setting specifically could not be used in this way, but you can create logic to cancel orders after a certain number of bars.

    There are NinjaScript methods to know how many bars it has been since an entry or an exit.

    https://ninjatrader.com/support/help...yexecution.htm
    https://ninjatrader.com/support/help...texecution.htm

    These items can be used in both manual coding and the strategy builder to check a number of bars have passed after an entry or exit to allow an action. If the limit order in question is a protective order as an example, you could use the BarsSinceEntryExecution to control if the limit is active after more than 4 bars from the entry point.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you. I will try this. One other question. I tried to follow the video on the simple SMA crossover video. When creating the trade counter it gives me the error that the name bars, as in (bars.firstbarofsession), does not exist in the current context. Do I have to create a reference to "bars" under variables like I did with Private int Counter = 0 command?
      {
      if (bars.firstbarofsession)
      counter = 0;
      if (counter <= 10);

      // Condition set 1
      if (CrossAbove(EMA(8), EMA(21), 1))
      {
      EnterLongLimit(DefaultQuantity, Median[1], "");
      }

      Comment


        #4
        Hello,

        Thank you for the reply.

        I noted that this is both lowercase and is the NT7 usage.

        The capitalization of names in NinjaScript/C# is very important, this cannot be found in your code because the syntax is not correct. Bars need to be capitalized, also the property firstbarofsession would need to be spelled IsFirstBarOfSession.


        https://ninjatrader.com/support/help...stBarOfSession


        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Island_Boy_Trading, Today, 07:39 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Started by cmarkb, Today, 07:19 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by wjadevries, Today, 03:29 AM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_Jim  
        Started by Oracletrades, Yesterday, 09:10 PM
        1 response
        118 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by ginx10k, Today, 07:04 AM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X