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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        91 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        137 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        121 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        72 views
        0 likes
        Last Post PaulMohn  
        Working...
        X