![]() |
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Apr 2008
Posts: 44
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 90 times in 82 posts
|
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);
Austin
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Apr 2008
Posts: 44
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 90 times in 82 posts
|
TrendTracker, please set DrawOnPricePanel = false in the Initialize() section of your code.
Austin
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Apr 2008
Posts: 44
Thanks: 0
Thanked 0 times in 0 posts
|
Thank you very much!
It works great now. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |