Hope someone can help with this. I had a programmer design a plugin DLL that generates buying conditions based on certain algorithms.
The DLL creates a custom function in AmiBroker, ConditionGen( ) that spits back hundreds of different conditions in the form of strings, such as:
MA(C, 12) > C5 AND MA(C,20) < Close
So I am trying to use the function to dynamically set variables, but just realized that VarSet only works for numbers and VarSetText only sets string values. But how do I convert the string to characters that AmiBroker will recognize? In other words, I want AmiBroker to recognize "MA" as moving average, not just the letters 'M' and 'A'.
This is how I use the function in an optimization run, but it doesn't work because values returned by ConditionGen remain as dead strings, as far as AmiBroker can see:
Optimize ("count", 1,1,500,1);
C5 = Ref(C, -5); // ...etc: A number of variables set so that values returned by ConditionGen make sense
VarSetText( "Condition"+NumToStr(Count,1.0,0), ConditionGen(Count));
Buy = VarGetText( "Condition"+NumToStr(Count,1.0,0) );
Sell = etc...
Instead of setting Buy to the dynamic VarGetText, I imagine I first need to somehow convert that string to somehow strip away the string property and just leave alphanumeric values. How could that be achieved?
Any help much appreciated.
|