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
AutoTrendLine and Indicator?
Collapse
X
-
Hello dsraider,
Yes, this should be possible, but you would essentially have to rewrite a swing indicator for RSI values rather market highs and lows.
You set the property DrawOnPricePanel = false, and then could set the Y values they're drawn on according to RSI values to have these drawn in an indicator panel.Ryan M.NinjaTrader Customer Service
-
Okay, I'm not sure if this is exactly what you meant but I THINK I made the Swing Indicator correctly (RaiderSwing in Panel 2).
However, as you can see, when I changed "Swing" to "RaiderSwing" in the Trendline indicator code, I did something wrong. It looks as if it's using price instead of RSI readings. Do I need to change something other than the Swing indicator to which the Trendline refers?
Comment
-
Great progress on the swing indicator modified for RSI. I'd look at the places in the AutoTrendLine code where it draws at highs and lows and see if you can adjust to draw instead at RSI values.
DrawRay("UpTrendLine", upTrendStartBarsAgo, startBarPrice, upTrendEndBarsAgo, endBarPrice, UpTrendColor, DashStyle.Solid, LineWidth);
DrawArrowDown("UpTrendBreak", barsAgo, High[barsAgo] + TickSize, Color.Blue);
DrawRay("DownTrendLine", downTrendStartBarsAgo, startBarPrice, downTrendEndBarsAgo, endBarPrice, DownTrendColor, DashStyle.Solid, LineWidth);
DrawArrowUp("DownTrendBreak", barsAgo, Low[barsAgo] - TickSize, Color.Blue);Ryan M.NinjaTrader Customer Service
Comment
-
Ryan,
First, apologies for my last message. I posted it before I saw yours. I did notice one thing, though. My swing dots don't really line up (as indicators don't show highs and lows, only close). Maybe I'd be better using Close instead of High and Low or would that mess everything up?
I did get the trendline to draw on the RSI but I obviously need to keep working on it...
Thanks.
Comment
-
Comment
-
Hi Ryan,
In trying to enumerate the indicators, I'm getting the following error message:
The namespace '<global namespace>' already contains a definition for 'IndicatorMethod'
Here's what I have so far:
PHP Code:public enum IndicatorMethod
{
RSI,
MACD
}
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
/// Automatically draws a line representing the current trend and generates an alert if the trend line is broken.
/// </summary>
[Description("")]
[Gui.Design.DisplayName("RaiderIndicatorTrendLine")]
public class RaiderIndicatorTrendLine : Indicator
{
Comment
-
dsraider,
I'm pretty sure that every enum needs have an unique name associated with it.
RJay
Originally posted by dsraider View PostHi Ryan,
In trying to enumerate the indicators, I'm getting the following error message:
The namespace '<global namespace>' already contains a definition for 'IndicatorMethod'
Here's what I have so far:
PHP Code:public enum IndicatorMethod
{
RSI,
MACD
}
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
/// Automatically draws a line representing the current trend and generates an alert if the trend line is broken.
/// </summary>
[Description("")]
[Gui.Design.DisplayName("RaiderIndicatorTrendLine")]
public class RaiderIndicatorTrendLine : Indicator
{
Comment
-
Hi Dsraider,
This reference sample offers an example implementation of this. As RJay says the enums must be unique, meaning only declared one time throughout the program. The message you're getting suggests that you're using that name elsewhere.Ryan M.NinjaTrader Customer Service
Comment
-
Thanks, guys, though I'm starting to think there's a better way, using "If" statements. In the meantime, while I'm taking baby steps, is there a way to call an indicator to plot?
Right now I'm adding the RSI and then adding my TrendLine indicator on top of it in the same panel. In the end, I'd like to have it add both once the indicator is selected from a drop down list.
Any chance there's an example of that?
Thanks,
Dave
Comment
-
Indicator plots are Set and you can use any of your existing indicators or other data series to set the plots of another.
You can conditionally set your plots based on a case with enums or with an if statement. Enums will work the best because you can populate a list of available items that will appear in a drop down list and then base your plot on this selection. You can set multiple plots within the switch statement of your enums.
PseudoCode below:
switch (indicatorType)
{
// If the matype is defined as an EMA then...
case indicatorType.RSI:
{
Plot0.Set(RSI)[0];
Plot1.Set(RSITrendLine)[0];
break;
}
case indicatorType.MACD:
{
Plot0.Set(MACD)[0];
Plot1.Set(MACDTrendLine)[0];
break;
}
}Ryan M.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by usazencort, Today, 01:16 AM
|
0 responses
1 view
0 likes
|
Last Post
by usazencort
Today, 01:16 AM
|
||
Started by kaywai, 09-01-2023, 08:44 PM
|
5 responses
603 views
0 likes
|
Last Post Today, 12:32 AM | ||
Started by xiinteractive, 04-09-2024, 08:08 AM
|
6 responses
22 views
0 likes
|
Last Post Today, 12:31 AM | ||
Started by Pattontje, Yesterday, 02:10 PM
|
2 responses
21 views
0 likes
|
Last Post
by Pattontje
Yesterday, 11:49 PM
|
||
Started by flybuzz, 04-21-2024, 04:07 PM
|
17 responses
230 views
0 likes
|
Last Post
by TradingLoss
Yesterday, 11:45 PM
|
Comment