Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem Adding ParabolicSAR to MACD

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

    Problem Adding ParabolicSAR to MACD

    Hello,
    Adding a ParabolicSAR to the MACD as an indicator was no problem. It works perfectly (see sample), but when I try to code it in Ninjascript, I see in the output window it's using price data instead of the MACD data. The Ninjascript setup is as follows:
    MACD2 = MACD(Close, 12, 26, 9);
    ParabolicSAR2 = ParabolicSAR(MACD2.Default, 0.02, 0.2, 0.02);

    Is there something I'm doing wrong?
    Attached Files

    #2
    Hello RookieTrader,

    Thank you for your post.

    I am not seeing any difference in the setup between your indicator directly on the chart and your ParabolicSAR2 in the script. What values are you expecting to see?

    If you compare the values from the output and the values of the indicator directly added to the chart by using the DataBox, are these different? If so, please provide a screenshot.



    I look forward to assisting further.

    Comment


      #3
      Hello Gaby,
      In Ninjascript, I'm trying to generate the same values as the red ParabolicSAR that's on the black and purple MACD in panel 2 to help calculate entries. And the values should be small, somewhere in between +20 to -20, like the red MACD indicator shows in the jpeg file (see MACD values on right axis in panel 2), but the values from the Ninjascript are +17,600 in the output window (see values on right axis, panel 1), around the same price as the NQ futures would be. So it seems that the ParabolicSAR isn't using the MACD values as the input data. So I'm asking, how would I accomplish that?
      (I'm not a coder. I just dabble. So I hope this explanation was thorough enough).

      What I'm currently using:
      "MACD2 = MACD(Close, 12, 26, 9);
      ParabolicSAR2 = ParabolicSAR(MACD2.Default, 0.02, 0.2, 0.02);​"

      Comment


        #4
        Hello RookieTrader,

        Thank you for your response.

        You will need to use the Input Series Variant version of the indicator in your script in order to supply an input series to ParabolicSAR.

        Please see the support article below which details why this is needed, and also provides a download link for the variant version of the indicator you'll need to use.



        Try using this version in your script, the values should then look a lot more similar.

        Please let me know if you have any further questions.
        Last edited by NinjaTrader_Gaby; 03-01-2024, 02:42 PM.

        Comment


          #5
          I used the download link from the webpage you sent me and got an error message (in the attached jpeg file). Is there an easy fix for this?
          Attached Files

          Comment


            #6
            I would still like to know if there's a solution to this problem, but I used a quick fix:
            1. I extracted the indicator files from "InputSeriesVariants"
            2. I copied the file I needed to the indicators folder ("ParabolicSARInput"), without using the Ninatrader "Import" feature
            3. Saved as "ParabolicSARInput2"
            4. Changed the "namespace" in "ParabolicSARInput2" from "NinjaTrader.NinjaScript.Indicators.InputSeriesVar iants" to "NinjaTrader.NinjaScript.Indicators"
            5. Compilied it
            6. Changed the indicator filename in the Ninjascript I was using from ParaboicSAR to ParabolicSARInput2. Example: from ParabolicSAR2 = ParabolicSAR(MACD2.Default, 0.02, 0.2, 0.02) to ParabolicSAR2 = ParabolicSARInput2(MACD2.Default, 0.02, 0.2, 0.02)
            7. Compiled it
            ... And it's working. Again, if there's a fix for the intial import error, please let me know. Thanks for your help.
            Last edited by RookieTrader; 03-01-2024, 10:01 PM.

            Comment


              #7
              Hello RookieTrader,

              I received this error as well and did something similar to use this version of the indicator. Since the method names are similar to the system indicator method names, this error will pop-up.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Yesterday, 05:17 AM
              0 responses
              65 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              139 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              75 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              45 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              50 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X