NexusFi: Find Your Edge


Home Menu

 





MA slope without a Chart or Plot


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one vantojo with 6 posts (0 thanks)
    2. looks_two Fat Tails with 4 posts (5 thanks)
    3. looks_3 Big Mike with 1 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 3,303 views
    2. thumb_up 6 thanks given
    3. group 2 followers
    1. forum 11 posts
    2. attach_file 0 attachments




 
Search this Thread

MA slope without a Chart or Plot

  #1 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

Hi Guys,

Is there any code around for calculating the slope of an MA that would be designed to only run in Market Analyzer?

I don't want to do a Plot override if possible (for future conversion to NT 8, I imagine this is going to be messy) and also want to keep the code very simple.

So, it would be better, if possible that it didn't need chart code at all.

Also, a lot of the slope code I've seen tries to be a Swiss Army Knife with tons of options and tons of types of MA.

I am going to have background processes that use this data, but I don't need to see it.

I will be using EMA or SMA, nothing more.

Thanks in advance

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Increase in trading performance by 75%
The Elite Circle
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Tao te Trade: way of the WLD
24 thanks
My NQ Trading Journal
14 thanks
HumbleTraders next chapter
11 thanks
GFIs1 1 DAX trade per day journal
11 thanks
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102



vantojo View Post
Hi Guys,

Is there any code around for calculating the slope of an MA that would be designed to only run in Market Analyzer?

I don't want to do a Plot override if possible (for future conversion to NT 8, I imagine this is going to be messy) and also want to keep the code very simple.

So, it would be better, if possible that it didn't need chart code at all.

Also, a lot of the slope code I've seen tries to be a Swiss Army Knife with tons of options and tons of types of MA.

I am going to have background processes that use this data, but I don't need to see it.

I will be using EMA or SMA, nothing more.

Thanks in advance


You don't want to use the slope. You can simply use the rise-over-run and normalize it by dividing through the average true range.

As an option you can further smooth the moving average with a 2-period SMA. This helps to avoid whipsaws.

You can then directly write that value to a plot. You do not need to override any plot.

The plot can be directly accessed via the market analyzer.

The indicator can be coded in a few minutes.

Reply With Quote
  #4 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

Hi Fat Tails,

What I'm looking for is the "instantaneous slope" or "line tangent".....

I'm not a math guy...not sure if what you suggest gives this?

Started this thread Reply With Quote
  #5 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

