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 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