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 04-05-2010, 11:07 AM   #1
kaywai
Senior Member
 
Join Date: Sep 2009
Posts: 562
Thanks: 40
Thanked 5 times in 4 posts
Default Trying to get this to print correctly but...

Here is the code:-
Code:

privatevoid ProcessBuySequential()
{
if (Close[0]<=Low[2])
{
BuySeqCount++;
this.TDBuySeqDrawText(BuySeqCount.ToString());
if (BuySeqCount == 5)
{
buycountdown5 = Close[0];
}
elseif (BuySeqCount == 8)
{
if (Low[0] <= buycountdown5)
{
BuySeqCount++;
this.TDBuySeqDrawText(BuySeqCount.ToString());
buycountdown8 = Close[0];
}
else
{
this.TDBuySeqDrawText("+");
}
}
}
}
privatevoid TDBuySeqDrawText(string strText)
{
BuySeq++;
DrawText(BuySeq.ToString(), strText, 0, (Low[0]-SMA(Range(),BuySetupBars)[0]*0.4), Color.Red);
strBuySeqTags.SetValue(BuySeq.ToString(), SequentialTags++);
}
condition A = Close[0] <= Low[2]. If condition A is true, BuySeqCount starts to count. condition B compares the Low of the 8th count versus the Close of the 5th count. For the 8th count to print, condition A and B must be true. Otherwise the "8" is substituted with a "+" if one of the condition is true. This continues until both conditions are true and an "8" is printed. With my code, the "8" and "9" are printed on the same bar. If I switch BuySeqCount == 7 instead of 8, the "7" and "8" are printed on the same bar. Chart is enclosed. Would you guys mind helping? Thanks in advance!
Attached Images
File Type: jpg ^DXY 5_2_2007 - 9_10_2007 (Daily).jpg (51.9 KB, 11 views)
kaywai is offline  
Reply With Quote
Old 04-05-2010, 11:51 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Unfortunately I do not see anything with a quick review. What I suggest is for you to Print() your counter value at each step of the way along with a timestamp to see at what time it becomes what value. Then run through the code logic slowly by hand to see what is going on.
NinjaTrader_Josh 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
Any ideas why this is not working correctly please vast524 Strategy Development 9 07-28-2009 04:07 PM
How to do this correctly? ScalpGuy Indicator Development 3 07-24-2009 06:43 AM
Print() duck_CA Strategy Development 2 03-07-2009 01:18 PM
Print() help frogzillafx Indicator Development 5 10-21-2008 10:26 AM
Print() WDieter General Programming 2 05-23-2008 10:55 AM


All times are GMT -6. The time now is 07:19 PM.