Get the EMA of a double value??? - NinjaTrader Programming | futures io social day trading
futures io futures trading


Get the EMA of a double value???
Updated: Views / Replies:1,971 / 4
Created: by Curbfeeler Attachments:0

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 90,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

Reply
 
Thread Tools Search this Thread
 

Get the EMA of a double value???

  #1 (permalink)
Elite Member
Des Moines, IA
 
Futures Experience: Beginner
Platform: NinjaTrader
 
Posts: 22 since Nov 2009
Thanks: 33 given, 16 received

Get the EMA of a double value???

A guy named Prospectus put out a free indicator for ThinkorSwim.

http://readtheprospectus.wordpress.com/2009/01/30/volatility-based-trailing-stop/

He designed it as a trailing stop, but I've found that it's very close to Step MA and that it might be helpful as a trend indicator.

Long story short, I'd like to backtest this indicator against my /ES tick data and see how it does. I want to recreate the indicator in NinjaTrader.

The logic is pretty simple.

# Calculate average range for volatility:
#
def atr = expaverage(high-low,length);
#
# Calculate initial short and long volatility stop values:
#
def svs =low+ceil(mult*atr/ticksize())*ticksize();
def lvs =high-ceil(mult*atr/ticksize())*ticksize();

To complete the first part, I basically need the EMA of the (high - low) price.

So what's the best way to calc the EMA for something that's not a price or a dataset? In this case the difference is just a floating point number. Should I set that into a new dataset? Should I use an array?

Any help is appreciated. Thanks in advance.


Last edited by Big Mike; April 2nd, 2010 at 12:24 PM. Reason: moved to ninjatrader programming
Reply With Quote
 
  #2 (permalink)
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.

 
  #3 (permalink)
 Vendor: www.integrity-traders.com 
East Rochester, NY
 
Futures Experience: Intermediate
Platform: NT
 
eDanny's Avatar
 
Posts: 327 since Jul 2009
Thanks: 17 given, 419 received

Answer
This post has been selected as an answer to the original posters question Answer


Create a Data Series and then do the calc for each bar in the Data Series.

HighLowSeries.Set(High[0] - Low[0]);

EMA(HighLowSeries, length)[0];

Reply With Quote
The following 2 users say Thank You to eDanny for this post:
 
  #4 (permalink)
Trading for Fun
Dallas TX/USA
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: AMP/CQG
Favorite Futures: ES
 
Posts: 154 since Jun 2009
Thanks: 33 given, 281 received

Answer
This post has been selected as an answer to the original posters question Answer


Curbfeeler View Post
So what's the best way to calc the EMA for something that's not a price or a dataset? In this case the difference is just a floating point number. Should I set that into a new dataset? Should I use an array?

Since it's just an ema, you can do this (for an object variable 'double ema'):

 
Code
 ema = ema + (2.0/(len+1.0))*( (High[0]-Low[0]) - ema );
... but if you want to use ninja's built-in EMA indicator, then define a dataseries 'highlow', and initialize it in Initialize():
 
Code
highlow = new DataSeries(this);
... and use it like so:
 
Code
highlow.Set(High[0] - Low[0]);
ema = EMA(highlow, len)[0];

Reply With Quote
The following 3 users say Thank You to Richard for this post:
 
  #5 (permalink)
 Vendor: www.tradingstudies.com 
Denver, CO
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Amp Futures/Zen-Fire
Favorite Futures: TF, ES, CL
 
roonius's Avatar
 
Posts: 132 since Jun 2009
Thanks: 20 given, 272 received


eDanny View Post
Create a Data Series and then do the calc for each bar in the Data Series.

HighLowSeries.Set(High[0] - Low[0]);

EMA(HighLowSeries, length)[0];


NinjaTrader has already everything built-in:

EMA(Range(), length)[0];

Reply With Quote

Reply



futures io > > > > > Get the EMA of a double value???

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
EMA for CCI perryg NinjaTrader Programming 7 January 19th, 2012 09:45 AM
Double bottom and Double top with DIV benbrooke NinjaTrader Programming 36 December 6th, 2011 01:29 PM
DOUBLE DOUBLE STOCHASTICS Jeff Castille The Elite Circle 112 September 5th, 2011 12:40 AM
Holt EMA cbritton EasyLanguage Programming 5 December 1st, 2010 03:09 PM
MACD: The 12-period (EMA) minus 26 EMA emini_Holy_Grail Traders Hideout 1 February 22nd, 2010 01:04 PM


All times are GMT -4. The time now is 12:42 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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 2017-12-16 in 0.09 seconds with 27 queries on phoenix via your IP 54.226.113.250