Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Plotting Base Instrument ticker next to Indicator
Collapse
X
-
Hello aligator,
Please try the below code to do it
Please let me know if I can assists you any further.Code:DrawText("txt", Instrument.FullName, -10, ADX(14)[0], Color.Blue); DrawEllipse("ecl", -15, ADX(14)[0] + 5 * TickSize, -5, ADX(14)[0] - 5 * TickSize, Color.AliceBlue);JoydeepNinjaTrader Customer Service
-
Thank You Joydeep,Originally posted by NinjaTrader_Joydeep View PostHello aligator,
Please try the below code to do it
Please let me know if I can assists you any further.Code:DrawText("txt", Instrument.FullName, -10, ADX(14)[0], Color.Blue); DrawEllipse("ecl", -15, ADX(14)[0] + 5 * TickSize, -5, ADX(14)[0] - 5 * TickSize, Color.AliceBlue);
I used just the Draw Text line and nothing was plotted beside the indicator.
Thanks again.
Comment
-
Thanks Jooydeep.
I just copied your two lines and pasted them at the end as shown below:
double diPlus = 100 * (sumTr[0] == 0 ? 0 : sumDmPlus[0] / sumTr[0]);
double diMinus = 100 * (sumTr[0] == 0 ? 0 : sumDmMinus[0] / sumTr[0]);
double diff = Math.Abs(diPlus - diMinus);
double sum = diPlus + diMinus;
Value.Set(sum == 0 ? 50 : ((Period - 1) * Value[1] + 100 * diff / sum) / Period);
DrawText("txt", Instrument.FullName, -10, ADX(14)[0], Color.Blue);
DrawEllipse("ecl", -15, ADX(14)[0] + 5 * TickSize, -5, ADX(14)[0] - 5 * TickSize, Color.AliceBlue);
}
}
Then I compile it and nothing happens on the chart (after using F5 to refresh the chart). Not sure what am I missing.
Thank You.
p.s.Could you possibly post your Atest file?Last edited by aligator; 06-13-2012, 08:07 AM.
Comment
-
Thank you again Joydeep for your help and excellent quick responses.
Your approach is great and works as a separate indicator. What I was really attempting to do was to modify the original ADX, RSI, etc. or any other indicator to simply draw the instrument name next to the indicator. I am using ADX to figure out a generic solution.
If I paste the added two lines into the NT default ADX indicator, the indicator will not draw the text. Also, can I use Value[0] instead of ADX(period)[0] inside those two lines?
Many thanks for your fantastic support!
Comment
-
Hello Aligator,
Yes that would work. The below code will be the last 2 lines in OnBarUpdate in the ADX indicator (copy of the ADX indicator to be precise) for example.
Also please do remember to append the below code in the Initialize section of the code.Code:DrawText("txt", Instrument.FullName, -10, Value[0], Color.Blue); DrawEllipse("ecl", -15, Value[0] + 5 * TickSize, -5, Value[0] - 5 * TickSize, Color.AliceBlue);
Please let me know if I can assist you any further.Code:DrawOnPricePanel = false;
JoydeepNinjaTrader Customer Service
Comment
-
Joydeep, many thanks and such a great help you have been.
The indicator works fine now and plots text. However, now I have to figure out a way so that the color of the text will be the same as color of the line indicator, if I change the indicator color under the parameters menu. The basic idea is to be able to drop the same indicator into the same panel for instruments and use the labeling to identify which one is which.
Have a great day!!
Comment
-
Joydeep, Hi,Originally posted by NinjaTrader_Joydeep View PostHello aligator,
You can set the color as
Please let me know if I can assist you any further.Code:DrawText("txt", Instrument.FullName, -10, ADX(14)[0],[B] Plots[0].Pen.Color[/B]);
Since you are fresh on this subject I have a follow-up question:
The above modifications plot text for and base indicator, I think. However, it does not seem to work for a derivative on an indicator, i.e. the smoothed average of RSI. RSI plots the RSI indicator and its smoothed average together. If I want to have only the Ave plotted then either I will make RSI transparent or will comment out the Add statement for the RSI plot. However, if I do that and change the rsiValue[0] to Ave[0] in the draw text statement the text will not be plotted at all.
Regards.
Comment
-
Hello Aligator,
Simply commenting the Add wont set the RSI Avg to Plots[0]. You have to modify the properties also.
Can you send a toy code* to support[AT]ninjatrader[DOT]com replicating the exact scenario.
Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.
I look forward to assisting you further.
The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.JoydeepNinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
637 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
366 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
107 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
569 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
571 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment