Need help for EMA slope startegy - NinjaTrader Programming | futures io social day trading

Need help for EMA slope startegy
 Updated: September 2nd, 2012 (12:58 PM) Views / Replies: 1,393 / 5 Created: August 31st, 2012 (11:11 AM) by michaelf Attachments: 0

 Welcome to futures io.

# Need help for EMA slope startegy

 August 31st, 2012, 11:11 AM #1 (permalink) Elite Member Mérida, Mexico   Futures Experience: Intermediate Platform: NinjaTrader 8 Broker/Data: looking Favorite Futures: CL     Posts: 508 since Mar 2011 Thanks: 1,153 given, 512 received Need help for EMA slope startegy Happy Jackson Hole Day to everybody, lol I need some help to write a Strategy that plots vertical lines into a chart. I wrote everything with the Strategy Wizard and it is working, surprise! Now I would like to add a condition and with that one I have a problem. I would like an EMA with slope, for example 20 degree = flat. Flat = no plot. What is the parameter to write that? Thanks a lot michael

 August 31st, 2012, 11:11 AM #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.

Elite Member
Tampa, FL

Futures Experience: Beginner
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: 6E, M6E, 6J

Posts: 1,374 since Dec 2011

michaelf
 Happy Jackson Hole Day to everybody, lol I need some help to write a Strategy that plots vertical lines into a chart. I wrote everything with the Strategy Wizard and it is working, surprise! Now I would like to add a condition and with that one I have a problem. I would like an EMA with slope, for example 20 degree = flat. Flat = no plot. What is the parameter to write that? Thanks a lot michael

You couldn't really look at degrees for slope, because this would change based how zoomed in you were on the chart. You could add a plot, say myEMA was Plot[0].
Then add a variable for slope, say mySlope. mySlope would be ema value change over one bar.
Then
if(myEMA[0] - myEMA[1] <= mySlope && myEMA[0] - myEMA[1] >= -mySlope) PlotColors[0][0] = Color.Transparent;
else if(myEMA[0] - myEMA[1] > mySlope)PlotColors[0][0] = Color.Green;
else PlotColors[0][0] = Color.Red;

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

Elite Member
New York

Futures Experience: Intermediate
Broker/Data: IB
Favorite Futures: ES, YM, Currency Futures

Posts: 79 since May 2010

You can use the normalized slope. This is how I calculated the slope for ES on hourly chart.

Code
 ```double _slope = Slope(_ema, 5); // this is slope per candle double _slopeN = 24 * 100 * _slope / Close[0]; // slope in percent per day // this assumes that 45 degree is 2% change in 4 days. // change the multiplier as per your assumption double _angle = 180 * Math.Atan(2 * _slopeN) / Math.PI;```
Hope this helps.

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

Elite Member
Mérida, Mexico

Futures Experience: Intermediate
Broker/Data: looking
Favorite Futures: CL

Posts: 508 since Mar 2011

You can use the normalized slope. This is how I calculated the slope for ES on hourly chart.

Code
 ```double _slope = Slope(_ema, 5); // this is slope per candle double _slopeN = 24 * 100 * _slope / Close[0]; // slope in percent per day // this assumes that 45 degree is 2% change in 4 days. // change the multiplier as per your assumption double _angle = 180 * Math.Atan(2 * _slopeN) / Math.PI;```
Hope this helps.

Thank you, but I need do to it with the Strategy Wizard, I still don't understand how do write codes directely in the startegy.

 September 2nd, 2012, 12:58 PM #6 (permalink) Elite Member Tampa, FL   Futures Experience: Beginner Platform: NinjaTrader, Sierra Chart Broker/Data: Mirus Futures/Zen-Fire Favorite Futures: 6E, M6E, 6J     Posts: 1,374 since Dec 2011 Thanks: 1,452 given, 3,354 received Search NT support forum for slope simple. Its a slope indicator, but I don't have the original anymore.
 The following user says Thank You to Xav1029 for this post:

 futures io > Need help for EMA slope startegy

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

Elite only

Elite only

Jan 18

Jan 23

Elite only

Elite only

## Ran Aroussi: TBA

Elite only

 Similar Threads Thread Thread Starter Forum Replies Last Post perryg NinjaTrader Programming 7 January 19th, 2012 09:45 AM trs3042 NinjaTrader 5 January 13th, 2011 03:28 PM cbritton EasyLanguage Programming 5 December 1st, 2010 03:09 PM Zoethecus NinjaTrader Programming 2 October 5th, 2010 07:11 PM emini_Holy_Grail Traders Hideout 1 February 22nd, 2010 01:04 PM

All times are GMT -4. The time now is 04:56 PM.

 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-13 in 0.09 seconds with 19 queries on phoenix via your IP 54.90.92.204