You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hi
I have an EA and I'd like to make it works with a cycle.
I've got 5 variables
double ma1 = iMA(NULL, 0, 1, 0, MODE_EMA, PRICE_CLOSE, Current + 0);
double sar = iSAR(NULL, 0, 0.02, 0.2, Current + 0);
double Macd=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,Current + 0);
double Signal=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,Current + 0);
string var_trading="ok";
the conditon for a trade is :
******************************
if (Period()==1)
{
double ma_buy = ma1>sar && Macd>Signal && var_trading=="ok" ;
}
******************************
And this is what i want :
1/the trade beginning
2/the value for var_trading became "no" --> var_trading="no"
3/ End of the trade (Takeprofit or stoploss)
4/The new trade can begin because var_trading=="no"
5/ IMPORTANT : when ma1 < sar ==> var_trading=="ok"
6/ When ma1 > sar again and if Macd>Signal ====> a new trade beginning!
7/ and the value for var_trading became "no" --> var_trading="no"
8/ etc....
*******************************
How can I do?
For many reasons, I don' want this (see my code please)
double ma_buy = ma1p1<sarp1 && ma1>sar && Macd>Signal && var_trading=="ok" ;
Best regards