Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time Since Last Trade

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

    Time Since Last Trade

    How is it possible to implement a time on last trade.
    Eg: I want to enter a position. Then the time on that position is calculated. Then approximately 30 mins later, once the strategy conditions are met again, do another entry. Not before.

    Any Tips??

    #2
    jthom, you could store the trade entry time in a DateTime object and compare it then later for the second entry to take place, easier to implement would be counting the bars passed since the first entry.

    Comment


      #3
      Ok say that Im using Renko 3 bars and ill use the barsince entry method:

      protectedoverridevoid OnBarUpdate()
      {
      if (Historical)
      return;
      if (CurrentBar < 20)
      return;

      // Condition set 1
      if (BarsSinceEntry() > 10
      && Open[0] > EOTVramBars(0.65, 1.3, true).VramUpConfirm[0]
      && orderId.Length == 0
      && atmStrategyId.Length ==
      0)


      {
      atmStrategyId = GetAtmStrategyUniqueId();
      orderId = GetAtmStrategyUniqueId();
      AtmStrategyCreate(Action.Buy, OrderType.Market,
      0, 0, TimeInForce.Day, orderId, "AtmStrategyTemplate", atmStrategyId);

      }


      Pretty much nothing happens. Im assuming this will only calculate after an entry has been made? which is <20 >10th bar since last entry?
      Is that right?

      Comment


        #4
        BarsSinceEntry() is not for ATM orders. It is for NinjaScript orders.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        164 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        317 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        245 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        350 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        179 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X