Jump to content

Baracuda (russian EA)


Guest jaet1989

Recommended Posts

Guest jaet1989

Re: Baracuda (russian EA)

 

It should open, try compiling the code below -

 

/*

Generated by EX4-TO-MQ4 decompiler V4.0.223.1c []

Website: http://purebeam.biz

E-mail : [email protected]

*/

#property copyright "Expforex, Âëàäèñëàâ"

 

 

#include <stdlib.mqh>

 

extern string _Expert = "------- Ïàðàìåòðû ñîâåòíèêà";

string gs_unused_84 = "UPLine";

string gs_unused_92 = "DNLine";

bool gi_100 = FALSE;

bool gi_104 = TRUE;

extern int LinePipsPlus = -3;

bool gi_112 = FALSE;

bool gi_116 = TRUE;

bool gi_120 = TRUE;

extern int Magic = 777777;

bool gi_128 = TRUE;

string gs_132 = "expert.wav";

bool gi_140 = FALSE;

int gi_144 = 1;

extern string Indicator = "------- Ïàðàìåòðû èíäèêàòîðà Áîëëèíäæåð";

extern int BandsPeriod = 20;

extern int BandsShift = 0;

extern double BandsDeviations = 2.0;

extern int shift = 1;

extern string Indicator2 = "------- Ïàðàìåòðû èíäèêàòîðà Ñòîõàñòèê";

extern int KPer = 5;

extern int Dper = 3;

extern int Slow = 3;

extern int StochDOWNline = 20;

extern int StochUPline = 80;

extern string Indicator3 = "------- Ïàðàìåòðû èíäèêàòîðà RSI";

extern int RSIPeriod = 14;

extern int RSIDownline = 30;

extern int RSIUpline = 70;

extern string _Trade = "------- Ïàðàìåòðû òîðãîâëè";

extern double Lots = 0.1;

extern int StopLoss = 0;

extern int TakeProfit = 0;

extern int Slippage = 3;

int gi_252 = 5;

extern int CloseHoura = 24;

extern int OpenHoura = 0;

extern string _P_Trailing = "------- Ïàðàìåòðû òðåéëèíãà";

extern bool IfProfTrail = TRUE;

extern int prchoose = 40;

extern int TrailingStop = 10;

extern string _close = "------- Ïàðàìåòðû çàêðûòèÿ";

extern bool CloseifChange = TRUE;

extern string _autolot = "------- Ïàðàìåòðû Àâòîëîòà";

extern bool Autolot = TRUE;

extern int LotsDigit = 1;

extern double Risk = 1.0;

extern double MaxLots = 9999.0;

extern bool MartinGeil = FALSE;

extern double Martinkof = 1.6;

extern double keyprotector = 0.0;

bool gi_348 = FALSE;

bool gi_352 = FALSE;

int gi_356 = 15128749;

int gi_360 = 8421616;

int gi_364 = 16776960;

int gi_368 = 4678655;

int gi_372 = 16711680;

int gi_376 = 255;

double gd_380;

double gd_388;

double gd_396;

double gd_404;

double g_ask_412;

double g_bid_420;

datetime g_time_428;

 

void init() {

Stamp();

gi_352 = FALSE;

if (!IsTradeAllowed()) {

Message("Äëÿ ðàáîòû ñîâåòíèêà íåîáõîäèìî\n" + "Ðàçðåøèòü ñîâåòíèêó òîðãîâàòü"

+ "\n íàñòðîéêàõ ñîâåòíèêà íàæèòå F7");

gi_352 = TRUE;

return;

}

if (!IsLibrariesAllowed()) {

Message("Äëÿ íîðìàëüíîé ðàáîòû ñîâåòíèêà íåîáõîäèìî\n" + "Ðàçðåøèòü èìïîðò èç âíåøíèõ ýêñïåðòîâ");

gi_352 = TRUE;

return;

}

if (!IsTesting()) {

if (IsExpertEnabled()) Message("Ñîâåòíèê âåñü â ðàáîòå");

else Message("Íàæìèòå íà êíîïêó \"Ñîâåòíèêè \"");

}

}

 

void deinit() {

if (!IsTesting()) Comment("");

}

 

void start() {

string ls_0;

if (gi_348) {

Message("Êðèòè÷åñêàÿ îøèáêà! Ñîâåòíèê ÎÑÒÀÍÎÂËÅÍ!");

return;

}

if (gi_352) {

Message("Íå óäàëîñü èíèöèàëèçèðîâàòü ñîâåòíèê!");

return;

}

gd_380 = 0;

gd_388 = 0;

if (idPriceLevel() && g_ask_412 != 0.0 && g_bid_420 != 0.0) ManagePositions();

if (gi_116) {

ls_0 = "";

if (gd_380 == 0.0) ls_0 = "Íå îïðåäåë¸í âåðõíèé öåíîâîé óðîâåíü\n";

else {

if (gi_100) ls_0 = "Ïîêóïêà îò ";

else ls_0 = "Ïðîäàæà îò ";

ls_0 = ls_0 + DoubleToStr(gd_380, Digits)

+ "\n";

if (gi_112) {

if (gi_100) {

ls_0 = ls_0 + "SellStop íà " + DoubleToStr(gd_380 - StopLoss * Point, Digits)

+ "\n";

} else {

ls_0 = ls_0 + "BuyStop íà " + DoubleToStr(gd_380 + StopLoss * Point, Digits)

+ "\n";

}

}

}

if (gd_388 == 0.0) ls_0 = ls_0 + "Íå îïðåäåë¸í íèæíèé öåíîâîé óðîâåíü";

else {

if (gi_104) ls_0 = ls_0 + "Ïîêóïêà îò ";

else ls_0 = ls_0 + "Ïðîäàæà îò ";

ls_0 = ls_0 + DoubleToStr(gd_388, Digits)

+ "\n";

if (gi_112) {

if (gi_104) {

ls_0 = ls_0 + "SellStop íà " + DoubleToStr(gd_388 - StopLoss * Point, Digits)

+ "\n";

} else {

ls_0 = ls_0 + "BuyStop íà " + DoubleToStr(gd_388 + StopLoss * Point, Digits)

+ "\n";

}

}

}

if (gd_380 > 0.0 || gd_388 > 0.0) ls_0 = "\nLots=" + DoubleToStr(Lots, 2) + " \n StopLoss=" + StopLoss + " ï." + " \n TakeProfit=" + TakeProfit + " ï.\n" + ls_0;

}

if (gd_380 > 0.0) gd_396 = gd_380;

if (gd_388 > 0.0) gd_404 = gd_388;

g_ask_412 = Ask;

g_bid_420 = Bid;

if (IfProfTrail == TRUE) trailingonlyprofit();

}

 

void ClosePosBySelect() {

bool l_ord_close_0;

color l_color_4;

double l_ord_lots_8;

double l_ask_16;

double l_bid_24;

double l_price_32;

int l_error_40;

if (OrderType() == OP_BUY || OrderType() == OP_SELL) {

for (int li_44 = 1; li_44 <= gi_252; li_44++) {

if (!IsTesting() && !IsExpertEnabled() || IsStopped()) break;

while (!IsTradeAllowed()) Sleep(5000);

RefreshRates();

l_ask_16 = MarketInfo(OrderSymbol(), MODE_ASK);

l_bid_24 = MarketInfo(OrderSymbol(), MODE_BID);

if (OrderType() == OP_BUY) {

l_price_32 = l_bid_24;

l_color_4 = gi_372;

} else {

l_price_32 = l_ask_16;

l_color_4 = gi_376;

}

l_ord_lots_8 = OrderLots();

l_ord_close_0 = OrderClose(OrderTicket(), l_ord_lots_8, l_price_32, Slippage, l_color_4);

if (l_ord_close_0) {

if (!(gi_128)) break;

PlaySound(gs_132);

return;

}

l_error_40 = GetLastError();

if (l_error_40 == 146/* TRADE_CONTEXT_BUSY */) while (IsTradeContextBusy()) Sleep(11000);

Print("Error(", l_error_40, ") Close ", GetNameOP(OrderType()), " ", ErrorDescription(l_error_40), ", try ", li_44);

Print(OrderTicket(), " Ask=", l_ask_16, " Bid=", l_bid_24, " pp=", l_price_32);

Print("sy=", OrderSymbol(), " ll=", l_ord_lots_8, " sl=", OrderStopLoss(), " tp=", OrderTakeProfit(), " mn=", OrderMagicNumber());

Sleep(5000);

}

} else Print("Íåêîððåêòíàÿ òîðãîâàÿ îïåðàöèÿ. Close ", GetNameOP(OrderType()));

}

 

void ClosePositions(string as_0 = "", int a_cmd_8 = -1, int a_magic_12 = -1) {

int l_ord_total_20 = OrdersTotal();

if (as_0 == "0") as_0 = Symbol();

for (int l_pos_16 = l_ord_total_20 - 1; l_pos_16 >= 0; l_pos_16--) {

if (OrderSelect(l_pos_16, SELECT_BY_POS, MODE_TRADES)) {

if (OrderSymbol() == as_0 || as_0 == "" && a_cmd_8 < OP_BUY || OrderType() == a_cmd_8) {

if (OrderType() == OP_BUY || OrderType() == OP_SELL)

if (a_magic_12 < 0 || OrderMagicNumber() == a_magic_12) ClosePosBySelect();

}

}

}

}

 

bool ExistOrders(string as_0 = "", int a_cmd_8 = -1, int a_magic_12 = -1, int ai_16 = 0) {

int l_cmd_28;

int l_ord_total_24 = OrdersTotal();

if (as_0 == "0") as_0 = Symbol();

for (int l_pos_20 = 0; l_pos_20 < l_ord_total_24; l_pos_20++) {

if (OrderSelect(l_pos_20, SELECT_BY_POS, MODE_TRADES)) {

l_cmd_28 = OrderType();

if (l_cmd_28 > OP_SELL && l_cmd_28 < 6) {

if (OrderSymbol() == as_0 || as_0 == "" && a_cmd_8 < OP_BUY || l_cmd_28 == a_cmd_8) {

if (a_magic_12 < 0 || OrderMagicNumber() == a_magic_12)

if (ai_16 <= OrderOpenTime()) return (TRUE);

}

}

}

}

return (FALSE);

}

 

bool ExistPositions(string as_0 = "", int a_cmd_8 = -1, int a_magic_12 = -1, int ai_16 = 0) {

int l_ord_total_24 = OrdersTotal();

if (as_0 == "0") as_0 = Symbol();

for (int l_pos_20 = 0; l_pos_20 < l_ord_total_24; l_pos_20++) {

if (OrderSelect(l_pos_20, SELECT_BY_POS, MODE_TRADES)) {

if (OrderSymbol() == as_0 || as_0 == "") {

if (OrderType() == OP_BUY || OrderType() == OP_SELL) {

if (a_cmd_8 < OP_BUY || OrderType() == a_cmd_8) {

if (a_magic_12 < 0 || OrderMagicNumber() == a_magic_12)

if (ai_16 <= OrderOpenTime()) return (TRUE);

}

}

}

}

}

return (FALSE);

}

 

