Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Why NT7 treats the indicator value as Strings?

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

    Why NT7 treats the indicator value as Strings?

    I have some simple code, as follows:

    Code:
    if ( MACD(BarsArray[2],12,26,9)[0]>MACD(BarsArray[2],12,26,9).Avg[0]>0) 
          {
    			bool	trendUp=true;
          }
    The error code is CS0019, stating that a bool and int can not be compared with > .

    Thanks !!

    #2
    Hello wolfcuring,

    Thanks for your post.

    You have two logical evaluations but only 3 variables. You would need to either eliminate one evaluation or add another variable. I'll re-write the two possible ways I can see this:

    1) test that Macd line is greater than the average line
    Code:
    if ( MACD(BarsArray[2],12,26,9)[0] > MACD(BarsArray[2],12,26,9).Avg[0]) 
          {
    	   bool	trendUp = true;
          }
    2) Test that the MACD line is great than the average line and test that the MACD line is greater than 0 and test that the average line greater than 0.

    Code:
    if ( MACD(BarsArray[2],12,26,9)[0] > MACD(BarsArray[2],12,26,9).Avg[0] 
    && MACD(BarsArray[2],12,26,9)[0] > 0 && MACD(BarsArray[2],12,26,9).Avg[0] > 0) 
          {
    	 bool	      trendUp = true;  
          }

    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