Using slope of an indicator in an auto-strategy - futures io
futures io



Using slope of an indicator in an auto-strategy


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one nanobiotech with 2 posts (1 thanks)
    2. looks_two Quick Summary with 1 posts (0 thanks)
    3. looks_3 sam028 with 1 posts (8 thanks)
    4. looks_4 Zoethecus with 1 posts (0 thanks)
    1. trending_up 5,411 views
    2. thumb_up 9 thanks given
    3. group 4 followers
    1. forum 4 posts
    2. attach_file 1 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
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

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Using slope of an indicator in an auto-strategy

(login for full post details)
  #1 (permalink)
 nanobiotech 
Brisbane, Australia
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus/Zen-Fire
Trading: CL
 
nanobiotech's Avatar
 
Posts: 670 since Jun 2009
Thanks: 134 given, 429 received

I have a question for those amongst us that understand indicator code (I'm not too good at this yet) in order to access indicators in a strategy.

A nice example is the attached MASlopeBoxMulti indicator, which can display the slope of any of a good selection of moving average indicators.

My question is: how can the slope that is displayed on the chart be used as an entry or exit trigger in a strategy? How can we code for this in a strategy?

Cheers,
Nano

Attached Files
Register to download File Type: zip MASlopeBoxMulti.zip (31.3 KB, 159 views)
Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
For the experts of Metastock
Platforms and Indicators
TradingView help in improving Anchored Vwap
Platforms and Indicators
CME removal of 16:15-30 trading halt/effect on OHL
Emini and Emicro Index
MacdBB V402 NT804 + gradient + pullback not working on N …
NinjaTrader
TD Sequential for NT or MW?
Platforms and Indicators
 
 
(login for full post details)
  #3 (permalink)
 sam028 
Site Moderator
 
 
sam028's Avatar
 
Posts: 3,680 since Jun 2009
Thanks: 3,793 given, 4,519 received


In your .zip, a DataSeries is used to store the slope, but it's not always needed.
You can just use a variable, which stores the current slope, computed using the 3 previous values of the "thing" you want to apply/compute the slope.
For example, the slope of a EMA(20), in degrees:

 
Code
                            
//init

private int _ema20slope ;
...
// OnBarUpdate()
_ema20slope = (int)(180/Math.PI*(Math.Atan((EMA(20)[0]-(EMA(20)[1]+EMA(20)[2])/2)/1.5/TickSize)));
if (
_ema20slope 45) { golong();}
if (
_ema20slope < -45) { goshort();} 

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
The following 8 users say Thank You to sam028 for this post:
 
(login for full post details)
  #4 (permalink)
 nanobiotech 
Brisbane, Australia
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus/Zen-Fire
Trading: CL
 
nanobiotech's Avatar
 
Posts: 670 since Jun 2009
Thanks: 134 given, 429 received


sam028 View Post
In your .zip, a DataSeries is used to store the slope, but it's not always needed.
You can just use a variable, which stores the current slope, computed using the 3 previous values of the "thing" you want to apply/compute the slope.
For example, the slope of a EMA(20), in degrees:

 
Code
                            
//init

private int _ema20slope ;
...
// OnBarUpdate()
_ema20slope = (int)(180/Math.PI*(Math.Atan((EMA(20)[0]-(EMA(20)[1]+EMA(20)[2])/2)/1.5/TickSize)));
if (
_ema20slope 45) { golong();}
if (
_ema20slope < -45) { goshort();} 

Sam, I'm seriously impressed. Thank you. I'll have a go.

Nano

Started this thread Reply With Quote
The following user says Thank You to nanobiotech for this post:
 
(login for full post details)
  #5 (permalink)
 Zoethecus 
United States of America
 
Experience: Advanced
Platform: NT
 
Posts: 1,149 since Aug 2009


nanobiotech View Post
Sam, I'm seriously impressed. Thank you. I'll have a go.

Nano

Sam is the best. A major assest and a true professional.

Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Using slope of an indicator in an auto-strategy


Last Updated on August 6, 2010


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing

Your Charts Should Speak To You w/Bob Cometta

Elite only
 

Our 12-year anniversary w/ $$,$$$ prizes (check soon)

August
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), 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