![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Join Date: Nov 2006
Location: , ,
Posts: 66
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Join Date: Nov 2006
Location: , ,
Posts: 66
Thanks: 0
Thanked 0 times in 0 posts
|
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.
|
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Join Date: Nov 2006
Location: , ,
Posts: 66
Thanks: 0
Thanked 0 times in 0 posts
|
No, I see ones I have created, but notcustom indicatorsfroma vendor.
|
|
|
|
|
|
#6 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
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.
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Join Date: Nov 2006
Location: , ,
Posts: 66
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#8 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Join Date: Nov 2006
Location: , ,
Posts: 66
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#10 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#11 |
|
Join Date: Nov 2006
Location: , ,
Posts: 66
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#12 |
|
Junior Member
Join Date: Jan 2007
Location: Boston
Posts: 29
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#13 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Try
tradingPrice = this.MyIndicator.Values[0];
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#14 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
My mistake:
tradingPrice = this.MyIndicator.Value[0];
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#15 |
|
Junior Member
Join Date: Jan 2007
Location: Boston
Posts: 29
Thanks: 0
Thanked 0 times in 0 posts
|
Yes, I tried that also, gives the same compile error.
Thanks, Darryl |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|