Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Exposing indicator settings that is used in a strategy
I have a custom indicator I wrote with about 20 or so parameters. I want to make a strategy using that indicator, but I really dont want to have to write all the indicator getter ans setter paramater code again in the strategy -- Is it possible to expose the parameter settings of the indicator automatically in the strategy? or must I code and write all the indicator parameter getter and setter codes in the strategy again, and map it to the indicator in my strategy?
Thank you in advance.
Can you help answer these questions from other members on NexusFi?
Ok, can we use named parameters? I cant get them to work it seems, for ninjascript , as we are not using the new keyword, just assigning, the indicator... unfortunately, it looks like i am forced to go through the list of each parameter, in perfect sequence. If I make an error, or update my indicator, things can break without me knowing...
If there were defaults or named parameters that I could get to work, that would be great. If anyone has suggestions please let me know..
You can just call the indicator from your strategy passing in named parameters from variables that you expose in your strategy Parameter section.
e.g. if (RSI(myPeriod, mySmooth)[0] is something) blah, blah
Where myPeriod and mySmooth are variables declared in your strategy and exposed in the strat's parameter section as usual, so then the order is irrelevant, and not all of them need to be exposed.
The compiler will stop anything breaking without you realising as Ninja always recompiles all user indicators and strats when any code change is made and F5 is hit. Yes, it is that fast.
Cheers
ps it's a Saturday and it's been a long time since I did any strategy stuff so apologies if this is cobblers.
Also, defaults are supported in C# accessors, but not so in ninjascript as its not working...
It would be great if i could just instantiate the indicator with no arguments, such that default values are loaded then I can just set the properties one by one, but it seems that this also is not possible....
You probably need to talk to some of the more object-oriented types around here then - I don't get off on any of that fancy stuff, I just write programs (the kids now call them apps ) the way we always used to.