![]() |
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Jun 2008
Posts: 146
Thanks: 0
Thanked 0 times in 0 posts
|
Hi, I'm developing an indicator and as a base I took WilliamsR and renamed it into MyIndicator. All I did was replacing the content of OnBarUpdate() from
Value.Set(-100 * (MAX(High, Period)[0] - Close[0]) / (MAX(High, Period)[0] - MIN(Low, Period)[0] == 0 ? 1 : MAX(High, Period)[0] - MIN(Low, Period)[0])); to Value.Set( Close[0] ) Now when I plot the indicator on the graph it looks fine, but when I try to call it in NinjaScript from OnBarUpdate(), like Print(MyIndicator(10)[0]), it always gives me zero. If I use WilliamsR(10)[0] in the same context I get normal values. Why is this?
Last edited by billitin; 10-13-2008 at 09:34 PM.
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
Are you calling this from a seperate indicator, from within MyIndicator, or from within a strategy? Please post your code so we can take a look.
Ben
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jun 2008
Posts: 146
Thanks: 0
Thanked 0 times in 0 posts
|
Hi Ben, Im' calling MyIndicator from within a strategy and the basic code looks like:
OnBarUpdate() { // do something Print( MyIndicator(10)[0] ); } |
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
billitin,
It would be helpful if you could just export both your MyIndicator and your strategy and attach them here. That way we can evaluate it on our end without ambiguity. Thanks.
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Return code from Indicatore | Owlman | Indicator Development | 2 | 10-13-2008 01:21 AM |
| Cannot add return of SMA() | RandyT | Indicator Development | 1 | 09-25-2008 06:10 AM |
| How to return the Position Entry Price?? | Ninja in Training | Strategy Development | 3 | 08-05-2008 10:06 AM |
| Standard Return Code for Functions | arbifox | Automated Trading | 1 | 12-13-2007 08:21 PM |
| Return values for NTOrderStatus() | ccooper | Automated Trading | 2 | 11-11-2006 11:47 AM |