NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 06-13-2012, 09:57 PM   #1
suprsnipes
Senior Member
 
Join Date: Aug 2008
Posts: 233
Thanks: 19
Thanked 5 times in 5 posts
Default DrawDot causing a problem

Hi,

I have an indicator looking for a condition which appears to be working as I have the if statement followed by a print which when the if statement is true I am seeing the correct output as per the code below;

Code:
This is when the code was working correctly;
if (BarsInProgress == 0)
{
if (GetCurrentBidVolume(0) > GetCurrentAskVolume(1))
print(GetCurrentBidVolume(0) + " " + GetCurrentAskVolume(1))
}
However when I have attempted to add a DrawDot after the condition as well I am seeing a problem. The problem is the print output is now printing everything in the print statement even when the condition is not true. What could be causing this?

Code:
if (BarsInProgress == 0)
{
if (GetCurrentBidVolume(0) > GetCurrentAskVolume(1))
print(GetCurrentBidVolume(0) + " " + GetCurrentAskVolume(1))
DrawDot("Plot0", false, 0, High[0] + 1, Color.WhiteSmoke);
}
Appreciate the help.
suprsnipes is offline  
Reply With Quote
Old 06-14-2012, 01:54 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
Default

suprsnipes, you extended your if ( ) condition beyond using a single line, so you would need to use the { } braces around it -

Code:
if (BarsInProgress == 0)
{
if (GetCurrentBidVolume(0) > GetCurrentAskVolume(1))
 {
   print(GetCurrentBidVolume(0) + " " + GetCurrentAskVolume(1))
   DrawDot("Plot0", false, 0, High[0] + 1, Color.WhiteSmoke);
 }
}
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 06-15-2012, 05:28 AM   #3
suprsnipes
Senior Member
 
Join Date: Aug 2008
Posts: 233
Thanks: 19
Thanked 5 times in 5 posts
Default

Could you please confirm that for DrawDot etc there is no need to use Add() in the Initialize section?
suprsnipes is offline  
Reply With Quote
Old 06-15-2012, 05:33 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
Default

Correct, that's not need to work with DrawDot() per se, only if you would want to add

a) bars series for programmatic access
b) indicators for display in strategies
c) adding a plot / line (which does not relate to the drawing methods)
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 06-15-2012, 05:34 AM   #5
suprsnipes
Senior Member
 
Join Date: Aug 2008
Posts: 233
Thanks: 19
Thanked 5 times in 5 posts
Default

Appreciate it your quick response as always, thanks
suprsnipes 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
Running strategies with connection loss handling set to 'recalculate' causing problem adamus Automated Trading 8 03-29-2011 03:01 AM
DrawDot help upsndowns Indicator Development 1 05-19-2010 07:34 AM
DrawDot... Mark- General Programming 29 03-03-2009 08:32 PM
DrawDot rurimoon General Programming 5 01-24-2009 08:35 AM
DrawDot() NinjaTrader_Josh Indicator Development 9 03-26-2008 07:51 AM


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