[SOLVED] Getting custom indicator in a strategy
Is there something special about getting custom indicator in a strategy?
The docs are stating this:
Script property Gets the NETIndicator object instance for custom indicators, null for builtin indicators SYNTAX public NETIndicator Script { get; }
There is not method in Indicators to get the custom indicator object.
Edit: I got it: Indicators.iCustom(...);
Creating an object like "MyIndicator myIndicator = new MyIndicator();" in the Init function of the strategy, does not even call the constructor of MyIndicator, which is very strange.
The docs need more examples and polish :)
Thanks.
Hi BeardPower
I see you are getting involved into strategy alchemy. Nice job. Let me share some of niceties, which coder is going to face while implementing any strategy. First and yes you got it correctly, iCustom method is there to handle indicator value feeding. Actually there is a good definition and example available in the api docs, moreover you can find more of examples back in you PC (AppData\Roaming\Protrader(your version)\Examples), as it contains some useful hints. iCustom is nothing more than instance of Indicator class, and works same as iMA etc. Just pass index and retrieve value (GetValue(int line, int shift)) if you need to perform trading operations. And please make sure you have the required indicator in the folder (Documents\Protrader(your version)\My scripts\bin\indicators).
There is also an option to integrate entire calculation logic of your indicator into potential strategy without calling iCustom, this way you can be 100% sure expert advisor is going to work no matter if indicator available or not.
I am going to post strategy based on indicators i made previously and will try to implement some tricky parts as an example. So please stay tuned for upcoming uploads.
Best Regards!