![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Sep 2011
Posts: 49
Thanks: 2
Thanked 5 times in 5 posts
|
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.
|
|
|
|
|
|
#2 |
|
Member
Join Date: Sep 2011
Posts: 49
Thanks: 2
Thanked 5 times in 5 posts
|
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); |
|
|
|
|
|
#3 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
|
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
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |