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