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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    47 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    15 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    21 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    23 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X