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
Can I draw lines in the indicator window?
Collapse
X
-
I tried to plot on the price panel and Draw in an indicator panel. However, both plots go to the price panel. Here is what I coded!
protected override void Initialize()
{
Add(new Plot(new Pen(Color.Red,3), PlotStyle.Line, "Fast"));
Add(new Plot(new Pen(Color.Yellow,3), PlotStyle.Line, "Slow"));
BarsRequired = 60;
DrawOnPricePanel = false;
CalculateOnBarClose = false;
Overlay = true;
PriceTypeSupported = false;
Diff = new DataSeries(this);
protected override void OnBarUpdate()
{
Fast.Set(PMATrace(pMAFastER,pMAFastSens)[0]);
Slow.Set(PMATrace(pMASlowER,pMASlowSens)[0]);
if (CurrentBar >= BarsRequired)
{
DiffC = PMATrace(pMASlowER,pMASlowSens)[0] - PMATrace(pMAFastER,pMAFastSens)[0];
Print(DiffC);
Diff.Set(DiffC);
DrawLine("Tag1"+CurrentBar,true,1,Diff[1],0,Diff[0],Color.Green,DashStyle.Solid,4);
}
}
Comment
-
I am trying to Plot on the Price Panel and have the Draw appear in the indicator window Panel =1.
Checked and the Panel is set to 1 when the indicator is added to a chart.
The values for the Draw are quite small so:
When I set Overlay = true; the plot and data are scrunched up at the top of the price panel and I get a line at 0 for the plot.
When I set Overlay = false; the plot is placed in a indicator panel and again the data is scrunched at the top of the price panel and the Draw is plotted along the 0 line.
Does not make any difference what the value of
DrawOnPricePanel is set to.
I thought the DrawOnPricePanel would direct the Draw to either the price panel or an indicator panel. It seams not to change anything when I change its setting.
Can you have a custom indicator display in the price panel and the Draw display in the indicator panel? This is the reverse from the documentation.
Comment
-
Unfortunately it won't work that way. Panel 1 is the same as the price panel. If you have your indicator on panel 1 and set DrawOnPricePanel to false it will continue to draw on the price panel because the indicator panel your indicator is on is the price panel.
You will need to place your indicator on Panel 2 or higher in order to have the DrawOnPricePanel variable take any effect.
To prevent scrunching you will want to turn AutoScale to false.
A workaround to achieve what you want is maybe to just create two indicators. One that plots what you want on the price panel and one that draws on an indicator panel.Josh P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by GussJ, 03-04-2020, 03:11 PM
|
15 responses
3,270 views
0 likes
|
Last Post Today, 03:15 PM | ||
Started by Tim-c, Today, 02:10 PM
|
1 response
8 views
0 likes
|
Last Post Today, 02:52 PM | ||
Started by Taddypole, Today, 02:47 PM
|
0 responses
2 views
0 likes
|
Last Post
by Taddypole
Today, 02:47 PM
|
||
Started by chbruno, 04-24-2024, 04:10 PM
|
4 responses
51 views
0 likes
|
Last Post
by chbruno
Today, 02:38 PM
|
||
Started by TraderG23, 12-08-2023, 07:56 AM
|
10 responses
403 views
1 like
|
Last Post
by beobast
Today, 02:35 PM
|
Comment