NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 01-22-2007, 10:26 AM   #1
SuzyG
 
Join Date: Nov 2006
Location: , ,
Posts: 66
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

How do Iaccess a custom indicator in my strategy when I do not have the source code? I added the .dll to the strategy script using "references". When I refer to it as I would any indicator, I get this error:

'NinjaTrader.Indicator.Name' is a 'type' but is used like a 'variable'

I don't know what this means.

Thanks.
SuzyG is offline  
Reply With Quote
Old 01-22-2007, 10:55 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Post imported post

Hi SuzyG,

Please refer to the HelpGuide > NinjaScript > Distributing Custom NinjaScript Indicators > Distribution Step 5

You should have a DLL and a Vendor file (two files) from the source of the custom DLL provider. If you do not, please contact the vendor.

Ray


NinjaTrader_Ray is offline  
Reply With Quote
Old 01-22-2007, 11:13 AM   #3
SuzyG
 
Join Date: Nov 2006
Location: , ,
Posts: 66
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

I have a .cs file in bin\custom\indicator and a .dll in bin\custom. I still don't get how I can refer to the indicator.
SuzyG is offline  
Reply With Quote
Old 01-22-2007, 11:57 AM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Post imported post

If you have the required files, within your strategy, you can type "this." and you will see all methods and properties of the strategy which should then include the custom indicator. You can then select the method and go from there. If you do not see this, please let me know.
NinjaTrader_Ray is offline  
Reply With Quote
Old 01-22-2007, 01:35 PM   #5
SuzyG
 
Join Date: Nov 2006
Location: , ,
Posts: 66
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

No, I see ones I have created, but notcustom indicatorsfroma vendor.
SuzyG is offline  
Reply With Quote
Old 01-23-2007, 12:31 AM   #6
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Post imported post

Let's start from scratch.

a) Do you want to reference a custom indicator you coded by yourself -> make sure you coded this indicator using NT6B5 or later, then you simply can reference liek Ray said by typing"this."

b) Do you want to reference a custom indicator which was coded by a vendor -> the vendor tehn should have build this indicator with NT6B5 or later and should have provided you 2 files as per documentation Ray referenced below

If none of above is correct, then likely indicator was not build using NT6B5 or later, in this case you can not reference the custom indicator.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 01-26-2007, 02:45 AM   #7
SuzyG
 
Join Date: Nov 2006
Location: , ,
Posts: 66
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

a) I can see the indicators I have coded. "This." shows them.

b) Yes, this is my trouble. In this case, I do have the source code and one compiled .dll. I have opened the source code and re-compiled in the 6.0.0.6 version. I still do not see it with "this." nor can I reference it in my scripts.

Since I have the source code, I should be able to do something with it. It seems like recompiling it should have worked. ??

Thank you.
SuzyG is offline  
Reply With Quote
Old 01-26-2007, 02:58 AM   #8
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Post imported post

When you say you have source file, do you mean the actual indicator file itself? If yes, make sure you remove any DLL that was provided to you. Restart NT. Save the indicator file in C:\Program Files\NinjaTrader 6\bin\Custom\Indicator, open it, compile it, then it will be available.

Ray
NinjaTrader_Ray is offline  
Reply With Quote
Old 02-24-2007, 12:02 PM   #9
SuzyG
 
Join Date: Nov 2006
Location: , ,
Posts: 66
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

Hi Ray,

I did what you suggested and do not have the vendor's .dll in bin\custom. I have the source .cs or maybe part of it. I am not sure. It contains calculations, etc. There is no NinjaScript generated code. Since the generated code is missing, what does this mean? I can use the indicator on my chart, but not see it when I type this. or access it from within a strategy or indicator.

Thank you,

SuzyG
SuzyG is offline  
Reply With Quote
Old 02-25-2007, 03:13 AM   #10
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Post imported post

If you have the source, then just compile it and you will be able to use within other indicators or a strategy. If you don't have the source and only the DLL then you must request the Vendor file from the vendor.

Ray
NinjaTrader_Ray is offline  
Reply With Quote
Old 02-25-2007, 05:01 AM   #11
SuzyG
 
Join Date: Nov 2006
Location: , ,
Posts: 66
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

Yes, I should have clarified that. I did compile it.

Irebuilt it so I could get the generated code and now it works. Thank you for your help.
SuzyG is offline  
Reply With Quote
Old 03-13-2007, 09:50 AM   #12
DarrylT
Junior Member
 
Join Date: Jan 2007
Location: Boston
Posts: 29
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

Hi,

I think my question is related to this topic. I have a custom indicatorwhose valueI want to use in a strategy. In the strategy Initialize method I've got:

Add(MyIndicator(
1, 4, false, 80));

Then in the OnBarUpdate I tried:

tradingPrice =
this.MyIndicator.Value;

to obtain the indicator value, so I didn't have to duplicate the indicator code in the strategy. But this gives a compile error saying:

"'NinjaTrader.Strategy.Strategy.MyIndicator(in t, double, bool, int)' is a method, which is not valid in the given context."

Is there a better way to obtain the included indicator value?

Thanks,

Darryl
DarrylT is offline  
Reply With Quote
Old 03-13-2007, 09:55 AM   #13
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Post imported post

Try



tradingPrice = this.MyIndicator.Values[0];
NinjaTrader_Ray is offline  
Reply With Quote
Old 03-13-2007, 09:56 AM   #14
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Post imported post

My mistake:

tradingPrice = this.MyIndicator.Value[0];
NinjaTrader_Ray is offline  
Reply With Quote
Old 03-13-2007, 09:59 AM   #15
DarrylT
Junior Member
 
Join Date: Jan 2007
Location: Boston
Posts: 29
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

Yes, I tried that also, gives the same compile error.

Thanks,

Darryl


DarrylT 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


All times are GMT -6. The time now is 05:59 AM.