string GetNameOP(int ai_0) {

switch (ai_0) {

case 0:

return ("Buy");

case 1:

return ("Sell");

case 2:

return ("Buy Limit");

case 3:

return ("Sell Limit");

case 4:

return ("Buy Stop");

case 5:

return ("Sell Stop");

}

return ("Unknown Operation");

}

 

string GetNameTF(int a_timeframe_0 = 0) {

if (a_timeframe_0 == 0) a_timeframe_0 = Period();

switch (a_timeframe_0) {

case PERIOD_M1:

return ("M1");

case PERIOD_M5:

return ("M5");

case PERIOD_M15:

return ("M15");

case PERIOD_M30:

return ("M30");

case PERIOD_H1:

return ("H1");

case PERIOD_H4:

return ("H4");

case PERIOD_D1:

return ("Daily");

case PERIOD_W1:

return ("Weekly");

case PERIOD_MN1:

return ("Monthly");

}

return ("UnknownPeriod");

}

 

int idPriceLevel() {

gd_380 = iBands(Symbol(), 0, BandsPeriod, BandsDeviations, BandsShift, PRICE_CLOSE, MODE_UPPER, shift);

if (gd_380 > 0.0) gd_380 += LinePipsPlus * Point;

gd_388 = iBands(Symbol(), 0, BandsPeriod, BandsDeviations, BandsShift, PRICE_CLOSE, MODE_LOWER, shift);

if (gd_388 > 0.0) gd_388 -= LinePipsPlus * Point;

if (gd_380 != gd_396 || gd_388 != gd_404 || gd_396 == 0.0 || gd_404 == 0.0 || gd_380 == 0.0 || gd_388 == 0.0) return (0);

return (1);

}

 

