Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with a AND operator

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

    Problem with a AND operator

    Hello,

    I am trying to create a if condition with an AND operator for an indicator but it seems that the indicator find a signal every time there is a bar. I am new to programming, so I think that my condition is not built correctly. Here is the code below.

    Thanks in advance for your help,

    Manuel

    HTML Code:
    if (CurrentBar < 1)
    return;
    
    Minimum=MIN(Low,ChannelPeriod)[0];
    Maximum=MAX(High,ChannelPeriod)[0];
    
    if ((Low[0]>gapSize*High[1])&&(Maximum<ChannelSize*Minimum));

    #2
    Originally posted by Manuel17 View Post
    Hello,

    I am trying to create a if condition with an AND operator for an indicator but it seems that the indicator find a signal every time there is a bar. I am new to programming, so I think that my condition is not built correctly. Here is the code below.

    Thanks in advance for your help,

    Manuel

    HTML Code:
    if (CurrentBar < 1)
    return;
    
    Minimum=MIN(Low,ChannelPeriod)[0];
    Maximum=MAX(High,ChannelPeriod)[0];
    
    if ((Low[0]>gapSize*High[1])&&(Maximum<ChannelSize*Minimum));
    Open up NT's Output Window.... and use Print statements of your variables before your logic condition, to see what is being compared...

    Comment


      #3
      Hi Sledge, thanks for your answer. The issue was just with the ";"at the end of the if condition...

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      156 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      90 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      138 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      130 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      107 views
      0 likes
      Last Post CarlTrading  
      Working...
      X