Need To Modify Good EA

 

Hi


Anybody please add more option in this EA like stop loss,TP,,Trailing stop,trading time and trading day .


thanks in advance

here is code i attached file as well.




extern bool fractionalpips = TRUE;
extern double NumberOfLots = 1.0;
extern double LotSize = 0.1;
extern int MagicNumber = 7777777;
extern int Slippage = 4;
bool gi_104 = TRUE;
string g_symbol_108;
int gi_unused_116 = 0;
int gi_120;

void start() {
int l_ticket_8;
int l_ord_close_12;
double l_ord_lots_24;
double l_ord_open_price_40;
int l_cmd_4 = -1;
double ld_unused_48 = 0;
int li_unused_72 = 0;
int li_unused_76 = 0;
int li_unused_80 = 0;
bool li_84 = FALSE;
bool li_88 = FALSE;
string ls_92 = "FXCM_AwesomeIndicator_Oscillator";
if (WindowExpertName() != ls_92) {
Comment(""
+ "\n"
+ "\n"
+ " FXCM_AwesomeIndicator_Oscillator.ex4 is required to run this script.");
return;
}
Comment(""
+ "\n"
+ "FXCM Programming Services Awesome Indicator Oscillator"
+ "\n");
if (Bars < 50) {
Alert("Not enough bars in the window.");
return;
}
if (gi_104 == FALSE) {
Alert("Critical error. EA doesnt work.");
return;
}
if (fractionalpips == TRUE) gi_120 = 10;
else gi_120 = 1;
double l_slippage_16 = Slippage * gi_120;
g_symbol_108 = Symbol();
int l_count_0 = 0;
for (int li_100 = 1; li_100 <= OrdersTotal(); li_100++) {
if (OrderSelect(li_100 - 1, SELECT_BY_POS) == TRUE) {
if (OrderSymbol() != g_symbol_108 || OrderMagicNumber() != MagicNumber) continue;
if (OrderType() > OP_SELL) {
Alert("Pending order detected.");
return;
}
l_count_0++;
if (l_count_0 > 1) return;
l_ticket_8 = OrderTicket();
l_cmd_4 = OrderType();
l_ord_open_price_40 = OrderOpenPrice();
l_ord_lots_24 = OrderLots();
}
}
RefreshRates();
double l_iao_56 = iAO(Symbol(), 0, 1);
double l_iao_64 = iAO(Symbol(), 0, 2);
if (l_iao_56 > l_iao_64) li_84 = TRUE;
else li_84 = FALSE;
if (l_iao_56 < l_iao_64) li_88 = TRUE;
else li_88 = FALSE;
double l_lots_32 = LotSize * NumberOfLots;
while (true) {
if (l_cmd_4 == OP_SELL && li_84 == TRUE) {
RefreshRates();
l_ord_close_12 = OrderClose(l_ticket_8, l_ord_lots_24, Ask, 20, Red);
if (l_ord_close_12 == 0) {
Alert("Order ", OrderTicket(), " failed to close. Error:", GetLastError());
Sleep(2000);
return;
}
l_count_0 = 0;
}
if (l_cmd_4 == OP_BUY && li_88 == TRUE) {
RefreshRates();
l_ord_close_12 = OrderClose(l_ticket_8, l_ord_lots_24, Bid, 20, Red);
if (l_ord_close_12 == 0) {
Alert("Order ", OrderTicket(), " failed to close. Error:", GetLastError());
Sleep(2000);
return;
}
l_count_0 = 0;
}
if (l_count_0 == 0 && li_84 == TRUE) {
RefreshRates();
l_ticket_8 = OrderSend(g_symbol_108, OP_BUY, l_lots_32, Ask, l_slippage_16, 0, 0, "Automated", MagicNumber, 0, Green);
if (l_ticket_8 > 0) {
Alert("Opened order Buy ", l_ticket_8);
return;
}
if (Fun_Error(GetLastError()) == 1) continue;
return;
}
if (!(l_count_0 == 0 && li_88 == TRUE)) break;
RefreshRates();
l_ticket_8 = OrderSend(g_symbol_108, OP_SELL, l_lots_32, Bid, l_slippage_16, 0, 0, "Automated", MagicNumber, 0, Red);
if (l_ticket_8 > 0) {
Alert("Opened order Sell ", l_ticket_8);
return;
}
if (Fun_Error(GetLastError()) == 1) continue;
break;
}
}

int Fun_Error(int ai_0) {
switch (ai_0) {
case 4:
Alert("Trade server is busy. Trying once again..");
Sleep(3000);
return (1);
case 135:
Alert("Price changed. Trying once again..");
RefreshRates();
return (1);
case 136:
Alert("No prices. Waiting for a new tick..");
while (RefreshRates() == FALSE) Sleep(1);
return (1);
case 137:
Alert("Broker is busy. Trying once again..");
Sleep(3000);
return (1);
case 146:
Alert("Trading subsystem is busy. Trying once again..");
Sleep(500);
return (1);
case 2:
Alert("Common error.");
return (0);
case 5:
Alert("Old terminal version.");
gi_104 = FALSE;
return (0);
case 64:
Alert("Account blocked.");
gi_104 = FALSE;
return (0);
case 133:
Alert("Trading forbidden.");
return (0);
case 134:
Alert("Not enough money to execute operation.");
return (0);
}
Alert("Error occurred: ", ai_0);
return (0);
}

 
Don't post decompiled code or the original author has every right to take legal actions against you, resulting in you losing your house, your car, your dog and your wife.
 
thx for helping
 
rajkiran_s:
thx for helping
You're welcome.