void ManagePositions() {

double ld_20;

int li_44;

int l_acc_number_0 = AccountNumber();

bool li_4 = FALSE;

bool li_8 = FALSE;

double ld_12 = GetSizeLot();

double ld_28 = 0;

double ld_36 = 0;

int l_month_48 = Month();

int l_bool_52 = IsOptimization();

int l_bool_56 = IsTesting();

int l_bool_60 = IsDemo();

string ls_64 = "Êëþ÷ Çàäàí Íåâåðíî, èëè èñòåê ñðîê äåéñòâèÿ êëþ÷à";

if ((Ask > g_ask_412 && Ask >= gd_380 && gi_100) || (Ask < g_ask_412 && Ask <= gd_388 && gi_104) && (iStochastic(Symbol(), 0, KPer, Dper, Slow, MODE_SMA, 1, MODE_SIGNAL, 0) < StochUPline &&

iStochastic(Symbol(), 0, KPer, Dper, Slow, MODE_SMA, 1, MODE_SIGNAL, 0) > StochDOWNline && iRSI(Symbol(), 0, RSIPeriod, PRICE_CLOSE, 0) < RSIUpline && iRSI(Symbol(), 0, RSIPeriod, PRICE_CLOSE, 0) > RSIDownline)) li_4 = TRUE;

if ((Bid > g_bid_420 && Bid >= gd_380 && !gi_100) || (Bid < g_bid_420 && Bid <= gd_388 && !gi_104) && (iStochastic(Symbol(), 0, KPer, Dper, Slow, MODE_SMA, 1, MODE_SIGNAL, 0) < StochUPline &&

iStochastic(Symbol(), 0, KPer, Dper, Slow, MODE_SMA, 1, MODE_SIGNAL, 0) > StochDOWNline && iRSI(Symbol(), 0, RSIPeriod, PRICE_CLOSE, 0) < RSIUpline && iRSI(Symbol(), 0, RSIPeriod, PRICE_CLOSE, 0) > RSIDownline)) li_8 = TRUE;

if (CloseifChange == TRUE && gi_140 == FALSE && Tradetime(CloseHoura, OpenHoura) == 1 ) {

if (li_4) {

if (ExistPositions(0, OP_SELL, Magic)) ClosePositions(0, OP_SELL, Magic);

if (!ExistPositions(0, OP_BUY, Magic)) {

if (gi_120) {

li_44 = OpenPosition("", OP_BUY, ld_12, 0, 0, Magic);

if (SelectByTicket(li_44)) {

if (StopLoss > 0) ld_28 = Ask - StopLoss * Point;

else ld_28 = 0;

if (TakeProfit > 0) ld_36 = Ask + TakeProfit * Point;

else ld_36 = 0;

ModifyOrder(-1, ld_28, ld_36, gi_364);

}

} else {

if (StopLoss > 0) ld_28 = Ask - StopLoss * Point;

else ld_28 = 0;

if (TakeProfit > 0) ld_36 = Ask + TakeProfit * Point;

else ld_36 = 0;

OpenPosition("", OP_BUY, ld_12, ld_28, ld_36, Magic);

}

if (gi_112 && ld_28 > 0.0 && !ExistOrders(0, OP_SELLSTOP, Magic)) {

ld_20 = ld_28;

ld_28 = ld_20 + StopLoss * Point;

if (TakeProfit > 0) ld_36 = ld_20 - TakeProfit * Point;

else ld_36 = 0;

SetOrder("", OP_SELLSTOP, ld_12, ld_20, ld_28, ld_36, Magic);

}

}

}

if (li_8) {

if (ExistPositions(0, OP_BUY, Magic)) ClosePositions(0, OP_BUY, Magic);

if (!ExistPositions(0, OP_SELL, Magic)) {

if (gi_120) {

li_44 = OpenPosition("", OP_SELL, ld_12, 0, 0, Magic);

if (SelectByTicket(li_44)) {

if (StopLoss > 0) ld_28 = Bid + StopLoss * Point;

else ld_28 = 0;

if (TakeProfit > 0) ld_36 = Bid - TakeProfit * Point;

else ld_36 = 0;

ModifyOrder(-1, ld_28, ld_36, gi_368);

}

} else {

if (StopLoss > 0) ld_28 = Bid + StopLoss * Point;

else ld_28 = 0;

if (TakeProfit > 0) ld_36 = Bid - TakeProfit * Point;

else ld_36 = 0;

OpenPosition("", OP_SELL, ld_12, ld_28, ld_36, Magic);

}

if (gi_112 && ld_28 > 0.0 && !ExistOrders(0, OP_BUYSTOP, Magic)) {

ld_20 = ld_28;

ld_28 = ld_20 - StopLoss * Point;

if (TakeProfit > 0) ld_36 = ld_20 + TakeProfit * Point;

else ld_36 = 0;

SetOrder("", OP_BUYSTOP, ld_12, ld_20, ld_28, ld_36, Magic);

}

}

}

}

if (CloseifChange == TRUE && gi_140 == TRUE && gi_144 > OrdersTotal() - 1 && Tradetime(CloseHoura, OpenHoura) == 1 ) {

if (li_4) {

if (ExistPositions(0, OP_SELL, Magic)) ClosePositions(0, OP_SELL, Magic);

if (gi_120) {

li_44 = OpenPosition("", OP_BUY, ld_12, 0, 0, Magic);

if (SelectByTicket(li_44)) {

if (StopLoss > 0) ld_28 = Ask - StopLoss * Point;

else ld_28 = 0;

if (TakeProfit > 0) ld_36 = Ask + TakeProfit * Point;

else ld_36 = 0;

ModifyOrder(-1, ld_28, ld_36, gi_364);

}

} else {

if (StopLoss > 0) ld_28 = Ask - StopLoss * Point;

else ld_28 = 0;

if (TakeProfit > 0) ld_36 = Ask + TakeProfit * Point;

else ld_36 = 0;

OpenPosition("", OP_BUY, ld_12, ld_28, ld_36, Magic);

}

if (gi_112 && ld_28 > 0.0 && !ExistOrders(0, OP_SELLSTOP, Magic)) {

ld_20 = ld_28;

ld_28 = ld_20 + StopLoss * Point;

if (TakeProfit > 0) ld_36 = ld_20 - TakeProfit * Point;

else ld_36 = 0;

SetOrder("", OP_SELLSTOP, ld_12, ld_20, ld_28, ld_36, Magic);

}

}

if (li_8) {

if (ExistPositions(0, OP_BUY, Magic)) ClosePositions(0, OP_BUY, Magic);

if (gi_120) {

li_44 = OpenPosition("", OP_SELL, ld_12, 0, 0, Magic);

if (SelectByTicket(li_44)) {

if (StopLoss > 0) ld_28 = Bid + StopLoss * Point;

else ld_28 = 0;

if (TakeProfit > 0) ld_36 = Bid - TakeProfit * Point;

else ld_36 = 0;

ModifyOrder(-1, ld_28, ld_36, gi_368);

}

} else {

if (StopLoss > 0) ld_28 = Bid + StopLoss * Point;

else ld_28 = 0;

if (TakeProfit > 0) ld_36 = Bid - TakeProfit * Point;

else ld_36 = 0;

OpenPosition("", OP_SELL, ld_12, ld_28, ld_36, Magic);

}

if (gi_112 && ld_28 > 0.0 && !ExistOrders(0, OP_BUYSTOP, Magic)) {

ld_20 = ld_28;

ld_28 = ld_20 - StopLoss * Point;

if (TakeProfit > 0) ld_36 = ld_20 + TakeProfit * Point;

else ld_36 = 0;

SetOrder("", OP_BUYSTOP, ld_12, ld_20, ld_28, ld_36, Magic);

}

}

}

if (CloseifChange == FALSE && gi_144 > OrdersTotal() - 1 && Tradetime(CloseHoura, OpenHoura) == 1 ) {

if (li_4 && g_time_428 != Time[0]) {

if (gi_120) {

li_44 = OpenPosition("", OP_BUY, ld_12, 0, 0, Magic);

if (SelectByTicket(li_44)) {

if (StopLoss > 0) ld_28 = Ask - StopLoss * Point;

else ld_28 = 0;

if (TakeProfit > 0) ld_36 = Ask + TakeProfit * Point;

else ld_36 = 0;

ModifyOrder(-1, ld_28, ld_36, gi_364);

}

} else {

if (StopLoss > 0) ld_28 = Ask - StopLoss * Point;

else ld_28 = 0;

if (TakeProfit > 0) ld_36 = Ask + TakeProfit * Point;

else ld_36 = 0;

OpenPosition("", OP_BUY, ld_12, ld_28, ld_36, Magic);

}

if (gi_112 && ld_28 > 0.0 && !ExistOrders(0, OP_SELLSTOP, Magic)) {

ld_20 = ld_28;

ld_28 = ld_20 + StopLoss * Point;

if (TakeProfit > 0) ld_36 = ld_20 - TakeProfit * Point;

else ld_36 = 0;

SetOrder("", OP_SELLSTOP, ld_12, ld_20, ld_28, ld_36, Magic);

}

g_time_428 = Time[0];

}

if (li_8 && g_time_428 != Time[0]) {

if (gi_120) {

li_44 = OpenPosition("", OP_SELL, ld_12, 0, 0, Magic);

if (SelectByTicket(li_44)) {

if (StopLoss > 0) ld_28 = Bid + StopLoss * Point;

else ld_28 = 0;

if (TakeProfit > 0) ld_36 = Bid - TakeProfit * Point;

else ld_36 = 0;

ModifyOrder(-1, ld_28, ld_36, gi_368);

}

} else {

if (StopLoss > 0) ld_28 = Bid + StopLoss * Point;

else ld_28 = 0;

if (TakeProfit > 0) ld_36 = Bid - TakeProfit * Point;

else ld_36 = 0;

OpenPosition("", OP_SELL, ld_12, ld_28, ld_36, Magic);

}

if (gi_112 && ld_28 > 0.0 && !ExistOrders(0, OP_BUYSTOP, Magic)) {

ld_20 = ld_28;

ld_28 = ld_20 - StopLoss * Point;

if (TakeProfit > 0) ld_36 = ld_20 + TakeProfit * Point;

else ld_36 = 0;

SetOrder("", OP_BUYSTOP, ld_12, ld_20, ld_28, ld_36, Magic);

}

g_time_428 = Time[0];

}

}

}

 

