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 Kaledus, Today, 01:29 PM
      0 responses
      3 views
      0 likes
      Last Post Kaledus
      by Kaledus
       
      Started by PaulMohn, Today, 12:36 PM
      1 response
      16 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by yertle, Yesterday, 08:38 AM
      8 responses
      37 views
      0 likes
      Last Post ryjoga
      by ryjoga
       
      Started by rdtdale, Today, 01:02 PM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Started by alifarahani, Today, 09:40 AM
      3 responses
      19 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X