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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      160 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      307 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      244 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      348 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      178 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X