Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MACD Difference

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

    MACD Difference

    I'm sure this has been asked before... I did searches for MACD Difference, and similar, but I wasn't able to find something similar to what I want. Probably just a pebkac.

    Consider the following condition:
    Code:
     
    if (MACD(12,26,9).Diff[0] > MACD(12,26,9).Diff[1]){
    dosomething();
    }
    I get compiler errors with a statement such as this. The errors are logical, so I guess I just need to know how to get at the actual difference at a particular point and time. Compiler errors are:
    Code:
    'NinjaTrader.Strategy.Strategy.MACD(int, int, int)' is a 'method', which is not valid in the given context
     
    Operator '<' cannot be applied to operands of type 'bool' and 'double'

    #2
    My oversimplification of the problem appeared to be the problem. In attempting to simplify my intent, I inadvertently provided code that works.

    My goal was to do something along the lines of MACD.Diff[0] > MACD.Diff[10] > MACD.Diff[15]... not realizing that the first two would evaluate to a boolean, which obviously cannot be compared to a value.

    Pebkac. Sorry to take your time.

    Comment


      #3
      Thanks for the update Erik, we're glad you could resolve.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      134 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      75 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      119 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      114 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      92 views
      0 likes
      Last Post CarlTrading  
      Working...
      X