Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Slope of EMA

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

    Slope of EMA

    I am trying to use the slope of the EMA line as a condition in an order script. Basically I want to know if the EMA has peaked between current bar and, say, second prior bar and is now on a negative slope. I've tried basic stuff like:

    bool slopeEma = EMA(9)[0] - EMA(9)[2] < 0

    Doesn't work though. Is it possible to calculate what I am trying to get?

    #2
    Hello bgump55,

    Thanks for your post.

    The Slope() method could be used to get the slope of an indicator plot.

    You could consider saving the Slope() value of the EMA to a custom Series<double> object named something like "EMASlope" if you want to compare the current Slope value to the previous Slope value.

    For example, EMASlope[0] > EMASlope[1] would compare the current value to the previous value.

    See this help guide page for more information about Slope() and sample code: https://ninjatrader.com/support/help.../nt8/slope.htm

    See this help guide page for more information about custom Series objects: https://ninjatrader.com/support/help...t8/seriest.htm
    Last edited by NinjaTrader_BrandonH; 02-04-2024, 06:21 PM.
    <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
    63 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