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
Plotting Base Instrument ticker next to Indicator
Collapse
X
-
Hello aligator,
Please try the below code to do it
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
-
Originally posted by NinjaTrader_Joydeep View PostHello aligator,
Please try the below code to do it
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.
Code:DrawText("txt", Instrument.FullName, -10, Value[0], Color.Blue); DrawEllipse("ecl", -15, Value[0] + 5 * TickSize, -5, Value[0] - 5 * TickSize, Color.AliceBlue);
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
-
Originally posted by NinjaTrader_Joydeep View PostHello aligator,
You can set the color as
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 rhyminkevin, Today, 04:58 PM
|
3 responses
47 views
0 likes
|
Last Post
by Anfedport
Today, 05:24 PM
|
||
Started by iceman2018, Today, 05:07 PM
|
0 responses
5 views
0 likes
|
Last Post
by iceman2018
Today, 05:07 PM
|
||
Started by lightsun47, Today, 03:51 PM
|
0 responses
7 views
0 likes
|
Last Post
by lightsun47
Today, 03:51 PM
|
||
Started by 00nevest, Today, 02:27 PM
|
1 response
14 views
0 likes
|
Last Post
by 00nevest
Today, 03:48 PM
|
||
Started by futtrader, 04-21-2024, 01:50 AM
|
4 responses
50 views
0 likes
|
Last Post
by futtrader
Today, 03:01 PM
|
Comment