NexusFi: Find Your Edge


Home Menu

 





Slope of an indicator, frustrating =/


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Zeos6 with 7 posts (2 thanks)
    2. looks_two Fat Tails with 5 posts (14 thanks)
    3. looks_3 gonzofist with 5 posts (1 thanks)
    4. looks_4 DavidBodhi with 5 posts (1 thanks)
      Best Posters
    1. looks_one Fat Tails with 2.8 thanks per post
    2. looks_two NJAMC with 1.3 thanks per post
    3. looks_3 Big Mike with 1 thanks per post
    4. looks_4 otterway with 1 thanks per post
    1. trending_up 24,821 views
    2. thumb_up 35 thanks given
    3. group 12 followers
    1. forum 47 posts
    2. attach_file 7 attachments




 
Search this Thread

Slope of an indicator, frustrating =/

  #11 (permalink)
 
otterway's Avatar
 otterway 
kansas city
 
Experience: Advanced
Platform: ninjatrader
Broker: IQFeed, Ninja, Own C# with API to Trade King and IB
Trading: stocks
Posts: 39 since Jul 2011
Thanks Given: 22
Thanks Received: 25

this thread is probably dead but maybe someone needs the answer still. First, why should you be interested in slope... Well, it's an immediate response to change and allows for a visual view if using lines, boxes, rectangles... etc to see what's happening. It is easier to view a program and your logic visually...


I am using int names as example to help reason the code

int starting_bar = 4... Bars back
int ending_bar = 0... Now
int smaperiod = 4

double Degree =Math.Round(System.Math.Atan(Slope(SMA(smaperiod),startingbar, endingbar))*180/Math.PI, 2);

if(degree < -45)
....going down
if (degree < -70)
.... going down fast
if (degree > 45)
.... going up
if (degree > 70)
.....going up fast

Let's say you are using pivot points... and you want to tell the last time the price was in the current range... is there a chance of a reversal....

so you will need to store the CurrentBar for the last time it was in the area... I use List<int> for that. Each time the tick is in the area you can just add it to a list.

Then when the last price is in the area... you can draw a line from the last bar in the pivot area to the new price in the current pivot area.. This will visually help you to look at what's going on... And you can check the degree for higher lower... Remember... pivot points change over time... I am enclosing an example of a modified murrymath that I show a reflection of change. I use angles from the old murraymath and the new...

Attached Thumbnails
Click image for larger version

Name:	Murrey.JPG
Views:	439
Size:	254.6 KB
ID:	66248  
Follow me on Twitter Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
Trade idea based off three indicators.
Traders Hideout
Better Renko Gaps
The Elite Circle
How to apply profiles
Traders Hideout
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
My NQ Trading Journal
12 thanks
  #12 (permalink)
 Cloudy 
desert CA
 
Experience: Intermediate
Platform: NT7, various
Broker: various, TDA
Trading: NQ,ES
Posts: 2,124 since Jul 2011
Thanks Given: 2,396
Thanks Received: 1,748


otterway View Post

double Degree =Math.Round(System.Math.Atan(Slope(SMA(smaperiod),startingbar, endingbar))*180/Math.PI, 2);

So in this equation , the "Slope" function returns the ratio y/x of the triangle formed by the SMA of the startingbar to endingbar. Then that result is put into the System.Math.Atan (inverse tan) function which returns the angle in radians. Then that result is multiplied by the 180/pi conversion factor to change from radians to degrees. Is that correct? Does that "Slope" function come with NT7? Thanks.

Perry's continuation method has the indicator MASlopeMulti which shows the angles; but it's all in .dll ..
Nice pic. Makes it look like trading in 3D

Visit my NexusFi Trade Journal Reply With Quote
  #13 (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


You can't properly measure slope on a dynamic scale chart. The slope changes based on the data on the screen.

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:
  #14 (permalink)
 
otterway's Avatar
 otterway 
kansas city
 
Experience: Advanced
Platform: ninjatrader
Broker: IQFeed, Ninja, Own C# with API to Trade King and IB
Trading: stocks
Posts: 39 since Jul 2011
Thanks Given: 22
Thanks Received: 25

Really.....?

The points change yes... but they stay in scale!

My data is reporting the same as I Cntrl Up/Down....

Follow me on Twitter Reply With Quote
Thanked by:
  #15 (permalink)
 
NJAMC's Avatar
 NJAMC 
Atkinson, NH USA
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker: NinjaTrader Brokerage
Trading: Futures, CL, ES, ZB
Posts: 1,970 since Dec 2010
Thanks Given: 3,037
Thanks Received: 2,395


Big Mike View Post
You can't properly measure slope on a dynamic scale chart. The slope changes based on the data on the screen.

Mike

