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
extern bool alertenable = true;
string msgString = "";
.
.
.//some code not shown...
.
int start()
{
mytime = Hour()*100+Seconds();
if (checkBars() && CheckProfit() && CheckTime() && CheckOpenOrders() && CheckMargin())
{
if (BuyConditionsMet())
{
OpenBuyOrder();
SendAlert();
}
if (SellconditionsMet())
{
OpenSellOrder();
SendAlert();
}
}
else checkForClose();
}
///////////////////////////
int SendAlert(string msgString)
{
if (alertenable) { Alert(msgString);}
}
/////////////////////////////
bool BuyConditionsMet()
{
double Macd0 = iMACD(NULL, 0,9,64,112,PRICE_CLOSE,MODE_MAIN,0);
double Macd1 = iMACD(NULL, 0,9,64,112,PRICE_CLOSE,MODE_MAIN,1);
if (Macd0 > 0 && Macd1 < 0) { return(1);}
else {return(0);}
}
/////////////////////////////
bool SellConditionsMet()
{
double Macd0 = iMACD(NULL, 0,9,64,112,PRICE_CLOSE,MODE_MAIN,0);
double Macd1 = iMACD(NULL, 0,9,64,112,PRICE_CLOSE,MODE_MAIN,1);
if (Macd0 < 0 && Macd1 > 0) { return(1);}
else {return(0);}
}