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 05-07-2011, 03:08 PM   #1
TrendTracker
Member
 
Join Date: Apr 2008
Posts: 44
Thanks: 0
Thanked 0 times in 0 posts
Default CrossAbove Problem

I am trying to modify the Stochastics to plot a dot whenever %K crosses above a value of 80 or below a value of 20. I keep getting errors with my syntax and I can't figure out why. The code below:

if (CrossAbove(Stochastics(7,14,3).K[0],80,1)) DrawDot("Dwn Dot", false, 0, Stochastics(7,14,3).K[0], Color.Maroon);

gives me errors of:

"The best overloaded method match for 'NinjaTrader.Indicator.IndicatorBase.CrossAbove(do uble,NinjaTrader.Data.IDataSeries,int)' has some invalid arguments"
and
"Argument '2': cannot convert from 'int' to 'NinjaTrader.Data.IDataSeries'"


I've also tried the following and got the same results.

double value20=Stochastics(7,14,3).K[0];
if (CrossAbove(value20,80,1)) DrawDot("Dwn Dot", false, 0, value20, Color.Maroon);


Can anyone kindly help me out here?

Thanks in advance.
TrendTracker is offline  
Reply With Quote
Old 05-07-2011, 09:19 PM   #2
NinjaTrader_Austin
NinjaTrader Customer Service
 
NinjaTrader_Austin's Avatar
 
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 90 times in 82 posts
Default

TrendTracker, please try this code instead:
Code:
if (CrossAbove(Stochastics(7,14,3).K,80,1)) DrawDot("Dwn Dot", false, 0, Stochastics(7,14,3).K[0], Color.Maroon);

NinjaTrader_Austin is offline  
Reply With Quote
Old 05-08-2011, 06:13 AM   #3
TrendTracker
Member
 
Join Date: Apr 2008
Posts: 44
Thanks: 0
Thanked 0 times in 0 posts
Default

Thank you very much. I was able to get it to compile, but another issue cropped up.

The dots are being plotted on the same panel as price. I would like them to actually plot on the same panel as the Stochastics. I've used DrawDot successfully in the past. I can't see anything different in what I'm doing now that might be getting it to plot on the wrong panel.

Any help would be appreciated.
TrendTracker is offline  
Reply With Quote
Old 05-08-2011, 02:45 PM   #4
NinjaTrader_Austin
NinjaTrader Customer Service
 
NinjaTrader_Austin's Avatar
 
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 90 times in 82 posts
Default

TrendTracker, please set DrawOnPricePanel = false in the Initialize() section of your code.
NinjaTrader_Austin is offline  
Reply With Quote
Old 05-08-2011, 08:18 PM   #5
TrendTracker
Member
 
Join Date: Apr 2008
Posts: 44
Thanks: 0
Thanked 0 times in 0 posts
Default

Thank you very much!

It works great now.
TrendTracker 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
CrossAbove/Below methods - help please... Art09 Miscellaneous Support 5 10-20-2010 11:58 AM
CrossAbove() "CJS" Strategy Development 6 09-28-2010 10:41 AM
CrossAbove / CrossBelow Shansen Indicator Development 7 07-04-2009 01:19 PM
CrossAbove GreenTrade Strategy Development 1 02-26-2009 06:56 AM
What does CrossAbove/Below do? tradefaz General Programming 1 08-23-2008 12:56 PM


All times are GMT -6. The time now is 10:33 PM.