void Message(string as_0) {

Comment(as_0);

if (StringLen(as_0) > 0) Print(as_0);

}

 

void ModifyOrder(double a_ord_open_price_0 = -1.0, double a_ord_stoploss_8 = 0.0, double a_ord_takeprofit_16 = 0.0, color a_color_24 = -1) {

bool l_bool_28;

int l_error_76;

double l_ask_32 = MarketInfo(OrderSymbol(), MODE_ASK);

double l_bid_40 = MarketInfo(OrderSymbol(), MODE_BID);

if (a_ord_open_price_0 <= 0.0) a_ord_open_price_0 = OrderOpenPrice();

if (a_ord_stoploss_8 < 0.0) a_ord_stoploss_8 = OrderStopLoss();

if (a_ord_takeprofit_16 < 0.0) a_ord_takeprofit_16 = OrderTakeProfit();

int l_digits_72 = MarketInfo(OrderSymbol(), MODE_DIGITS);

a_ord_open_price_0 = NormalizeDouble(a_ord_open_price_0, l_digits_72);

a_ord_stoploss_8 = NormalizeDouble(a_ord_stoploss_8, l_digits_72);

a_ord_takeprofit_16 = NormalizeDouble(a_ord_takeprofit_16, l_digits_72);

double ld_48 = NormalizeDouble(OrderOpenPrice(), l_digits_72);

double ld_56 = NormalizeDouble(OrderStopLoss(), l_digits_72);

double ld_64 = NormalizeDouble(OrderTakeProfit(), l_digits_72);

if (a_ord_open_price_0 != ld_48 || a_ord_stoploss_8 != ld_56 || a_ord_takeprofit_16 != ld_64) {

for (int li_80 = 1; li_80 <= gi_252; li_80++) {

if (!IsTesting() && !IsExpertEnabled() || IsStopped()) break;

while (!IsTradeAllowed()) Sleep(5000);

RefreshRates();

l_bool_28 = OrderModify(OrderTicket(), a_ord_open_price_0, a_ord_stoploss_8, a_ord_takeprofit_16, 0, a_color_24);

if (l_bool_28) {

if (!(gi_128)) break;

PlaySound(gs_132);

return;

}

l_error_76 = GetLastError();

Print("Error(", l_error_76, ") modifying order: ", ErrorDescription(l_error_76), ", try ", li_80);

Print("Ask=", l_ask_32, " Bid=", l_bid_40, " sy=", OrderSymbol(), " op=" + GetNameOP(OrderType()), " pp=", a_ord_open_price_0, " sl=", a_ord_stoploss_8, " tp=", a_ord_takeprofit_16);

Sleep(10000);

}

}

}

 

