I know nothing about programming. But i just tried to mingle two EA namely "Separation alert which will use proper separation watch in between two pairs,according this alert i want to place orders with stop loss and take profit by "Hedge trader EA code..

 


//---- input parameters
extern double Lot1=0.1;
extern double Lot2=0.1;
extern string Sym1="EURUSD";
extern string Sym2="USDCHF";
extern string Operation1="buy";
extern string Operation2="buy";
extern string ExpertName = " Separation Alert EA";
extern double MidlineEURUSD = 1.3796;
extern double MidlineUSDCHF = 1.1344;
extern double AlertDeviationORDER = 30.0;
extern double AlertDeviationSTOP = 250.0;
extern double Commission1=0.0;
extern double Commission2=0.0;
extern double Profit=10;
extern double stoploss=0;
extern bool UseMM=true;
extern bool Alerts = TRUE;
extern double Delta=750;
int OP1=-1, OP2=-1;


double Ilo1=0, Ilo2=0;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{

return(0);
}
void ChartComment() {
double l_bid_16 = MarketInfo("EURUSD", MODE_BID);
double l_bid_32 = MarketInfo("USDCHF", MODE_BID);
double ld_0 = 10000.0 * (l_bid_16 - MidlineEURUSD);
double ld_8 = 10000.0 * (l_bid_32 - MidlineUSDCHF);
double ld_24 = ld_0 + ld_8;
double ld_40 = ld_0 + 1.0 * ld_8;
string ls_48 = "";
string ls_56 = "----------------------------------------\n";
string ls_64 = "\n";
ls_48 = ls_56;
ls_48 = ls_48 + "EURUSD=" + ld_0 + ls_64;
ls_48 = ls_48 + "USDCHF=" + ld_8 + ls_64;
ls_48 = ls_48 + "TOTAL SEPARATION=" + ld_24 + ls_64;
ls_48 = ls_48 + ls_56;
Comment(ls_48);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start() {
ChartComment();{
double l_bid_16 = MarketInfo("EURUSD", MODE_BID);
double l_bid_32 = MarketInfo("USDCHF", MODE_BID);
double ld_0 = 10000.0 * (l_bid_16 - MidlineEURUSD);
double ld_8 = 1.0 * (10000.0 * (l_bid_32 - MidlineUSDCHF));
double ld_24 = ld_0 + ld_8;
if (Alerts == TRUE) {
if (ld_24 >= AlertDeviationORDER) {
PlaySound("buy.wav");
MessageBox("Buy EURUSD and USDCHF");
Alerts = FALSE;
}
if (ld_24 <= -1.0 * AlertDeviationORDER) {
PlaySound("sell.wav");
MessageBox("Sell EURUSD and USDCHF");
Alerts = FALSE;
}
if (ld_24 <= AlertDeviationSTOP) {
PlaySound("recovery sell.wav");
MessageBox("RECOVERY SELL GBPUSD/STOP");
Alerts = FALSE;
}
if (ld_24 >= -1.0 * AlertDeviationSTOP) {
PlaySound("recovery buy.wav");
MessageBox("RECOVERY BUY GBPUSD/STOP");
Alerts = FALSE;
}
if (ld_24 >= AlertDeviationORDER) {
OrderSend(Sym1," Lot=",Ilo1,MODE_ASK,0,0,0,);
OrderSend = FALSE;
}
if (ld_24 <= -1.0 * AlertDeviationORDER){
OrderSend(Sym1," Lot=",Ilo1,MODE_BID,0,0,0,);
OrderSend = FALSE;
}
if (ld_24 <= -1.0 * AlertDeviationORDER) {
OrderSend(Sym2," Lot=",Ilo2,MODE_BID,0,0,0,);
OrderSend= FALSE;
}
if (ld_24 >= AlertDeviationORDER) {
OrderSend(Sym2," Lot=",Ilo2,MODE_ASK,0,0,0,);
OrderSend = FALSE;
}
if (ld_24 <= AlertDeviationSTOP) {
OrderClose(Sym1,MODE_ASK,0,0,0,);
OrderClose(Sym2,MODE_ASK,0,0,0,);
OrderClose = FALSE;
}
if (ld_24 >= -1.0 * AlertDeviationSTOP){
OrderClose(Sym1,MODE_BID,0,0,0,);
OrderClose(Sym2,MODE_BID,0,0,0,);
OrderClose FALSE;
}
}
return (0);
}

}//
}
//---- End Function

 
  1. Please edit post title to be much much shorter.
  2. Please attach the code as an attachment.
  3. For short code snippets use the SRC button.
Reason: