NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 03-01-2012, 04:20 PM   #1
ds1111
Member
 
Join Date: Sep 2011
Posts: 49
Thanks: 2
Thanked 5 times in 5 posts
Default Dots (DrawDot) not being displayed in the chart

I'm coding an indicator that prints a dot on the high or low of a bar under certain conditions (e.g. SMA cross). For some reason, when I run the script, I can see the dot ONLY ONCE in the last few minutes.

As I go back in time no other 'dots' are being displayed.

I used a Print statement to confirm that a DrawDot was called in my code, and it shows in the Output window many times ("RED DOT ****"), but the dots don't display in the chart, although the code logic is correct and DrawDot is being called as confirmed by the Print statement just after it.

if (condition)
{
// Paint Red DOT
DrawDot("RedDot", true, 0, High[0] + 2 * TickSize, Color.Red);
Print("RED DOT ****");

}


Any clues?

Thanks.
PS: I"m new to Ninjascript.
Last edited by ds1111; 03-01-2012 at 07:54 PM.
ds1111 is offline  
Reply With Quote
Old 03-01-2012, 09:03 PM   #2
ds1111
Member
 
Join Date: Sep 2011
Posts: 49
Thanks: 2
Thanked 5 times in 5 posts
Default

Ok... I did some research... looking at others code in the forum... it seems that the 'tag'
in DrawDot(string tag, bool autoScale, int barsAgo, double y, Color color) needs to be unique.

The solution I saw and it worked for me was to use 'CurrentBar.ToString() to create a unique tag for each dot being drawn in the char.
Please, let me know if there are other ways to do this... but so far this work.


DrawDot(CurrentBar.ToString(), true, 0, High[0] + 2 * TickSize, Color.Red);


ds1111 is offline  
Reply With Quote
Old 03-02-2012, 02:09 AM   #3
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
Default

Thanks for posting the update, yes that could be one solution. The official sample on that topic would be found here - http://www.ninjatrader.com/support/f...ead.php?t=3419
NinjaTrader_Bertrand is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The last displayed bar on the chart screen yaris Indicator Development 12 11-04-2011 02:55 AM
No Data Displayed in Chart tmendoza6 Charting 1 12-20-2010 11:40 AM
Changing symbol displayed on chart bi9foot Charting 1 04-16-2010 02:49 PM
Sometimes my chart markers are displayed 1-2 bars early on the chart cunparis Charting 1 10-16-2009 07:34 AM
Trade-# Displayed on Chart RJay Strategy Analyzer 1 03-07-2009 09:56 AM


All times are GMT -6. The time now is 12:51 AM.