//For toggle private void hideshow(object s, EventArgs e) { if ( show == false ) { DrawText("wtf", ...); show = true; button.ForeColor = Color.Silver; } else { RemoveDrawObject("wtf"); show = false; button.ForeColor = Color.Blue; } ChartControl.ChartPanel.Refresh(); }
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
Button on toolbar
Collapse
X
-
Originally posted by GeorgeW View PostCode:
-
Thanks Koganam, that's worked fine for the final BarsAgo DrawText. But the DrawText is also applied to earlier bars, and those are not being toggled on and off.
The original code was:
Code:DrawText (TagdiffVol1 + CurrentBar, "A"+"\n"+diffVol+"\n"+wTSum+"\n"+a1+"\n"+aPB+"\n"+a3.ToString(), 0, High[0] + 6 * TickSize, Color.Black);
Code:DrawText ("wtf", "A"+"\n"+diffVol+"\n"+wTSum+"\n"+a1+"\n"+aPB+"\n"+a3.ToString(), 0, High[0] + 6 * TickSize, Color.Black);
Code:if ( show == false ) { for (int x = CurrentBar; x > CurrentBar - 256; x--) { DrawText ("wtf", "A"+"\n"+diffVol+"\n"+wTSum+"\n"+a1+"\n"+aPB+"\n"+a3.ToString(), x, High[0] + 6 * TickSize, Color.Black); } show = true; button.ForeColor = Color.Silver; }
Comment
-
Originally posted by GeorgeW View PostThanks Koganam, that's worked fine for the final BarsAgo DrawText. But the DrawText is also applied to earlier bars, and those are not being toggled on and off.
The original code was:
Code:DrawText (TagdiffVol1 + CurrentBar, "A"+"\n"+diffVol+"\n"+wTSum+"\n"+a1+"\n"+aPB+"\n"+a3.ToString(), 0, High[0] + 6 * TickSize, Color.Black);
Code:DrawText ("wtf", "A"+"\n"+diffVol+"\n"+wTSum+"\n"+a1+"\n"+aPB+"\n"+a3.ToString(), 0, High[0] + 6 * TickSize, Color.Black);
Code:if ( show == false ) { for (int x = CurrentBar; x > CurrentBar - 256; x--) { DrawText ("wtf", "A"+"\n"+diffVol+"\n"+wTSum+"\n"+a1+"\n"+aPB+"\n"+a3.ToString(), x, High[0] + 6 * TickSize, Color.Black); } show = true; button.ForeColor = Color.Silver; }
I am unaware of your larger purpose, and this post does not explain it. It is a piecemeal, made of code snippets without telling us what the intended effect is supposed to be. If you want to remove all draw objects, the command is RemoveDrawObjects(), or else iterate though all IText objects into a collection, and use their tags to delete them in a second pass. If you want to make them invisible, you will have to iterate through them and turn them transparent.
It is easier to help if the requirements are more clearly stated.
Comment
-
Ok, sorry about the lack of explanation.
Basically I have an indicator which draws some calculations to several bars on the chart. I want to make them all transparent at certain times by using the toggle on off button, whilst leaving any other indicators drawn to the chart unaffected. Currently the code switches on and off the last calculation on the chart, and then as I toggle on and off with Market Replay running, it keeps moving that calculation to later bars on the chart.
Comment
-
Originally posted by GeorgeW View PostOk, sorry about the lack of explanation.
Basically I have an indicator which draws some calculations to several bars on the chart. I want to make them all transparent at certain times by using the toggle on off button, whilst leaving any other indicators drawn to the chart unaffected. Currently the code switches on and off the last calculation on the chart, and then as I toggle on and off with Market Replay running, it keeps moving that calculation to later bars on the chart.
Comment
-
Yes. If I understand it correctly, I think example #3 here https://ninjatrader.com/support/help...ub=Drawobjects and reply #6 to the thread here http://ninjatrader.com/support/forum...ad.php?t=48502 are what I need. I just have to work out how to link it to the button.
Comment
-
Originally posted by GeorgeW View PostYes. If I understand it correctly, I think example #3 here https://ninjatrader.com/support/help...ub=Drawobjects and reply #6 to the thread here http://ninjatrader.com/support/forum...ad.php?t=48502 are what I need. I just have to work out how to link it to the button.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Stanfillirenfro, Today, 07:23 AM
|
1 response
3 views
0 likes
|
Last Post Today, 07:37 AM | ||
Started by cmtjoancolmenero, Yesterday, 03:58 PM
|
2 responses
21 views
0 likes
|
Last Post Today, 07:24 AM | ||
Started by olisav57, Yesterday, 07:39 PM
|
1 response
9 views
0 likes
|
Last Post Today, 07:23 AM | ||
Started by cocoescala, 10-12-2018, 11:02 PM
|
7 responses
944 views
0 likes
|
Last Post
by Jquiroz1975
Today, 07:21 AM
|
||
Started by oviejo, Today, 12:28 AM
|
1 response
12 views
0 likes
|
Last Post Today, 07:20 AM |
Comment