double SlopeExample = Slope(15, 5, 0); //slope of last 5min double degreesExample = Math.Atan(SlopeExample) * (180 / Math.PI);
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Slope into degrees need ticksize conversion?
Collapse
X
-
Slope into degrees need ticksize conversion?
I followed the example given in the Slope() method on NT8 guide to convert the slope into degrees as follow:
Code:
Tags: None
-
Hello Boonfly8,
Multiplying by the TickSize should not be necessary.
Are you finding the value of Slope() is unexpected?
I would expect different instruments slope to be different... Are you measuring these and finding the amount of price change is exactly the same but the slope is a different value?
Below is a public link to the help guide on Slope().
Chelsea B.NinjaTrader Customer Service
-
Hi Chelsea,
After converting the slope to degrees, it seems like the value needs a factor multiplier for some reason. For example, the the degree for ES and CL is that looks like CL needs to be multiplied by 10 to get the values to make sense. You can just copy the formula above and take a look for ES and CL and you'll see the difference. Like you said, I would expect the degree to be a value that is applicable to any and all instruments, but not sure what is happening here.
Comment
-
To further illustrate, please take a look at the attached two graphs with the same exact indicator formula for finding slope then converting it to degrees.
Notice the values are drastically different for different markets while market conditions that produced the slope/degree values are not that different.2 Photos
Comment
-
Hello Boonfly8,
You are comparing two different instruments that have different sized movements in the market. One of these is traveling a greater distance than the other. I would not expect two instruments with different tick sizes to have similar slope.
However, I would need to see that you are performing the math on a calculator and finding the value of the slope is incorrect without using visual charts or plots that can be misleading.
Are you manually performing the math for slope and finding the Slope() method is returning incorrect values?Chelsea B.NinjaTrader Customer Service
Comment
-
hi Chelsea, to further illustrate, I have attached the slope value for 6E. notice the values are drastically different.
The indicator is as follows:
Code:double SlopeSMA = Slope(SMA(15), 5, 0); //slope of last 5min using 15SMA double degreesOutput = Math.Atan(SlopeSMA) * ((180 / Math.PI)); Values[0][0] = degreesOutput;
This is the same in other markets such as ES and CL.
Comment
-
Hello Boonfly8,
I was not able to confirm, without looking visually, are you manually performing the math for slope and finding the Slope() method is returning incorrect values?
It would be expected the slope and angle would be different on the ES from 2892.00 to 2892.25 (1 tick) a difference of .25 and the 6E from 1.15540 to 1.15545 (1 tick) a difference of .00005. The slope and angle would be drastically different. I would not expect the slope to be similar between these instruments.Last edited by NinjaTrader_ChelseaB; 10-08-2018, 02:57 PM.Chelsea B.NinjaTrader Customer Service
Comment
-
Look at the chart attached and the output in which I have printed degrees after conversion using the helpguide formula and Slope Value before conversion. Specifically look at the two blue horizontal lines drawn on the chart, the output values in degrees and slope look unreasonable for the market move that happened.
So back to my original question, how would one standardize the value for angle? A 45* move in ES vs 6E might have different values but a 45* move is a 45* move regardless.
that's the whole point of converting the values to angle isn't it? So we can standardize different market conditions or market moves to a universal value2 PhotosLast edited by Boonfly8; 10-08-2018, 03:11 PM.
Comment
-
Hello Boonfly8,
This is based on the price and time (number of bars). The two instruments would need to travel the same distance in price over the same amount of time to have the same slope or angle. Looking at the charts you have provided these have traveled different distances in price and I would not expect the angle to be similar for these instruments.
I believe the slope and angles are correct and that these should not be similar.
Try adding both instruments to the same chart, in the same panel, using the same scale justification to compare the angles in relation to each other. I am expecting the one that travels in price less to have a flatter angle. The one that travels in price more will have a sharper angle.
Traveling .25 over one bar is most definitely not the same angle as travelling .00005 over one bar.
To have the angles the same, the distance traveled would need to be the same. You might try to come up with some kind of custom fancy math to multiply an instruments price so that the distances traveled are similar.. However this would be custom logic that you would need to create.
However, if you would like to show using a calculator that values and formulas are incorrect I would be happy to report this to our development. I will not be able to report a screenshot a chart. I will need actual numbers you have calculated with a calculator that shows the Slope() method is producing incorrect values.
Chelsea B.NinjaTrader Customer Service
Comment
-
Hi Chelsea,
Looking at the https://ninjatrader.com/support/help...-us/?slope.htm ... where series is "Any Series<double> type object such as an indicator, Close, High, Low, etc...", then why does NT not attempt to normalize the values by calculating the distance traveled in ticks then dividing by the number of bars? So like you said, instead of each ES increment moving 0.25, and 6E moving 0.00005, it would move 1 tick for both
Comment
-
Hello Boonfly8,
I wouldn't be able to comment on why the price was used instead of a number of ticks when the Slope() method was developed. I am happy to submit a feature request on your behalf for this if you would like.
You could also write custom logic in your script to do this. (For example a custom method that measures the slope based on a number of ticks from the first point to the second point and not the y value (price) of each point.)
You can also contact a professional NinjaScript Consultant who would be eager to create or modify your script at your request or assist you with modifying your own script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Aviram Y, Today, 05:29 AM
|
0 responses
1 view
0 likes
|
Last Post
by Aviram Y
Today, 05:29 AM
|
||
Started by quantismo, 04-17-2024, 05:13 PM
|
3 responses
25 views
0 likes
|
Last Post Today, 05:23 AM | ||
Started by ScottWalsh, 04-16-2024, 04:29 PM
|
7 responses
34 views
0 likes
|
Last Post Today, 05:15 AM | ||
Started by cls71, Today, 04:45 AM
|
0 responses
6 views
0 likes
|
Last Post
by cls71
Today, 04:45 AM
|
||
Started by mjairg, 07-20-2023, 11:57 PM
|
3 responses
216 views
1 like
|
Last Post
by PaulMohn
Today, 04:22 AM
|
Comment