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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        58 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        80 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        43 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        101 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        61 views
        0 likes
        Last Post PaulMohn  
        Working...
        X