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 CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        230 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        149 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        161 views
        1 like
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        243 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        198 views
        0 likes
        Last Post CarlTrading  
        Working...
        X