Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to combine 2 indicators

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

    How to combine 2 indicators

    My idea for my indicator isn't particularly innovative however it requires me to combine 2 preexisting indicators in a way that just isn't possible through the strategy builder, however I also have very limited coding knowledge and no experience. Is there any advice I can get for how I might be able to maybe copy and paste them together to build this indicator. For more info, the 2 indicators are the MACD and the MFI.

    #2
    Hi KDTrade, thanks for posting. You can create indicator objects inside of your script so you do not need to copy/paste the logic. See the "SampleMACrossover" strategy as an example, it can be found in the Strategies folder of the NInjaScript Editor. That strategy adds two SMA objects and the SMA data is used in the Strategie's OnBarUpdate method.

    To create an object of MACD and MFI, instead of using the "SMA" type, use the "MACD" and "MFI" types.

    Kind regards,
    -ChrisL

    Comment


      #3
      Hi Chris,

      Unfortunately, I'm not sure I fully understand your explanation but I appreciate your quick reply, maybe some more explanation is needed. What I'm trying to do is replace the input for the MACD from price to the MFI, which I can do in the strategy builder. However, I'm trying to replace the individual moving averages in the MACD itself with a moving average of two different MFI's with different periods. Hopefully this explains what I'm trying to do and why I believe I can't use the strategy builder.

      King Regards,
      KD

      Comment


        #4
        Hi KDTrade, I'm happy to help out. The builder can create indicators whose inputs are indicators. Here's an example with the MFI indicator as an input series for the MACD:

        Attached Files

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        633 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        567 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X