int OpenPosition(string a_symbol_0, int a_cmd_8, double a_lots_12, double a_price_20 = 0.0, double a_price_28 = 0.0, int a_magic_36 = 0) {

color l_color_40;

int l_datetime_44;

double l_price_48;

double l_ask_56;

double l_bid_64;

int l_digits_72;

int l_error_76;

int l_ticket_84 = 0;

string l_comment_88 = WindowExpertName() + " " + GetNameTF(Period());

if (a_symbol_0 == "" || a_symbol_0 == "0") a_symbol_0 = Symbol();

if (a_cmd_8 == OP_BUY) l_color_40 = gi_356;

else l_color_40 = gi_360;

for (int li_80 = 1; li_80 <= gi_252; li_80++) {

if (!IsTesting() && !IsExpertEnabled() || IsStopped()) break;

while (!IsTradeAllowed()) Sleep(5000);

RefreshRates();

l_digits_72 = MarketInfo(a_symbol_0, MODE_DIGITS);

l_ask_56 = MarketInfo(a_symbol_0, MODE_ASK);

l_bid_64 = MarketInfo(a_symbol_0, MODE_BID);

if (a_cmd_8 == OP_BUY) l_price_48 = l_ask_56;

else l_price_48 = l_bid_64;

l_price_48 = NormalizeDouble(l_price_48, l_digits_72);

l_datetime_44 = TimeCurrent();

l_ticket_84 = OrderSend(a_symbol_0, a_cmd_8, a_lots_12, l_price_48, Slippage, a_price_20, a_price_28, l_comment_88, a_magic_36, 0, l_color_40);

if (l_ticket_84 > 0) {

if (!(gi_128)) break;

PlaySound(gs_132);

break;

}

l_error_76 = GetLastError();

if (l_error_76 == 128/* TRADE_TIMEOUT */ || l_error_76 == 142 || l_error_76 == 143) {

Sleep(66666.0);

if (ExistPositions(a_symbol_0, a_cmd_8, a_magic_36, l_datetime_44)) {

if (!(gi_128)) break;

PlaySound(gs_132);

break;

}

}

Print("Error(", l_error_76, ") opening position: ", ErrorDescription(l_error_76), ", try ", li_80);

Print("Ask=", l_ask_56, " Bid=", l_bid_64, " sy=", a_symbol_0, " ll=", a_lots_12, " op=", GetNameOP(a_cmd_8), " pp=", l_price_48, " sl=", a_price_20, " tp=", a_price_28, " mn=", a_magic_36);

if (l_ask_56 == 0.0 && l_bid_64 == 0.0) Message("Ïðîâåðüòå â Îáçîðå ðûíêà íàëè÷èå ñèìâîëà " + a_symbol_0);

if (l_error_76 == 2/* COMMON_ERROR */ || l_error_76 == 64/* ACCOUNT_DISABLED */ || l_error_76 == 65/* INVALID_ACCOUNT */ || l_error_76 == 133/* TRADE_DISABLED */) {

gi_348 = TRUE;

break;

}

if (l_error_76 == 4/* SERVER_BUSY */ || l_error_76 == 131/* INVALID_TRADE_VOLUME */ || l_error_76 == 132/* MARKET_CLOSED */) {

Sleep(300000);

break;

}

if (l_error_76 == 140/* LONG_POSITIONS_ONLY_ALLOWED */ || l_error_76 == 148/* ERR_TRADE_TOO_MANY_ORDERS */ || l_error_76 == 4110/* LONGS__NOT_ALLOWED */ || l_error_76 == 4111/* SHORTS_NOT_ALLOWED */) break;

if (l_error_76 == 141/* TOO_MANY_REQUESTS */) Sleep(100000);

if (l_error_76 == 145/* TRADE_MODIFY_DENIED */) Sleep(17000);

if (l_error_76 == 146/* TRADE_CONTEXT_BUSY */) while (IsTradeContextBusy()) Sleep(11000);

if (l_error_76 != 135/* PRICE_CHANGED */) Sleep(7700.0);

}

return (l_ticket_84);

}

 

bool SelectByTicket(int ai_0, string as_4 = "", int a_cmd_12 = -1, int a_magic_16 = -1) {

int l_ord_total_24 = OrdersTotal();

if (as_4 == "0") as_4 = Symbol();

for (int l_pos_20 = 0; l_pos_20 < l_ord_total_24; l_pos_20++) {

if (OrderSelect(l_pos_20, SELECT_BY_POS, MODE_TRADES)) {

if (OrderSymbol() == as_4 || as_4 == "" && a_cmd_12 < OP_BUY || OrderType() == a_cmd_12)

if (a_magic_16 < 0 || OrderMagicNumber() == a_magic_16 && OrderTicket() == ai_0) return (TRUE);

}

}

return (FALSE);

}

 

void SetOrder(string a_symbol_0, int a_cmd_8, double a_lots_12, double a_price_20, double a_price_28 = 0.0, double a_price_36 = 0.0, int a_magic_44 = 0, int a_datetime_48 = 0) {

color l_color_52;

int l_datetime_56;

double l_ask_60;

double l_bid_68;

double l_point_76;

int l_error_84;

int l_ticket_92;

string l_comment_100 = WindowExpertName() + " " + GetNameTF(Period());

if (a_symbol_0 == "" || a_symbol_0 == "0") a_symbol_0 = Symbol();

int l_stoplevel_96 = MarketInfo(a_symbol_0, MODE_STOPLEVEL);

if (a_cmd_8 == OP_BUYLIMIT || a_cmd_8 == OP_BUYSTOP) l_color_52 = gi_356;

else l_color_52 = gi_360;

if (a_datetime_48 > 0 && a_datetime_48 < TimeCurrent()) a_datetime_48 = 0;

for (int li_88 = 1; li_88 <= gi_252; li_88++) {

if (!IsTesting() && !IsExpertEnabled() || IsStopped()) {

Print("SetOrder(): Îñòàíîâêà ðàáîòû ôóíêöèè");

return;

}

while (!IsTradeAllowed()) Sleep(5000);

RefreshRates();

l_datetime_56 = TimeCurrent();

l_ticket_92 = OrderSend(a_symbol_0, a_cmd_8, a_lots_12, a_price_20, Slippage, a_price_28, a_price_36, l_comment_100, a_magic_44, a_datetime_48, l_color_52);

if (l_ticket_92 > 0) {

if (!(gi_128)) break;

PlaySound(gs_132);

return;

}

l_error_84 = GetLastError();

if (l_error_84 == 128/* TRADE_TIMEOUT */ || l_error_84 == 142 || l_error_84 == 143) {

Sleep(66000);

if (ExistOrders(a_symbol_0, a_cmd_8, a_magic_44, l_datetime_56)) {

if (!(gi_128)) break;

PlaySound(gs_132);

return;

}

Print("Error(", l_error_84, ") set order: ", ErrorDescription(l_error_84), ", try ", li_88);

} else {

l_point_76 = MarketInfo(a_symbol_0, MODE_POINT);

l_ask_60 = MarketInfo(a_symbol_0, MODE_ASK);

l_bid_68 = MarketInfo(a_symbol_0, MODE_BID);

if (l_ask_60 == 0.0 && l_bid_68 == 0.0) Message("SetOrder(): Ïðîâåðüòå â îáçîðå ðûíêà íàëè÷èå ñèìâîëà " + a_symbol_0);

Print("Error(", l_error_84, ") set order: ", ErrorDescription(l_error_84), ", try ", li_88);

Print("Ask=", l_ask_60, " Bid=", l_bid_68, " sy=", a_symbol_0, " ll=", a_lots_12, " op=", GetNameOP(a_cmd_8), " pp=", a_price_20, " sl=", a_price_28, " tp=", a_price_36, " mn=", a_magic_44);

if (l_error_84 == 130/* INVALID_STOPS */) {

switch (a_cmd_8) {

case OP_BUYLIMIT:

if (a_price_20 > l_ask_60 - l_stoplevel_96 * l_point_76) a_price_20 = l_ask_60 - l_stoplevel_96 * l_point_76;

if (a_price_28 > a_price_20 - (l_stoplevel_96 + 1) * l_point_76) a_price_28 = a_price_20 - (l_stoplevel_96 + 1) * l_point_76;

if (a_price_36 > 0.0 && a_price_36 < a_price_20 + (l_stoplevel_96 + 1) * l_point_76) a_price_36 = a_price_20 + (l_stoplevel_96 + 1) * l_point_76;

break;

case OP_BUYSTOP:

if (a_price_20 < l_ask_60 + (l_stoplevel_96 + 1) * l_point_76) a_price_20 = l_ask_60 + (l_stoplevel_96 + 1) * l_point_76;

if (a_price_28 > a_price_20 - (l_stoplevel_96 + 1) * l_point_76) a_price_28 = a_price_20 - (l_stoplevel_96 + 1) * l_point_76;

if (a_price_36 > 0.0 && a_price_36 < a_price_20 + (l_stoplevel_96 + 1) * l_point_76) a_price_36 = a_price_20 + (l_stoplevel_96 + 1) * l_point_76;

break;

case OP_SELLLIMIT:

if (a_price_20 < l_bid_68 + l_stoplevel_96 * l_point_76) a_price_20 = l_bid_68 + l_stoplevel_96 * l_point_76;

if (a_price_28 > 0.0 && a_price_28 < a_price_20 + (l_stoplevel_96 + 1) * l_point_76) a_price_28 = a_price_20 + (l_stoplevel_96 + 1) * l_point_76;

if (a_price_36 > a_price_20 - (l_stoplevel_96 + 1) * l_point_76) a_price_36 = a_price_20 - (l_stoplevel_96 + 1) * l_point_76;

break;

case OP_SELLSTOP:

if (a_price_20 > l_bid_68 - l_stoplevel_96 * l_point_76) a_price_20 = l_bid_68 - l_stoplevel_96 * l_point_76;

if (a_price_28 > 0.0 && a_price_28 < a_price_20 + (l_stoplevel_96 + 1) * l_point_76) a_price_28 = a_price_20 + (l_stoplevel_96 + 1) * l_point_76;

if (a_price_36 > a_price_20 - (l_stoplevel_96 + 1) * l_point_76) a_price_36 = a_price_20 - (l_stoplevel_96 + 1) * l_point_76;

}

Print("SetOrder(): Ñêîððåêòèðîâàíû öåíîâûå óðîâíè");

}

if (l_error_84 == 2/* COMMON_ERROR */ || l_error_84 == 64/* ACCOUNT_DISABLED */ || l_error_84 == 65/* INVALID_ACCOUNT */ || l_error_84 == 133/* TRADE_DISABLED */) {

gi_348 = TRUE;

return;

}

if (l_error_84 == 4/* SERVER_BUSY */ || l_error_84 == 131/* INVALID_TRADE_VOLUME */ || l_error_84 == 132/* MARKET_CLOSED */) {

Sleep(300000);

return;

}

if (l_error_84 == 8/* TOO_FREQUENT_REQUESTS */ || l_error_84 == 141/* TOO_MANY_REQUESTS */) Sleep(100000);

if (l_error_84 == 139/* ORDER_LOCKED */ || l_error_84 == 140/* LONG_POSITIONS_ONLY_ALLOWED */ || l_error_84 == 148/* ERR_TRADE_TOO_MANY_ORDERS */) break;

if (l_error_84 == 146/* TRADE_CONTEXT_BUSY */) while (IsTradeContextBusy()) Sleep(11000);

if (l_error_84 == 147/* ERR_TRADE_EXPIRATION_DENIED */) a_datetime_48 = 0;

else

if (l_error_84 != 135/* PRICE_CHANGED */ && l_error_84 != 138/* REQUOTE */) Sleep(7700.0);

}

}

}

 

