Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsSinceEntryExecution(0,"",0) in multi time frame

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

    BarsSinceEntryExecution(0,"",0) in multi time frame

    hello, i have some problem with BarsSinceEntryExecution(0,"",0) >3,

    I want to créate ExitLong in case of


    if (BarsInProgress == 0)
    {
    ….

    if (High[0]<High[1]
    && Close[0]<Close[1]
    && Low[0] <Low[1]
    && High[1]<High[2]
    && BarsSinceEntryExecution(0,"CH",0) >3
    )
    {Print("BarsSinceEntryExecution = "+BarsSinceEntryExecution(0,"CH",0));
    ExitLong(0,1,"LL","CH");}

    It doesn´t execute ExitLong , but DOES execute
    Print("BarsSinceEntryExecution = "+BarsSinceEntryExecution(0,"CH",0));


    I hve tried :
    if (High[0]<High[1]
    && Close[0]<Close[1]
    && BarsSinceEntryExecution(0,"CH",0) >3
    )
    {
    EnterLong(0,1,"LL");}

    And it DOES work.


    Anyone could help me?

    Its back testing.

    #2
    Hello margandi,

    Thanks for your post.

    It looks like you are using the exit name of "CH" (ExitLong(0,1,"LL","CH");}) and checking for an entry also named "CH" (BarsSinceEntryExecution(0,"CH",0))

    Try BarsSinceEntryExecution(0,"LL", 0)

    Note, when used as an entry condition, you have to also check for it returning a -1 in case there is no previous entry which will be the case on the first order. Please see the help guide section here: https://ninjatrader.com/support/help...yexecution.htm

    Comment


      #3
      "CH" is name of entry signal
      "LL"- of exit.
      ExitLong(
      int
      barsInProgressIndex
      ,
      int
      quantity
      ,
      string
      signalName
      ,
      string
      fromEntrySignal
      )
      (ExitLong(0,1,"LL","CH").

      I dont see mistake.

      do you mean that i have to change loke this? :
      ExitLong(
      int
      barsInProgressIndex
      ,
      int
      quantity
      ,
      string
      FROMentrysignal
      ,
      string SIGNALname
      )
      And thank you for reminding to check for returning a -1

      Comment


        #4
        Hello margandi,

        Thanks for your reply.

        You do not have to change, I misread the order of ExitLong(0,1,"LL","CH");

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        81 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        149 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        79 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        52 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        59 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X