![]() |
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: May 2008
Posts: 49
Thanks: 0
Thanked 2 times in 2 posts
|
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"); } |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
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.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: May 2008
Posts: 49
Thanks: 0
Thanked 2 times in 2 posts
|
Ryan,
Thanks. I did the change of one of the diamonds to diamond2 but nothing changed re ploting the down side. |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
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"); }
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: May 2008
Posts: 49
Thanks: 0
Thanked 2 times in 2 posts
|
Any idea what can makes the "above" to plot but not the "below"?
|
|
|
|
|
|
#6 |
|
Member
Join Date: May 2008
Posts: 49
Thanks: 0
Thanked 2 times in 2 posts
|
Ryan,
Any other input to resolve this problem? |
|
|
|
|
|
#7 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
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?
Ryan M
NinjaTrader Customer Service
Last edited by NinjaTrader_RyanM; 01-19-2011 at 02:10 PM.
|
|
|
|
|
|
#8 |
|
Member
Join Date: May 2008
Posts: 49
Thanks: 0
Thanked 2 times in 2 posts
|
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) |
|
|
|
|
|
#9 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
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
Ryan M
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |