Indicator Methods (A Scope problem?)
Indicator Methods (A Scope problem?)
28 Apr 2015, 21:54
I'm using a library in an indicator, the class variables of the library are declared in the indicator and the instances are created in the 'initialise' section. I have a method in the indicator that does some processing, I only want to call it from the cBot e.g.
myIndicator.myMethod(index);
If the method is called from inside Calculate it works fine, however if the method is called by the cBot I get the following error:
InvalidOperationException: Operation is not valid due to the current state of the object.
Originally instantiating the class in Calculate (even though the variable is part of the indicator) caused a null ref when the method tried to access it. Now I have this error. Whats going on here and how can I make this object accessible here?
WhiteSage
29 Apr 2015, 00:12
It turns out calling myIndicator.Calculate from a bot doesn't execute correctly.
I had a parameter called ENABLE that was set to false by default (to prevent the indicator recalcing all the time), then tried the following:
But it doesn't fire the method correctly for some reason.
@WhiteSage