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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    51 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    142 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    160 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    96 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    275 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X