Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 cmtjoancolmenero, Yesterday, 03:58 PM
      11 responses
      38 views
      0 likes
      Last Post cmtjoancolmenero  
      Started by FrazMann, Today, 11:21 AM
      0 responses
      3 views
      0 likes
      Last Post FrazMann  
      Started by geddyisodin, Yesterday, 05:20 AM
      8 responses
      52 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by DayTradingDEMON, Today, 09:28 AM
      4 responses
      24 views
      0 likes
      Last Post DayTradingDEMON  
      Started by George21, Today, 10:07 AM
      1 response
      21 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Working...
      X