Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MACDVariation In Strategy?

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

    MACDVariation In Strategy?

    Hi,

    I wanted to know if the indicator MACDVariation can be used in a strategy? If so, what is the correct ninjascript format for the long and short entries?


    Thank you,

    Lee

    #2
    Hello lee162801,

    Thank you for your post.

    Are you referring to the MACD Variation indicator located in the NinjaTrader Ecosystem User App Share center linked below?
    This is a conversion of the MACDVariation as discussed in the May 2016 Stocks and Commodities article titled "Zero In On The MACD" by Barbara Star, PhD. Please contact the original author for any questions or comments.


    If so, yes that MACD Variation indicator is able to be used in a NinjaScript strategy. The Strategy Builder could be used to set up order entry conditions based on the MACD Variation plot. Then, you could click the 'View code' button to see the code used for your condition. Something you could do is create a condition that checks if the MACD Variation indicator is greater than 0 and call EnterLong. Or, you could check if the MACD Variation plot is less than 0 and call EnterShort.

    See the help guide documentation for more information.
    How to make indicator to value comparisons - https://ninjatrader.com/support/help...lueComparisons

    Please let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      What is the significance of the diamonds in the MACD Variation?

      Comment


        #4
        Hello mbyers,

        Thanks for your note.

        This could be seen by downloading the MACD Variation indicator and viewing the script in a New > NinjaScript Editor window.

        A fuchsia diamond will be drawn if the current Close price is less than the WMA indicator AND the current High price is greater than or equal to the EMA indicatior.

        A gray diamond will be drawn if the EMA is greater than the WMA indicator AND the current Close price is greater than the WMA.

        See the code from the MACD Variation indicator below.

        Code:
        if (Close[0] < WMA(WMAPeriod)[0] && High[0] >= EMA(EMAPeriod)[0])
            Draw.Diamond(this, "MyDiamond" + CurrentBar, true, 0, High[0] + 1 * TickSize, UpperDiamondColor);
        
        else if (EMA(EMAPeriod)[0] > WMA(WMAPeriod)[0] && Close[0] > WMA(WMAPeriod)[0])
            Draw.Diamond(this, "MyDiamond" + CurrentBar, true, 0, Low[0] - 1 * TickSize, LowerDiamondColor);
        Let us know if we may assist further.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        56 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        133 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        73 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
        49 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X