Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
How do you plot a linear regression trend line in NT8?
Collapse
X
-
How do you plot a linear regression trend line in NT8?
How do you plot a linear regression trend line in NT8? I don't want a moving line. I want a trend line. The Linear Regression indicator plots it as a moving line. I used to be able to do this in NT, now I can't seem to be able to. Thanks!
Tags: None
-
Hello Joseph, thanks for writing in.
The TrendLine and Linear Regression indicators are available to study through the Indicators folder of the NinjaScript Editor. The most straight forward way of plotting a trend line for the linear regression will be to add the Trend Lines indicator to your chart, then, for the Input Series, change this from the default series to the Linear Regression indicator.
Please let me know if I can assist any further.Chris L.NinjaTrader Customer Service
- Likes 1
-
Originally posted by NinjaTrader_ChrisL View PostHello Joseph, thanks for writing in.
The TrendLine and Linear Regression indicators are available to study through the Indicators folder of the NinjaScript Editor. The most straight forward way of plotting a trend line for the linear regression will be to add the Trend Lines indicator to your chart, then, for the Input Series, change this from the default series to the Linear Regression indicator.
Please let me know if I can assist any further.
Last edited by Joseph Connors; 12-23-2020, 11:29 AM.
Comment
-
Hello Joseph, thanks for your repy.
Notice that when you change the Input Series of the TrendLines indicator, there is another Input Series selector within the Linear Regression indicator. Set that input series to a VOL indicator. After this set the panel of Trend Lines to the same panel number of the VOL indicator (panel 2 in my example).
Here is an example picture of the setup:
When selecting the Linear regression indicator as the input series, you will see there is a Period property that you can change.
Please let me know if I can assist any further.Chris L.NinjaTrader Customer Service
- Likes 1
Comment
-
Originally posted by NinjaTrader_ChrisL View PostHello Joseph, thanks for your repy.
Notice that when you change the Input Series of the TrendLines indicator, there is another Input Series selector within the Linear Regression indicator. Set that input series to a VOL indicator. After this set the panel of Trend Lines to the same panel number of the VOL indicator (panel 2 in my example).
Here is an example picture of the setup:
When selecting the Linear regression indicator as the input series, you will see there is a Period property that you can change.
Please let me know if I can assist any further.
When I used to use this on vol, as I moved my chart back in time to the left it would re-calculate and display the result. I notice that this does not do that. Is there anyway that that can be done?
Comment
-
Originally posted by NinjaTrader_ChrisL View PostHello Joseph, thanks for your reply.
The only way to see historical trend lines is to add them through the properties, it will not re-calculate based on the visible bars.
Please let me know if I can assist any further.
Comment
-
Originally posted by NinjaTrader_ChrisL View PostHello Joseph, thanks for your reply.
In the TrendLine settings there is a property called "Number of trend lines" this is how many historical trend lines are calculated.
Please let me know if I can assist any further.
Comment
-
Hello,
How can tell the indicator to stop drawing the line after X number of bars once it has broken the trend line?
Regards,
Glen.
Comment
-
Hello Glen,
Thanks for your notes.
To clarify, are you using AddChartIndicator() to plot the TrendLines indicator on a chart window from the strategy?
Are you adding your own plot using AddPlot() in a custom NinjaScript indicator and assigning the TrendLines() indicator value to that plot?
Or, are you trying to modify a copy of the TrendLines indicator that comes with NinjaTrader?
We look forward to assisting further.Brandon H.NinjaTrader Customer Service
Comment
-
Hi Brandon,
Thank you for your reply.
I am ok to make a copy of the code from the NT trend lines indicator. I am looking for what cod do I enter to tell the lines that were plotted to stop plotting at X number of bars past where the line is broken.
Notes 1 & 2 ) No,
Note 3) Or, are you trying to modify a copy of the TrendLines indicator that comes with NinjaTrader? Yes
Regards,
Glen.
Comment
-
Hello KiwiTraveler,
Thanks for your notes.
The TrendLines indicator that comes with NinjaTrader uses SharpDX and OnRender() to custom render the trend lines on the chart window.
You would have to come up with your own custom logic to only custom render the trend lines on the chart window until the Close price crosses above/below the plot value of the indicator. And, after a certain number of bars pass since the Close price crossed above/below the plot value of the indicator, continue custom rendering the trend lines.
You could consider using a bool to detect if the Close price crosses above/below the plot value, such as setting a bool to false when the break occurs. You would need to use custom logic to count the number of bars that have passed since the break and flip to bool back to true.
The bool could then be used to determine if the trend lines should be custom-rendered on the chart or not. For example, when the bool is true, custom render the trend lines.
Using SharpDX for Custom Chart Rendering: https://ninjatrader.com/support/help..._rendering.htm
OnRender(): https://ninjatrader.com/support/help...8/onrender.htm
CrossAbove: https://ninjatrader.com/support/help...crossabove.htm
CrossBelow: https://ninjatrader.com/support/help...crossbelow.htmBrandon H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Haiasi, 04-25-2024, 06:53 PM
|
2 responses
16 views
0 likes
|
Last Post
by Massinisa
Today, 05:32 AM
|
||
Started by Creamers, Today, 05:32 AM
|
0 responses
0 views
0 likes
|
Last Post
by Creamers
Today, 05:32 AM
|
||
Net Change
by Segwin
Started by Segwin, 05-07-2018, 02:15 PM
|
12 responses
1,785 views
0 likes
|
Last Post
by Leafcutter
Today, 05:30 AM
|
||
Started by poplagelu, Today, 05:00 AM
|
0 responses
3 views
0 likes
|
Last Post
by poplagelu
Today, 05:00 AM
|
||
Started by fx.practic, 10-15-2013, 12:53 AM
|
5 responses
5,407 views
0 likes
|
Last Post
by Bidder
Today, 12:22 AM
|
Comment