Reverse Exponential Moving Average - NinjaTrader Programming | futures io social day trading
futures io futures trading

Reverse Exponential Moving Average
Updated: Views / Replies:1,970 / 3
Created: by cutzpr Attachments:1

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Thread Tools

Reverse Exponential Moving Average

United States
Trading Experience: None
Platform: MT4,TWS,Ninja Trader
Favorite Futures: Forex
cutzpr's Avatar
Posts: 30 since Apr 2012
Thanks: 9 given, 6 received

Reverse Exponential Moving Average

Does anyone have a Reverse Exponential Moving Average ninjascript? Or can help me convert this code from Amibrokers to Ninjatrader

// Reverse EMA function, by D.Tsokakis, June 2003



Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

United States
Trading Experience: None
Platform: MT4,TWS,Ninja Trader
Favorite Futures: Forex
cutzpr's Avatar
Posts: 30 since Apr 2012
Thanks: 9 given, 6 received

I need some coding/math guru's to please let me know what is wrong with this code. The formula for a
Please register on to view futures trading content such as post attachment(s), image(s), and screenshot(s).

There are two different methods to calc this formula which I believe I coded correctly, but all I am getting is essentially a straight line, not a moving average even after verifying different inputs. Is there something wrong with the coding of the formula? or how I am processing the bars? Please assist.

public class ReverseEMA Indicator

//public Series<double> rEMA; 
int kcalcbar ;     
double lambda,lambdatornumerator,denominator,quotient;

override void OnStateChange()
            if (
State == State.SetDefaults)
Description                            = @"ReverseEMA";
Name                                "ReverseEMA";
Calculate                            Calculate.OnBarClose;
IsOverlay                            true;
DisplayInDataBox                    true;
DrawOnPricePanel                    true;
DrawHorizontalGridLines                true;
DrawVerticalGridLines                true;
PaintPriceMarkers                    true;
ScaleJustification                    NinjaTrader.Gui.Chart.ScaleJustification.Right;
//Disable this property if your indicator requires custom values that cumulate with each new market data event. 
                //See Help Guide for additional information.
IsSuspendedWhileInactive            true;
Period                    10;
BarsRequiredToPlot Period// Do not plot until their are atleast enough bars to calcu REMA

            else if (
State == State.Configure)
//rEMA    = new Series<double>(this);
lambda=  2.0 / (k);
lambdator   1.0;  
numerator   0.0;
denominator 0.0;  // REMA formula-expansion contains +1 at the end, never less, never negative
//protected override void OnStateChange()

protected override void OnBarUpdate() 
        if (
CurrentBars[0] < BarsRequiredToPlot) return; // Ensures we have enough bars loaded for our iterations and indicator    
if (CurrentBar == 0Value[0] = Input[0]; // Sets temp value for indicator first bar
        Only used for error checking if Lambda will be independant 
        of Period
            if (  lambda <= 0.0        // lambda shall not fall on/under  0.0
               || lambda >  1.0        //        shall not grow beyond    1.0
               || k      <= 0          // depth  shall not be negative or 0
               return -1.0;            // context-protecting RET value
        First way for code formula
double quotient;
        for (
int ReversePTR  kReversePTR >0ReversePTR--)
calcbar CurrentBar ReversePTR;     
numerator   += Math.Pow(lambda,k-ReversePTR) * Input[calcbar];
denominator += Math.Pow(lambda,k-ReversePTR);
quotient =     numerator denominator;
" I am on bar " CurrentBar +  
"\r\n The CalcBar is " calcbar +
"\r\n The Price is " Input[calcbar] + 
"\r\n The ReversePTR is " ReversePTR 
"\r\n The current count is " + (k-ReversePTR) +
"\r\n The Lambda is " Math.Pow(lambda,k-ReversePTR) + 
"\r\n The Numerator is " numerator 
"\r\n The Denominator is " denominator +
"\r\n The quotient is " quotient 
Values[0][0] =  (numerator denominator);
" The REMA is " Values[0][0] +

        Second way for code formula
        for (int ReversePTR  = k; ReversePTR >0; ReversePTR--)
            calcbar = CurrentBars[0] - ReversePTR;
            numerator   += lambdator * Input[calcbar];                                        
            denominator += lambdator;
            lambdator   *= lambda;
            quotient =     numerator / denominator;
            Print(" I am on bar " + CurrentBar +  
                "\r\n The CalcBar is " + calcbar +
                "\r\n The Price is " + Input[calcbar] + 
                "\r\n The ReversePTR is " + ReversePTR + 
                "\r\n The current count is " + (k-ReversePTR) +
                "\r\n The Lambdator is " + lambdator + 
                "\r\n The Numerator is " + numerator + 
                "\r\n The Denominator is " + denominator +
                "\r\n The quotient is " + quotient + 
                "\r\n -------------------------");        
        Values[0][0] =  (numerator / denominator);
        Print(" The REMA is " + Values[0][0] + 
//protected override void OnBarUpdate() 

Attached Files
Register to download File Type: cs CC.ReverseEMA.cs (7.0 KB, 15 views)
Leesburg, VA
Trading Experience: Advanced
Platform: NinjaTrader
Posts: 80 since Aug 2010
Thanks: 74 given, 32 received

Done for you

Did you ever get this going?. The new S&C article has links to code for NT7 & 8 and other platforms.


The following user says Thank You to buzzsaw for this post:


futures io > > > > > Reverse Exponential Moving Average
Thread Tools

Upcoming Webinars and Events (4:30PM ET unless noted)

futures io is celebrating 10-years w/ over $18,000 in prizes!

Right now

Thanks for everything -- $250 in Amazon Gift Cards ready to give away

Right now

Journal in July -- over $2,500 in prizes w/NinjaTrader


Similar Threads
Thread Thread Starter Forum Replies Last Post
moving average monsieur NinjaTrader 1 November 29th, 2015 05:23 PM
What are these moving average? Mopaditi NinjaTrader 3 September 24th, 2014 03:11 PM
Best Moving Average sharmas Elite Automated Trading 62 April 9th, 2012 06:44 PM
Moving Average Kush NinjaTrader Programming 5 November 6th, 2011 12:49 PM
Moving average Help yiman NinjaTrader Programming 4 July 29th, 2011 08:03 AM

average, code, coding, ema, error, guru, information, market data, moving average, ninja, ninjascript, ninjatrader, nt7, reverse, values

All times are GMT -4. The time now is 07:16 PM. (this page content is cached, log in for real-time version)

Copyright © 2019 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432 WhatsApp Business,
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2019-06-23 in 0.20 seconds with 15 queries on phoenix