NinjaTrader Support Forum  

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 01-19-2011, 09:35 AM   #1
Tzachi
Member
 
Join Date: May 2008
Posts: 49
Thanks: 0
Thanked 2 times in 2 posts
Default No DrawDown

I try to plot a diamond+sound when jWillimas2 cross above and below the 20 and 80 lines.

The cross above works fine and plot the diamons and sound.
The cross below is not ploting a thing.

Please see attached and please if anyone can get it, please do.

protectedoverridevoid OnBarUpdate()

{
if (CrossAbove(jWilliams2(8,14,0),22,1))


{
// play sound
DrawDiamond("Diamond"+CurrentBar, 0, Low[0] - 3*TickSize, Color.Black);
PlaySound(
@"C:\Program Files\NinjaTrader 6.5\sounds\Alert1.wav");
}


if (CrossBelow(jWilliams2(8,14,0),80,1))


{
// play sound
DrawDiamond("Diamond"+CurrentBar, 0, High[0] + 3*TickSize, Color.Black);
PlaySound(
@"C:\Program Files\NinjaTrader 6.5\sounds\Alert1.wav");
}
Attached Files
File Type: cs JWcross.cs (6.4 KB, 4 views)
Tzachi is offline  
Reply With Quote
Old 01-19-2011, 09:41 AM   #2
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Hello Tzachi,

You are using the same tag for both drawing objects, so that should be the first item to change. Change one of the tags to "Diamond2"+CurrentBar, for example.
NinjaTrader_RyanM is offline  
Reply With Quote
Old 01-19-2011, 09:48 AM   #3
Tzachi
Member
 
Join Date: May 2008
Posts: 49
Thanks: 0
Thanked 2 times in 2 posts
Default

Ryan,

Thanks. I did the change of one of the diamonds to diamond2 but nothing changed re ploting the down side.
Tzachi is offline  
Reply With Quote
Old 01-19-2011, 10:32 AM   #4
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Did you compile the changes (Right click in editor > Compile) as well as reload NinjaScript (Right click on chart > Reload NinjaScript)?

If you've done this but are still not seeing the diamond, a simple print statement can be used to verify the condition is evaluating true. Check the print statement through the Tools > output window.

if (CrossBelow(jWilliams2(8,14,0),80,1))
{
// play sound
Print("DownSide Triggered");
DrawDiamond("Diamond2"+CurrentBar, 0, High[0] + 3*TickSize, Color.Black);
PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\Alert1.wav");
}
NinjaTrader_RyanM is offline  
Reply With Quote
Old 01-19-2011, 10:34 AM   #5
Tzachi
Member
 
Join Date: May 2008
Posts: 49
Thanks: 0
Thanked 2 times in 2 posts
Default

Any idea what can makes the "above" to plot but not the "below"?
Tzachi is offline  
Reply With Quote
Old 01-19-2011, 02:00 PM   #6
Tzachi
Member
 
Join Date: May 2008
Posts: 49
Thanks: 0
Thanked 2 times in 2 posts
Default

Ryan,

Any other input to resolve this problem?
Tzachi is offline  
Reply With Quote
Old 01-19-2011, 02:05 PM   #7
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Sorry - didn't reply because there was no feedback on my last suggestions. You compiled and reloaded, added print statement? Were you able to get confirmation that the condition returned true?
Last edited by NinjaTrader_RyanM; 01-19-2011 at 02:10 PM.
NinjaTrader_RyanM is offline  
Reply With Quote
Old 01-20-2011, 06:40 AM   #8
Tzachi
Member
 
Join Date: May 2008
Posts: 49
Thanks: 0
Thanked 2 times in 2 posts
Default

Can anyone help me find out what the problem with CrossDown plot as I posted on post #1?

Still cannot get it to plot the down diamond.

(print commend did not show anything on the output window)
Tzachi is offline  
Reply With Quote
Old 01-20-2011, 09:25 AM   #9
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Tzachi,

If the print statement didn't appear, then likely you have no bars that meet the condition. For the crossbelow condition to be true, the value of the indicator must be above 80 and then cross below it.

To debug this, print the value of the indicator to verify it's what you expect. Please see here for help using the debugging tools:
http://www.ninjatrader-support.com/v...ead.php?t=3418
NinjaTrader_RyanM 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
Drawdown calculation lgarcia3 Strategy Development 9 08-19-2010 10:44 AM
Max. Drawdown FatCanary Strategy Analyzer 2 08-04-2010 05:25 AM
Backtest max drawdown ctrlbrk Strategy Analyzer 4 04-26-2009 11:43 AM
Drawdown Question Matt_H Miscellaneous Support 19 04-02-2009 03:35 PM
Max Drawdown Calculation Anagoge Strategy Analyzer 6 11-03-2008 10:43 PM


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