Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I am facing the problem of setting the syntaxes correctly in the "DEMA VARIABLES" section of the below code.
Also do tell what to include after "#include " section with respect to Dema Variables.
I get the errors
'DEMA1' - variable not defined.
'DEMA2' - variable not defined.
'DEMA3' - variable not defined.
Please help.
if (TradeOrAlert) {
if (DEMA1)>(DEMA2) {CLOSESHORT(Symbol()) ;}
if (DEMA1)<(DEMA2) {CLOSELONG(Symbol()) ;}
if ((DEMA1)>(DEMA2)) && ((DEMA2)>(DEMA3)) {BUY(Symbol(), B_Symbol_LS_0, B_Symbol_TP_0, B_Symbol_SL_0, B_Symbol_TS_0, "if ((DEMA1)>(DEMA2)) && ((DEMA2)>(DEMA3))";}
if ((DEMA1)<(DEMA2)) && ((DEMA2)<(DEMA3)) {SELL(Symbol(), S_Symbol_LS_0, S_Symbol_TP_0, S_Symbol_SL_0, S_Symbol_TS_0, "if ((DEMA1)<(DEMA2)) && ((DEMA2)<(DEMA3))";}
CheckTrailingStop(Symbol(), 0, MagicNumberLong, B_Symbol_TS_0);
CheckTrailingStop(Symbol(), 1, MagicNumberShort, S_Symbol_TS_0);
} else {
if (DEMA1)>(DEMA2) {MyAlert("if (DEMA1)>(DEMA2)", "CLOSESHORT(Symbol(),0.1,100,15,17)", Symbol());}
if (DEMA1)<(DEMA2) {MyAlert("if (DEMA1)<(DEMA2)", "CLOSELONG(Symbol(),0.1,100,15,17)", Symbol());}
if ((DEMA1)>(DEMA2)) && ((DEMA2)>(DEMA3)) {MyAlert("if ((DEMA1)>(DEMA2)) && ((DEMA2)>(DEMA3))", "BUY(Symbol(),0.1,100,15,17)", Symbol());}
if ((DEMA1)<(DEMA2)) && ((DEMA2)<(DEMA3)) {MyAlert("if ((DEMA1)<(DEMA2)) && ((DEMA2)<(DEMA3))", "SELL(Symbol(),0.1,100,15,17)", Symbol());}
}
g_bars_276 = Bars;
return (0);
}
//----DEMA VARIABLES----Not properly set, help needed-----
int start() {
double DEMA1 = (iMA(NULL,NULL,4,0,MODE_EMA,PRICE_CLOSE,0))*2 - (iMA(NULL,NULL,4,0,MODE_EMA,iMA(NULL,NULL,4,0,MODE _EMA,PRICE_CLOSE,0),0));
return(DEMA1);
}
int start() {
double DEMA2 = (iMA(NULL,NULL,6,0,MODE_EMA,PRICE_CLOSE,0))*2 - (iMA(NULL,NULL,6,0,MODE_EMA,iMA(NULL,NULL,6,0,MODE _EMA,PRICE_CLOSE,0),0));
return(DEMA2);
}
int start() {
double DEMA3 = (iMA(NULL,NULL,12,0,MODE_EMA,PRICE_CLOSE,0))*2 - (iMA(NULL,NULL,12,0,MODE_EMA,iMA(NULL,NULL,12,0,MO DE_EMA,PRICE_CLOSE,0),0));
return(DEMA3);
}
//