Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.

    BertrandNinjaTrader Customer Service

    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 Waxavi, 04-19-2024, 02:10 AM
        2 responses
        37 views
        0 likes
        Last Post poeds
        by poeds
         
        Started by chbruno, Yesterday, 04:10 PM
        1 response
        44 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Max238, Today, 01:28 AM
        1 response
        24 views
        0 likes
        Last Post CactusMan  
        Started by giulyko00, Yesterday, 12:03 PM
        2 responses
        10 views
        0 likes
        Last Post giulyko00  
        Started by r68cervera, Today, 05:29 AM
        0 responses
        4 views
        0 likes
        Last Post r68cervera  
        Working...
        X