void trailingonlyprofit() {

int l_cmd_4;

double l_price_8;

double ld_16;

bool li_24;

double l_ord_open_price_32;

int l_ticket_40;

bool l_bool_44;

if (prchoose == 0) prchoose = MarketInfo(Symbol(), MODE_STOPLEVEL);

for (int li_0 = 1; li_0 <= OrdersTotal(); li_0++) {

if (OrderSelect(li_0 - 1, SELECT_BY_POS) == TRUE) {

l_cmd_4 = OrderType();

if (OrderMagicNumber() == Magic) {

l_price_8 = OrderStopLoss();

while (true) {

if (TrailingStop == 0) TrailingStop = MarketInfo(Symbol(), MODE_STOPLEVEL);

ld_16 = TrailingStop;

li_24 = FALSE;

switch (l_cmd_4) {

case OP_BUY:

if (NormalizeDouble(l_price_8, Digits) < NormalizeDouble(Bid - ld_16 * Point, Digits) && MarketInfo(OrderSymbol(), MODE_BID) - OrderOpenPrice() >= prchoose * Point) {

l_price_8 = Bid - ld_16 * Point;

li_24 = TRUE;

}

break;

case OP_SELL:

if (NormalizeDouble(l_price_8, Digits) > NormalizeDouble(Ask + ld_16 * Point, Digits) || NormalizeDouble(l_price_8, Digits) == 0.0 && OrderOpenPrice() - MarketInfo(OrderSymbol(), MODE_ASK) >= prchoose * Point) {

l_price_8 = Ask + ld_16 * Point;

li_24 = TRUE;

}

}

if (li_24 == FALSE) break;

l_ord_open_price_32 = OrderOpenPrice();

l_ticket_40 = OrderTicket();

l_bool_44 = OrderModify(l_ticket_40, l_ord_open_price_32, l_price_8, 0, 0, Green);

if (l_bool_44 != TRUE) continue;

break;

}

}

}

}

}

 

double GetSizeLot() {

double ld_ret_0;

int li_40;

int l_hist_total_44;

double l_marginrequired_52;

double l_lotsize_32 = MarketInfo(Symbol(), MODE_LOTSIZE);

double ld_8 = NormalizeDouble(MarketInfo(Symbol(), MODE_LOTSTEP), 2);

if (LotsDigit == 2) li_40 = 2;

if (LotsDigit == 1) li_40 = 1;

if (Autolot == TRUE) ld_ret_0 = NormalizeDouble(AccountFreeMargin() * Risk / l_lotsize_32, LotsDigit);

else ld_ret_0 = Lots;

double ld_24 = NormalizeDouble(MarketInfo(Symbol(), MODE_MINLOT), 2);

if (LotsDigit == 2) ld_24 = 0.01;

if (ld_ret_0 < ld_24) ld_ret_0 = ld_24;

if (ld_ret_0 > MaxLots) ld_ret_0 = MaxLots;

if (MartinGeil == TRUE) {

l_hist_total_44 = OrdersHistoryTotal();

for (int l_pos_48 = 0; l_pos_48 < l_hist_total_44; l_pos_48++) {

if (OrderSelect(l_pos_48, SELECT_BY_POS, MODE_HISTORY) == TRUE) {

if (OrderProfit() < 0.0) {

ld_ret_0 *= Martinkof;

ld_ret_0 = NormalizeDouble(ld_ret_0, li_40);

}

if (OrderProfit() > 0.0) ld_ret_0 = Lots;

if (ld_ret_0 > MaxLots) ld_ret_0 = MaxLots;

l_marginrequired_52 = MarketInfo(Symbol(), MODE_MARGINREQUIRED);

if (AccountFreeMargin() < l_marginrequired_52 * ld_ret_0) ld_ret_0 = ld_24;

ld_ret_0 = NormalizeDouble(ld_ret_0, li_40);

}

}

}

Lots = ld_ret_0;

return (ld_ret_0);

}

 

void Stamp() {

ObjectCreate("Original", OBJ_LABEL, 0, 0, 0);

ObjectSetText("Original", " ---http://Expforex.at.ua---", 10, "Arial Bold", Red);

ObjectSet("Original", OBJPROP_CORNER, 2);

ObjectSet("Original", OBJPROP_XDISTANCE, 200);

ObjectSet("Original", OBJPROP_YDISTANCE, 10);

}

 

 

 

int Tradetime(int ai_0, int ai_4) {

bool li_ret_8 = FALSE;

if (ai_0 > ai_4)

if (Hour() < ai_0 && Hour() >= ai_4) li_ret_8 = TRUE;

if (ai_0 < ai_4)

if (Hour() < ai_0 || Hour() >= ai_4) li_ret_8 = TRUE;

if (ai_4 == 0 && ai_0 == 24) li_ret_8 = TRUE;

return (li_ret_8);

}

Link to comment
Share on other sites

Re: Baracuda (russian EA)

 

actually afterward i did it for the whole year and the results were terrible,it worked ok only for the past 2 months.before that it was a bloody mess:(i discarded it.

gee I'm getting tired of this...tested more than 100 EA's in the past years and so far nothing that I can call profitable and consistent:(

basically it is true that nothing commercial you can buy on the net will ever be profitable in the long run...that's why they are selling it.

 

i think there is just a few wise asses out there looking for free semi decent EA's on forums and repackage it and hype it nicely and sell it to the ignorant crowds...

the good stuff remain confined to their creators

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...