Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time based stop

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

    Time based stop

    Hello,
    is there a way to enter time based stops in ninjatrader using tick charts? I know how to do this using time based charts using the bars since entry command, but was wondering if someone could help me with the right syntax to use using non-time based charts.
    thanks

    #2
    Hello a1982yusuf,
    The Time[0] value in a tick chart will be not uniformed (like a time based chart). But you can still evaluate the Time[0] to enter a position by placing a code like
    Code:
    if (ToTime(Time[0]) >= 100000)  //do something after 10 AM
    {
       //do something
    }
    Please let me know if I can assist you any further
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thanks JoyDeep. Sorry for not being clear. My problem is once i enter a trade, I want to have a time based stop to exit the trade.

      Comment


        #4
        Hello a1982yusuf,
        Thanks for the clarification.

        You can simply use the Exit() method to exit your position.
        Code:
        if (ToTime(Time[0]) >= 150000)  //exit position after 3PM
        {
            if (Position.MarketPosition == MarketPosition.Long)
                  ExitLong();
            else if (Position.MarketPosition == MarketPosition.Short)
                   ExitShort();
        }
        Please refer to our help guide to know more

        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Hello a1982yusuf,
          For any time based stops you can also try this code

          Code:
          if (Time[0].Subtract(Time[this.BarsSinceEntry()]).TotalMinutes > 3)  //exit trade after 3 minutes of entry
          {
          	//do something
          }
          Please let me know if I can assist you any further.
          JoydeepNinjaTrader Customer Service

          Comment


            #6
            Perfect! this is what I was looking for. I will try this and let you know.

            Comment


              #7
              Hello a1982yusuf,
              Thanks for your note.

              Please let me know if I can assist you any further.
              JoydeepNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              648 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              369 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              108 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              572 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              573 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X