How to add text near indicator line. For example near pivot line I want to add price value of those pivot and it's description, like on picture bellow.
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 to add text near indicator lines
Collapse
X
-
Code:Plot0.Set(Lows[1][0]); Plot1.Set(Lows[2][0]); Plot2.Set(Lows[3][0]); Plot4.Set(Lows[4][0]); //------------------------ Plot5.Set(Highs[1][0]); Plot6.Set(Highs[2][0]); Plot7.Set(Highs[3][0]); Plot8.Set(Highs[4][0]); DrawText("tag1", "D P", 0, Lows[1][0], Color.Black); DrawText("tag2", "D R1", 0, Lows[2][0], Color.Black); DrawText("tag3", "D S1", 0, Lows[3][0], Color.Black); DrawText("tag4", "D R2", 0, Lows[4][0], Color.Black); DrawText("tag5", "D S2", 0, Highs[1][0], Color.Black); DrawText("tag6", "D R3", 0, Highs[2][0], Color.Black);
I try to draw high and low of previos bar.
Comment
-
Code:protected override void Initialize() { Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0")); Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Square, "Plot1")); Add(new Plot(Color.FromKnownColor(KnownColor.DarkViolet), PlotStyle.TriangleRight, "Plot2")); Add(new Plot(Color.FromKnownColor(KnownColor.Firebrick), PlotStyle.TriangleLeft, "Plot4")); //--------------- Add(new Plot(Color.FromKnownColor(KnownColor.Blue), PlotStyle.Line, "Plot5")); Add(new Plot(Color.FromKnownColor(KnownColor.Brown), PlotStyle.Square, "Plot6")); Add(new Plot(Color.FromKnownColor(KnownColor.Magenta), PlotStyle.TriangleRight, "Plot7")); Add(new Plot(Color.FromKnownColor(KnownColor.Navy), PlotStyle.TriangleLeft, "Plot8")); Add("6E 12-11", PeriodType.Minute, 60); Add("6E 12-11", PeriodType.Minute, 240); Add("6E 12-11", PeriodType.Minute, 1440); Add("6E 12-11", PeriodType.Day, 5); //Instrument.MasterInstrument.Name Overlay = true; } protected override void OnBarUpdate() { if (CurrentBar < 1) { return; } Plot0.Set(Lows[1][0]); Plot1.Set(Lows[2][0]); Plot2.Set(Lows[3][0]); Plot4.Set(Lows[4][0]); //------------------------ Plot5.Set(Highs[1][0]); Plot6.Set(Highs[2][0]); Plot7.Set(Highs[3][0]); Plot8.Set(Highs[4][0]); DrawText("tag1", "D P", 0, Lows[1][0], Color.Black); DrawText("tag2", "D R1", 0, Lows[2][0], Color.Black); DrawText("tag3", "D S1", 0, Lows[3][0], Color.Black); DrawText("tag4", "D R2", 0, Lows[4][0], Color.Black); DrawText("tag5", "D S2", 0, Highs[1][0], Color.Black); DrawText("tag6", "D R3", 0, Highs[2][0], Color.Black); }
I have no erros in a log window. And I want to have lines above and belove candles, and text only at last bar at chart.
I attch picture at next post.
Comment
-
Originally posted by NinjaTrader_Brett View PostHello,
You have a black background with black color text. Are you sure its not just blended together?
-Brett
I have white background at nt7 chart.
Please give me advise how to draw 4 lines along last 10 bars with values of low price from hour time frame, 4 hours, 1 day and 1 week. What is the main trouble in my code?
Comment
-
Hello,
When I run your code on my side I get the following in the log:
11/29/2011 7:28:21 AM Default Error on calling 'OnBarUpdate' method for indicator 'MTFCurrentHL' on bar 1: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
I had to add a CurrentBars check since just CurrentBar is not good enough for MTF.
I then had another problem since you skiped Plot3 that I had to resolve as well, please see the revised code that works in this .cs file.Attached Files
Comment
-
Originally posted by NinjaTrader_Brett View PostHello,
When I run your code on my side I get the following in the log:
11/29/2011 7:28:21 AM Default Error on calling 'OnBarUpdate' method for indicator 'MTFCurrentHL' on bar 1: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
I had to add a CurrentBars check since just CurrentBar is not good enough for MTF.
I then had another problem since you skiped Plot3 that I had to resolve as well, please see the revised code that works in this .cs file.
But I can't any lines and text on chart.
Comment
-
Originally posted by NinjaTrader_Brett View PostHello,
How many days of data are you loading? I have to load upwards of 20 days since you are loading a 5 day chart series you need at least 10 days of data for anything to plot.
-Brett
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by slightly, Today, 12:49 AM
|
0 responses
2 views
0 likes
|
Last Post
by slightly
Today, 12:49 AM
|
||
Started by sdauteuil, 09-23-2021, 10:16 AM
|
4 responses
1,208 views
0 likes
|
Last Post Yesterday, 11:41 PM | ||
Started by agclub, 04-21-2024, 08:57 PM
|
5 responses
34 views
0 likes
|
Last Post
by agclub
Yesterday, 09:47 PM
|
||
Started by ESHunter, Yesterday, 08:06 PM
|
2 responses
18 views
0 likes
|
Last Post
by ESHunter
Yesterday, 09:27 PM
|
||
Started by ETFVoyageur, 05-07-2024, 07:05 PM
|
19 responses
151 views
0 likes
|
Last Post
by ETFVoyageur
Yesterday, 09:14 PM
|
Comment