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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    63 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    35 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    54 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    61 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    48 views
    0 likes
    Last Post CarlTrading  
    Working...
    X