Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Button in the Chart Trader - how to find out the indicator values.
Collapse
X
-
Hello webus,
If you used an indicator to add the buttons you could just use normal indicator series or call other indicators. For example Close[0] or Time[0].
From the button event you would also have to wrap the code with a TriggerCustomEvent action: https://ninjatrader.com/support/help...=triggercustom
Code:TriggerCustomEvent(o => { //your NS code }, null);
I look forward to being of further assistance.
-
Hi NinjaTrader_Jesse,
Can you please clarify it in more detail?Originally posted by NinjaTrader_Jesse View PostHello webus,
If you used an indicator to add the buttons you could just use normal indicator series or call other indicators. For example Close[0] or Time[0].
From the button event you would also have to wrap the code with a TriggerCustomEvent action: https://ninjatrader.com/support/help...=triggercustom
Code:TriggerCustomEvent(o => { //your NS code }, null);
I look forward to being of further assistance.
When I click on a button and try to get, for example, the close time of the last closed bar (Closes[0][0].ToString()) - I will get the close time of the oldest (very first) bar on the chart. The same is with the indicator value. I will get the value of the oldest bar (not the last closed).
It seems to me that pressing the buttons does not see the actual values. How do I get the values that I expect and that match the chart?
Comment
-
Hello webus,
What more would you like detailed here? This is a simplified sample and I had included a comment about where your code would go, did you have a question with the sample or the link I provided? The help guide describes what the TriggerCustomEvent is and why that would be used. In a button event that would be required for your code to work otherwise what you are seeing is expected because that is not a NinjaScript event that is a WPF button event.Can you please clarify it in more detail?
If some part of that sample or the help guide is not clear can you specify what you are having trouble with or provide a sample of what you tried in relation to the TriggerCustomEvent?
I look forward to being of further assistance.
Comment
-
Hi NinjaTrader_Jesse,
I didn't understand how it works and how to use it.Originally posted by NinjaTrader_Jesse View PostHello webus,
What more would you like detailed here? This is a simplified sample and I had included a comment about where your code would go, did you have a question with the sample or the link I provided? The help guide describes what the TriggerCustomEvent is and why that would be used. In a button event that would be required for your code to work otherwise what you are seeing is expected because that is not a NinjaScript event that is a WPF button event.
If some part of that sample or the help guide is not clear can you specify what you are having trouble with or provide a sample of what you tried in relation to the TriggerCustomEvent?
I look forward to being of further assistance.
Is there any working example for buttons?
Could you please provide an example, how can I find out, for example, the closing price of the last closed bar in this way?
Comment
-
Hello webus,
We don't have any additional samples for this aside from the two in the help guide and the one I provided. This method makes use of a Lambda expression, if you are not familiar with that topic in C# I would suggest to research that so you have a good understanding of what this syntax is. A lot of the more advanced NinjaScript items will use standard C# concepts so it is good to get a firm understanding of C# concepts to aid in NinjaScript development. https://docs.microsoft.com/en-us/dot...da-expressions
I had provided a working example in post 2, I also cut out the unnecessary parts that the help guide shows to simplify it further. This is a working example:
Your code goes where the comment says it goes, this code would go in your buttons event handler between the curly braces.Code:TriggerCustomEvent(o => { //your NS code }, null);
If this is not clear can you try adding this to your script and then post the code you tried so I can understand what difficulty you are having here?
I look forward to being of further assistance.
Comment
-
If you don't mind my asking, how did you add buttons to chart trader? I've been searching for a while but nothing has helped me know where to start.Originally posted by webus View Post
Comment
-
Hello trevor14,
You can find some examples of adding content to the chart trader here:
Hello All, Moving forward this will be maintained in the help guide reference samples and no longer maintained on the forum. Creating Chart WPF (UI) Modifications from an Indicator - https://ninjatrader.com/support/help...ui)-modifi.htm (https://ninjatrader.com/support/helpGuides/nt8/creating-chart-wpf-(ui)-modifi.htm) I've
Please let me know if I may be of further assistance.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
51 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
127 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
69 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|
Comment