Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

difference EMA and PRICE in %

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

    difference EMA and PRICE in %

    Hello ,any ideas on how to create this histogram indicator? thanks for any help

    Calculation
    The formula for this indicator is quite simple:
    Copy(close - MA)/MA
    The MA value is subtracted from the close in order to determine the difference between the two values. The difference is divided by the MA value in order to convert the raw value to a percentage.
    Note: Our formula above is not specific about the type of moving average. This indicator can be charted with either a simple or exponential moving average (SMA or EMA).
    Attached Files

    #2
    Hello janio973,

    If you are new to indicator development I would suggest looking at some of the simple indicators like the EMA or SMA or Bollinger, those show some of the basic plotting and math concepts. The equation you want would be written as:

    Code:
    double sma = SMA(12)[0];
    double result =(Close[0] - sma) / sma;

    Comment


      #3
      Thanks NinjaTrader_Jesse for your help ​,
      Usually I make a strategy and then transform it into an indicator
      But I dont have and idea where to paste the code above..but I will search
      Can you suggest one indicator where I can paste it,I try MACD but fail and almost block my platform

      Comment


        #4
        Hello janio973,

        That would go in OnBarUpdate. That is just the calculation, you would still have to display it by using a Plot or Drawing Object.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        52 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        142 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        160 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        96 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        276 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X