I found this Matlab code... (it is not C#)

I guess I'll have to learn a new language...there are lots of algos published in matlab

==========================================================

File Exchange - MATLAB Central


also interesting

File Exchange - MATLAB Central

============================================================

don't know yet if I'm "barking up the wrong tree"

Started this thread Reply With Quote
  #6 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


vantojo View Post
Hi Fat Tails,

What I'm looking for is the "instantaneous slope" or "line tangent".....

I'm not a math guy...not sure if what you suggest gives this?


Charting programs are scalable. The absolute value of the slope as no meaning. You need to move away from geometrical concepts.

The simple slope value or line tangent can be calculated as the rise over run with the run being 1.

It is simply the change of the indicator value.

As I have tried to explain, you should normalize this result by dividing through the average true range.

If you do not normalize, you will have a different scale for each instrument, each bar type and each time frame.


Rescaling the slope

To understand normalization, please have a look at the RSI and the MACD.

The RSI is a normalized indicator. Whatever instrument you selecrt, whatever chart you apply it to, whatever bar period you select, the overbought line is always located at 70. If you add a MACD to your chart, the values you will read depend on instrument, bar type and bar period and have no meaning. What would be your conclusion, if the MACD value 0.278, what iwould be your conclusion if the market analyzer display a MACD of 5.16?

Slope as well only makes sense, if you read it against a normalized scale. Temperature also requires a scale to measure it. Without a scale any information bcomes is useless. Therefore you need to rescale the slope by normalizing it. After normalizing you can compare different values obtained for the slope.

Reply With Quote
Thanked by:
  #7 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012


Fat Tails View Post
Charting programs are scalable. The absolute value of the slope as no meaning. You need to move away from geometrical concepts.

The simple slope value or line tangent can be calculated as the rise over run with the run being 1.

It is simply the change of the indicator value.

As I have tried to explain, you should normalize this result by dividing through the average true range.

If you do not normalize, you will have a different scale for each instrument, each bar type and each time frame.


Rescaling the slope

To understand normalization, please have a look at the RSI and the MACD.

The RSI is a normalized indicator. Whatever instrument you selecrt, whatever chart you apply it to, whatever bar period you select, the overbought line is always located at 70. If you add a MACD to your chart, the values you will read depend on instrument, bar type and bar period and have no meaning. What would be your conclusion, if the MACD value 0.278, what iwould be your conclusion if the market analyzer display a MACD of 5.16?

Slope as well only makes sense, if you read it against a normalized scale. Temperature also requires a scale to measure it. Without a scale any information bcomes is useless. Therefore you need to rescale the slope by normalizing it. After normalizing you can compare different values obtained for the slope.


To clarify...

I only use range bars on all instruments... 4 Range and 10 Range... never anything else....

I never use time based bars...second, minute, hour, day... none of those

I believe I understand what you say would make a difference on time based bars....but am not sure it would be the same on a Range bars...because there is no time basis at all on the X axis, and each bar has the same length.

I will have to spend some time with your suggestion so I can visualize it and see if it produces the results I need. At this moment I don't know, without testing it.

Can you comment on the Range bar issue and Slope?

Thank you.

Started this thread Reply With Quote
  #8 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

I'm outside my area of expertise...but it seems to me that a "simple slope (rise / run)" is not the same as "line tangent"

"Simple slope" is geometry, and "line tangent" is calculus?

I believe they use the terminology "line tangent" because it is the slope of the tangent line at an exact point on the curve, not the simple slope between two points on the curve.

From what I understand "line tangent" is the slope at any moment in time on the curve...on a dynamic curve (MA/SMA) the "line tangent" changes as the curve in each moment on the curve....so it is "slope of that instant" (instantaneous slope) and not a simple slope from the beginning of the curve to the end of the curve or rise/run.

Please correct me if I'm wrong.

Started this thread Reply With Quote
  #9 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


vantojo View Post
I'm outside my area of expertise...but it seems to me that a "simple slope (rise / run)" is not the same as "line tangent"

"Simple slope" is geometry, and "line tangent" is calculus?

I believe they use the terminology "line tangent" because it is the slope of the tangent line at an exact point on the curve, not the simple slope between two points on the curve.

From what I understand "line tangent" is the slope at any moment in time on the curve...on a dynamic curve (MA/SMA) the "line tangent" changes as the curve in each moment on the curve....so it is "slope of that instant" (instantaneous slope) and not a simple slope from the beginning of the curve to the end of the curve or rise/run.

Please correct me if I'm wrong.


Marthematically, the concept of the line tangent can only be applied to a continuous function. However, any price time graph is not continuous but discrete. Therefore, it is impossible to calculate a line tangent.

With discrete values, the concept of the tangent is replaced with the slope, where

slope = price difference / time interval = rise / run = rise over run


The slope that comes closes to the tangent, is the slope calculated from the smallest available time interval, which is made up from two adjacent bars.

This is exactly, what I have suggested to use. However, in a second step you should divide that slope by the average true range

normalized slope = rise over run / average true range

which is what you may display on your market analyzer.


Am I repeating myself ?

Reply With Quote
Thanked by:
  #10 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,440 since Jun 2009
Thanks Given: 33,212
Thanks Received: 101,599



Fat Tails View Post
Am I repeating myself ?

Anyone can convince themselves how useful something is, if they try hard enough

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on March 29, 2015


© 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