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,450 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

Need help for EMA slope startegy

  #1 (permalink)
 
michaelf's Avatar
 michaelf 
Mérida, Mexico
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8
Broker: NinjaTrader Brokerage
Trading: MNQ
Frequency: Daily
Duration: Minutes
Posts: 559 since Mar 2011
Thanks Given: 1,432
Thanks Received: 581

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 Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
Futures True Range Report
The Elite Circle
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Exit Strategy
NinjaTrader
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
Battlestations: Show us your trading desks!
26 thanks
The Program
18 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 Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #5 (permalink)
 
michaelf's Avatar
 michaelf 
Mérida, Mexico
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8
Broker: NinjaTrader Brokerage
Trading: MNQ
Frequency: Daily
Duration: Minutes
Posts: 559 since Mar 2011
Thanks Given: 1,432
Thanks Received: 581


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 Twitter 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


© 2024 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 - Privacy Policy - Downloads - Top
no new posts