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 2,957 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
Legendary Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8
Broker: NinjaTrader Brokerage
Trading: MES
Frequency: Daily
Duration: Minutes
Posts: 570 since Mar 2011
Thanks Given: 1,447
Thanks Received: 597

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?
I Have a Thing Called Iran -- Trump Stays in DC as Airsp …
Prediction Markets & Event Contracts
Peace Deal Forward Curve: May 22%, June 51%, December 81 …
Prediction Markets & Event Contracts
Prediction Markets Expiry Day: Trump Eyes War Exit, $230 …
Prediction Markets & Event Contracts
One Wallet Made $200K in Hours: AP Probes Polymarket Cea …
Prediction Markets & Event Contracts
Thursday May 28: GDP + Core PCE + Jobless Claims All at …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
7 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 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,377



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
Legendary Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8
Broker: NinjaTrader Brokerage
Trading: MES
Frequency: Daily
Duration: Minutes
Posts: 570 since Mar 2011
Thanks Given: 1,447
Thanks Received: 597


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

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