Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
      BertrandNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by pmachiraju, 11-01-2023, 04:46 AM
      8 responses
      148 views
      0 likes
      Last Post rehmans
      by rehmans
       
      Started by mattbsea, Today, 05:44 PM
      0 responses
      5 views
      0 likes
      Last Post mattbsea  
      Started by RideMe, 04-07-2024, 04:54 PM
      6 responses
      33 views
      0 likes
      Last Post RideMe
      by RideMe
       
      Started by tkaboris, Today, 05:13 PM
      0 responses
      5 views
      0 likes
      Last Post tkaboris  
      Started by GussJ, 03-04-2020, 03:11 PM
      16 responses
      3,283 views
      0 likes
      Last Post Leafcutter  
      Working...
      X