Topic: Turning indicators on and off in single strategy
Im wondering if someone can help with with this problem.
I want to be able to turn ON/OFF opening and closing indicators signals given by EA Studio generated stratgies from the strategy properties screen on MT4. Reason being is I am building some EA's for some friends and they want to be able to play around with what indicators they want to use ie build a EA using EA Studio with RSI,MACD,EMA and they then have the ability to turn off the RSI for example.
The way I have tried is making the Indictor a bool however if I do this and set to false then no entry signals are created, due to how the manageOpen is coded:
void ManageOpen()
{
double ind0val1 = iRSI(NULL,0,Ind0Param0,PRICE_CLOSE,1);
bool ind0long = ind0val1 > Ind0Param1 + sigma && ActivateRSI;
bool ind0short = ind0val1 < 100 - Ind0Param1 - sigma ;
double ind1val1 = iMA(NULL,0,Ind1Param0,0,MODE_LWMA,PRICE_CLOSE,1);
double ind1val2 = iMA(NULL,0,Ind1Param1,0,MODE_LWMA,PRICE_CLOSE,1);
bool ind1long = ind1val1 > ind1val2 + sigma && ActivateVWMA;
bool ind1short = ind1val1 < ind1val2 - sigma ;
double ind2val1 = iMACD(NULL,0,Ind2Param0,Ind2Param1,Ind2Param2,PRICE_CLOSE,MODE_MAIN,1);
double ind2val2 = iMACD(NULL,0,Ind2Param0,Ind2Param1,Ind2Param2,PRICE_CLOSE,MODE_MAIN,2);
double ind2val3 = iMACD(NULL,0,Ind2Param0,Ind2Param1,Ind2Param2,PRICE_CLOSE,MODE_MAIN,3);
bool ind2long = ind2val1 > ind2val2 + sigma && ind2val2 < ind2val3 - sigma && ActivateMACD;
bool ind2short = ind2val1 < ind2val2 - sigma && ind2val2 > ind2val3 + sigma ;
double ind3val1 = iMA(NULL,0,Ind3Param0,0,MODE_EMA,PRICE_CLOSE,1);
double ind3val2 = iMA(NULL,0,Ind3Param1,0,MODE_EMA,PRICE_CLOSE,1);
bool ind3long = ind3val1 > ind3val2 + sigma && ActivateEMA;
bool ind3short = ind3val1 < ind3val2 - sigma ;
const bool canOpenLong = ind0long && ind1long && ind2long && ind3long;
const bool canOpenShort = ind0short && ind1short && ind2short && ind3short;
if(canOpenLong && canOpenShort)
return;
if(canOpenLong)
OpenPosition(OP_BUY);
else if(canOpenShort)
OpenPosition(OP_SELL);
}