Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsSinceEntry()

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

    BarsSinceEntry()

    Not sure if this counts bars since placing an order or bars since long(or short) is purchased

    #2
    Hello BrJessey,

    BarsSinceEntry is based on the order execution meaning when the order filled. It will return -1 if no previous entry has been found or a 0 or positive number when an entry is found. The result is the number of bars since that entry.

    Comment


      #3
      Second part to this question. If a strategy is placing a long limit order, it is my understanding that it places a new order at each bar if using OnBarUpdate. Will Bars since entry
      work in this situation? I am looking to see if a limit order is completed within a certain number of candles, if not, then cancel the order.

      Comment


        #4
        Hello BrJessey,

        Yes that would work with limit orders. BarsSinceEntry works with any type of entry order, it will only report a value once that entry order had filled. Just as an example if you submit a long limit order when you check BarsSinceEntry it will return -1 until that order has filled. Once that order fills it will report 0 on the bar where the entry filled and then for each addition bar the BarsSinceEntry will increment.

        In regard to placing a new order on each bar with limit orders, a limit order can be kept alive for each new bar where it is not filled and where you call the order again, it won't place additional orders. For example if you submit a long limit order and it does not fill within the bar it will expire. If you call the long limit entry method again on that next bar instead of expiring it will persist the order so it can remain active. A new order would only be submitted if you were flat or used a different signal name when calling the order method.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        39 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        124 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        64 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        41 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X