I will try to find it and maybe copy it into a WIKI as @Fat Tails has a good perspective on this calculation. I think the moral of his story is to "normalize" the slope rather than make it visually correct. That way a 1 min and a 5 min chart for the same rise in time will be about equal.

Rise/Run ~= (Price change)/(Delta time over change)

He recently put this together for me and I feel bad I can't put my finger on it right now.

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #16 (permalink)
 
NJAMC's Avatar
 NJAMC 
Atkinson, NH USA
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker: NinjaTrader Brokerage
Trading: Futures, CL, ES, ZB
Posts: 1,970 since Dec 2010
Thanks Given: 3,037
Thanks Received: 2,395

Ah ha!

Found it:

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #17 (permalink)
 
otterway's Avatar
 otterway 
kansas city
 
Experience: Advanced
Platform: ninjatrader
Broker: IQFeed, Ninja, Own C# with API to Trade King and IB
Trading: stocks
Posts: 39 since Jul 2011
Thanks Given: 22
Thanks Received: 25

I didn't think I was suggesting that you can take the slope in a 3 minute chart and compare a slope that was in a 10 range chart... Yes they are different and it would be hopeless to look at the two... If I gave that impression... I am sorry... But slopes and visual lines are very helpful in looking at how to code or how your code is behaving...

Follow me on Twitter Reply With Quote
Thanked by:
  #18 (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


otterway View Post
I didn't think I was suggesting that you can take the slope in a 3 minute chart and compare a slope that was in a 10 range chart... Yes they are different and it would be hopeless to look at the two... If I gave that impression... I am sorry... But slopes and visual lines are very helpful in looking at how to code or how your code is behaving...

But a chart with a High-Low range of 10 points, and a chart with a High-Low range of 20 points, will have a different scale and different slope angle, even though it is identical instrument, time frame, etc.

I will let @Fat Tails answer, he has covered this many times and does a much better job at it than me.

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:
  #19 (permalink)
 
NJAMC's Avatar
 NJAMC 
Atkinson, NH USA
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker: NinjaTrader Brokerage
Trading: Futures, CL, ES, ZB
Posts: 1,970 since Dec 2010
Thanks Given: 3,037
Thanks Received: 2,395


otterway View Post
I didn't think I was suggesting that you can take the slope in a 3 minute chart and compare a slope that was in a 10 range chart... Yes they are different and it would be hopeless to look at the two... If I gave that impression... I am sorry... But slopes and visual lines are very helpful in looking at how to code or how your code is behaving...

That is I think the point @ Fat Tails makes. How I digest his suggestion is that "Slope" be calculated as if it is plotted on the same Full Chart rather than zoomed in. I think there is a visual aspect of a zoomed in section of a chart (looks like 45degrees to me) but as you zoom out (by changing just the X or just the Y) the angle will change. Certainly if you maintain the aspect ratio it isn't a big deal.

First and foremost, we probably should disclose "Angle/Slope" calculations within our indicators so the user knows if they can apply that "angle" to other charts they are looking at or if it is almost simply a "Local Reference".

Not sure this makes sense as I am still struggling a bit myself, but this is how I have internalized the problem/concern. (Prior to Fat Tails discussion, I didn't think much of it but you look at Perry's system where he looks at the angle of multiple time-frames. This is where I think it is critical, single timeframe and instrument, not so much)

I have created a WIKI to help document this issue as it is complex: https://nexusfi.com/wiki/trading-wiki/Concept-of-Slope-Angle-in-indicators

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Visit my NexusFi Trade Journal Reply With Quote
  #20 (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


Slope is a geometrical concept that was useful, when people had their daily charts printed out with ever the same time scale on the x-axis and the same price scale on the y-axis. The geometrical concept of slope was simply used to describe momentum. A steep slope meant high momentum, a horizontal line meant no momentum.

With charting software that distorts the x-axis, at least for non time based-charts in equidistant mode and that autoscales the y-axis, the geometrical concept of slope makes no sense. It does no more represent momentum, but is just an optical illusion.

If you want to measure momentum, you can create an indicator that calculates the slope, as if the x-axis was teim-based and non-compressible and as if the y-Axis would use a fixed scale. This exercise will yield you an artificial angle, which can be used as a proxy for momentum, but is different from the angle which you will see on your chart. To calculate the artificial angle you need to compare the directional price move to intrabar volatility, by dividing the n-bar momentum by n times the average true range or standard deviation. You can then use the result to get your much-loved angles.

I do not use angles. In my opionion it is simply nonsense to use angles on charts with a non-linear, compressible time axis and/or an autoscaling y-axis. Better use momentum or the rate of change.

Reply With Quote




Last Updated on April 10, 2023


© 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