Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsSinceEntryExecution not working

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

    BarsSinceEntryExecution not working

    The BarsSinceEntryExecution API is not reporting the correct number of bars. I may be miss understanding the usage.
    If I want to get the number of bars for my primary series call this:

    Code:
    BarsSinceEntryExecution(0, LongEntryOrderName, 1);
    Do I pass 0 or 1 for the last parameter? I have tried both but neither work. I believe I’m supposed to pass 1 ( please advise ).

    The overload that doesn’t take any parameters seems to work alright but I can’t use that version in a multi-series strategy.

    I attached screen shot and the strategy I used to test.
    Attached Files

    #2
    Hello,

    Thank you for the post.

    Regarding the overload usage, a 1 would denote 1 entries ago, if you are trying to get the Current entry, a 0 would be used. This works similar to a BarsAgo, but with Entries.

    I downloaded the attached file but I am unable to test it as it includes third party items. Are you able to reproduce the result you are getting in a more simple test like the following syntax?

    Code:
    else if (State == State.Configure)
    {
    	AddDataSeries("ES 12-16", BarsPeriodType.Minute, 5);
    }
    
    protected override void OnBarUpdate()
    {
    	if(State == State.Historical) return;
            if(BarsInProgress != 0) return;
     	if(Position.MarketPosition == MarketPosition.Flat)
    	{
    	     EnterLong(1, 1, "Signal");
    	}
    	Print(BarsSinceEntryExecution(1,"Signal",0));
    }
    In this specific case, we place a single entry and just Print to determine the logic.

    I had tested using a primary of 10 seconds and a secondary of 5 minutes. In this case there will be many prints with 0 bars since entry although the primary has elapsed many bars. A zero would be reported until the 5 minute series closes a bar. Once the Secondary elapses it would increment.

    The reverse would be true using a 5 minute series and adding a 10 second series. We would see many increments to the BarsSinceEntryExecution on each 5 minute bar closed.

    In both cases I could see this was working, could you try a simple test like the one above and modify it as needed to see if you can produce the result you are seeing?


    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    54 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    72 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X