NexusFi: Find Your Edge


Home Menu

 





Need help for EMA slope startegy


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one michaelf with 2 posts (0 thanks)
    2. looks_two Xav1029 with 2 posts (2 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 TraderSU with 1 posts (1 thanks)
    1. trending_up 3,110 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 
michaelf's Avatar
 michaelf 
Mérida, Mexico
 
Experience: Intermediate
Platform: NinjaTrader 8
Broker: NinjaTrader Brokerage
Trading: MES
Frequency: Daily
Duration: Minutes
Posts: 571 since Mar 2011
Thanks Given: 1,453
Thanks Received: 601

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


Follow me on X Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Warsh Drops Easing Bias, December Hike Now Above 50% -- …
Prediction Markets & Event Contracts
Iran Lebanon Problem Kills Switzerland Talks, Brent at $ …
Prediction Markets & Event Contracts
Netherlands & Germany Surge as World Cup Field Narro …
Prediction Markets & Event Contracts
Without Pulisic, USA 61.5% Live vs. Australia -- France …
Prediction Markets & Event Contracts
Datafeed for Atas
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Want your NinjaTrader indicator created, free?
5 thanks
Afternoon-close session
1 thanks
Franks Trading Journey
1 thanks
Denied 20K payouts: Alpha Futures
1 thanks
FootPrintV2 Chart for NT8
1 thanks
  #3 (permalink)
 
Xav1029's Avatar
 Xav1029 
Tampa, FL
 
Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker: Mirus Futures/Zen-Fire
Trading: 6E, M6E, 6J
Posts: 1,375 since Dec 2011
Thanks Given: 1,452
Thanks Received: 3,378



michaelf View Post
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;


Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
 TraderSU 
New York
 
Experience: Intermediate
Platform: NinjaTrader, Custom Platform
Broker: IB
Trading: ES, YM, Currency Futures
Posts: 79 since May 2010
Thanks Given: 46
Thanks Received: 75

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.


Follow me on X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #5 (permalink)
 
michaelf's Avatar
 michaelf 
Mérida, Mexico
 
Experience: Intermediate
Platform: NinjaTrader 8
Broker: NinjaTrader Brokerage
Trading: MES
Frequency: Daily
Duration: Minutes
Posts: 571 since Mar 2011
Thanks Given: 1,453
Thanks Received: 601


TraderSU View Post
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.


Follow me on X Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #6 (permalink)
 
Xav1029's Avatar
 Xav1029 
Tampa, FL
 
Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker: Mirus Futures/Zen-Fire
Trading: 6E, M6E, 6J
Posts: 1,375 since Dec 2011
Thanks Given: 1,452
Thanks Received: 3,378

Search NT support forum for slope simple. Its a slope indicator, but I don't have the original anymore.


Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on September 2, 2012


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts