Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitLong ignoring condition

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

    ExitLong ignoring condition

    Please see my code snipper below. I don't know what I am doing wrong and hope someone sees an obvious mistake because it is driving me up the wall.

    The problem is that the ExitLong does not take the condition in to account. The places where the system exits does not even change when I comment the "if (Close[0] < LLstop) condition out. The trades are ALWAYS closed out after 1 bar (i.e. on the second bar) even if the condition is nor true.

    I have inserted print statements to check the values of the variables and all looks fine

    Any input would be appreciated.

    // Buy trigger
    if (Position.MarketPosition != MarketPosition.Long)
    {
    HighestHighforlong = 0;
    LLstop = 0;
    if (MyDmipp[0] > MyDmimm[0] && MyDmipp[1] > MyDmimm[1])
    {
    HighestHighforlong = MAX(High,3)[0];
    if ((Close[0] + TickSize) > HighestHighforlong)
    EnterLong();
    }
    }

    if (Position.MarketPosition == MarketPosition.Long)
    {
    LLstop = MIN(Low,4)[BarsSinceEntry()];
    if (Close[0] < LLstop);
    ExitLong();
    }

    #2
    Expected, note the wrong semicolon in your code
    if (Close[0] < LLstop);

    Comment


      #3
      Thank you

      Thank you. I know it was something stupid

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X