I have a draw text plotting on certain candles. When it plots it prints 10 ticks away from either the high or low of the candle, how do I make it so that it moves with the candle? Sometimes the candle will move more than 10 ticks after the print of the text, then the candle ends up covering it.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Plot moving with candle
Collapse
X
-
Plot moving with candle
Hi,
I have a draw text plotting on certain candles. When it plots it prints 10 ticks away from either the high or low of the candle, how do I make it so that it moves with the candle? Sometimes the candle will move more than 10 ticks after the print of the text, then the candle ends up covering it.Tags: None
-
Hello ScottieDog,
Thanks for your post about drawtext.
Based on your description you have an indicator that will print on the chart above/below a candle as it is in the process of forming. This would imply you are using the CalculateOnBarClose = false.
The way to make the DrawText move with the candle would be to effectively redraw the text with each tic in that candle. You can do this autonomously by using the same "tag" and a new "Y" axis location.
Please let me know if I can be of further assistance.
-
How do I do this? I am learning to code, and can only do basic things. Is there a link with instructions?Originally posted by NinjaTrader_Paul View PostHello ScottieDog,
Thanks for your post about drawtext.
Based on your description you have an indicator that will print on the chart above/below a candle as it is in the process of forming. This would imply you are using the CalculateOnBarClose = false.
The way to make the DrawText move with the candle would be to effectively redraw the text with each tic in that candle. You can do this autonomously by using the same "tag" and a new "Y" axis location.
Please let me know if I can be of further assistance.
Comment
-
Hello ScottieDog,
Thanks for your reply. To help I have created a short video showing one way to do this.
I used an EMA crossing another EMA as a trigger to use DrawText.
World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.
Please let me know if you need further assistance.
Comment
-
Hi,Originally posted by NinjaTrader_Paul View PostHello ScottieDog,
Thanks for your reply. To help I have created a short video showing one way to do this.
I used an EMA crossing another EMA as a trigger to use DrawText.
World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.
Please let me know if you need further assistance.
I can see how you´ve done it on your video, I just can´t see where to add it inside my code. I´ve declared the int no problem, but not sure where I should put the barNum == CurrentBar
I want to add the (currently commented out) DrawDownArrow, and to have it move with the bar....
When I uncomment the line for the DrawDownArrow I get an error message of "Statement Excepted".
This is my code...
Code:{ if (deltavolume > 0) { UpVolume.Set(deltavolume); DownVolume.Set(0); if (textType == AlertTypes.Delta) { if (Close[0] < Open[0] && deltavolume > threshold) DrawText("Delta" + CurrentBar, true, Convert.ToString(deltavolume), 0, High[0] + (textOffset*TickSize)/2, 0, textColor1, textFont, StringAlignment.Center, outlineColor1, areaColor1, opacity1); [COLOR=Red] //DrawArrowDown("MyArrowd"+CurrentBar, 0, High[0]+2* TickSize, Color.Red); //scott mod[/COLOR] else if (Close[0] >= Open[0]) DrawText("Delta" + CurrentBar, true, Convert.ToString("NEUTRAL"), 0, High[0] + (textOffset*TickSize)/2, 0, Color.Transparent, textFont, StringAlignment.Center, Color.Transparent, Color.Transparent, 0); } else if (textType == AlertTypes.Label) { if (Close[0] < Open[0] && deltavolume > threshold) DrawText("Delta" + CurrentBar, true, Convert.ToString(plotLabel1), 0, High[0] + (textOffset*TickSize)/2, 0, textColor1, textFont, StringAlignment.Center, outlineColor1, areaColor1, opacity1); else if (Close[0] >= Open[0]) DrawText("Delta" + CurrentBar, true, Convert.ToString("NEUTRAL"), 0, High[0] + (textOffset*TickSize)/2, 0, Color.Transparent, textFont, StringAlignment.Center, Color.Transparent, Color.Transparent, 0); } else if (textType == AlertTypes.Sound) { if (Close[0] < Open[0] && deltavolume > threshold) { try { DrawText("Delta" + CurrentBar, true, Convert.ToString(deltavolume), 0, High[0] + (textOffset*TickSize)/2, 0, textColor1, textFont, StringAlignment.Center, outlineColor1, areaColor1, opacity1); //scott mod Alert("DownAlert", soundAlertPriority, "DownAlert", downFile, rearmTime, Color.Navy, Color.Crimson); } catch {} } } }
Comment
-
Hello ScottieDog,
Thanks for your reply and follow-up question. In the code section you attached there are a lot of things happening. Basically if the deltavolume is >0 several things could happen in the various subsequent If/else-If statements.
Where you are placing the DrawArrow will only happen when deltavolume >0 and textType ==AlertTypes.Delta and Close[0] < Open[0] && deltavolume > threshold) So if you have another alert type selected then the draw arrow won't happen. You can of course change the code we add to the other sections if you wish but I just wanted to be clear that this is an example. As I don't have the entire code I cannot test on my end but this should get you started in the right direction. If you do decide to expand the concept then make sure you use different integer variables for each different section, IE: barNum1, barNum2, etc.
In the code section below I have added changes in red.
Please let me know if you have further questions.Code:{ if (deltavolume > 0) { UpVolume.Set(deltavolume); DownVolume.Set(0); if (textType == AlertTypes.Delta) { if (Close[0] < Open[0] && deltavolume > threshold) [COLOR="red"] {[/COLOR] DrawText("Delta" + CurrentBar, true, Convert.ToString(deltavolume), 0, High[0] + (textOffset*TickSize)/2, 0, textColor1, textFont, StringAlignment.Center, outlineColor1, areaColor1, opacity1); [COLOR="Red"] barNum = CurrentBar ; // Save the CurrentBar number[/COLOR] [COLOR="Red"] }[/COLOR] else if (Close[0] >= Open[0]) DrawText("Delta" + CurrentBar, true, Convert.ToString("NEUTRAL"), 0, High[0] + (textOffset*TickSize)/2, 0, Color.Transparent, textFont, StringAlignment.Center, Color.Transparent, Color.Transparent, 0); } [COLOR="red"] if (barNum == CurrentBar) DrawArrowDown("MyArrowd"+CurrentBar, 0, High[0] + 2 * TickSize, Color.Red); //scott mod[/COLOR] else if (textType == AlertTypes.Label) { if (Close[0] < Open[0] && deltavolume > threshold) DrawText("Delta" + CurrentBar, true, Convert.ToString(plotLabel1), 0, High[0] + (textOffset*TickSize)/2, 0, textColor1, textFont, StringAlignment.Center, outlineColor1, areaColor1, opacity1); else if (Close[0] >= Open[0]) DrawText("Delta" + CurrentBar, true, Convert.ToString("NEUTRAL"), 0, High[0] + (textOffset*TickSize)/2, 0, Color.Transparent, textFont, StringAlignment.Center, Color.Transparent, Color.Transparent, 0); } else if (textType == AlertTypes.Sound) { if (Close[0] < Open[0] && deltavolume > threshold) { try { DrawText("Delta" + CurrentBar, true, Convert.ToString(deltavolume), 0, High[0] + (textOffset*TickSize)/2, 0, textColor1, textFont, StringAlignment.Center, outlineColor1, areaColor1, opacity1); //scott mod Alert("DownAlert", soundAlertPriority, "DownAlert", downFile, rearmTime, Color.Navy, Color.Crimson); } catch {} } } }
Comment
-
Try this
if (textType == AlertTypes.Delta)
{
if (Close[0] < Open[0] && deltavolume > threshold)
{
DrawText("Delta" + CurrentBar, true, Convert.ToString(deltavolume), 0, High[0] + (textOffset*TickSize)/2, 0, textColor1, textFont, StringAlignment.Center, outlineColor1, areaColor1, opacity1);
DrawArrowDown("MyArrowd"+CurrentBar, 0, High[0]+2* TickSize, Color.Red); //scott mod
}
else if (Close[0] >= Open[0])
DrawText("Delta" + CurrentBar, true, Convert.ToString("NEUTRAL"), 0, High[0] + (textOffset*TickSize)/2, 0, Color.Transparent, textFont, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
}Last edited by eDanny; 06-25-2014, 11:49 AM.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
650 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
370 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 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
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
577 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment