#property copyright "Copyright © 2009, Amplefile" #property link "http://DotNetRemoting.com" #import "MT4Net.dll" bool SysInitialize(string a0); int GetCommand(); void DeInit(); void RetInt(int a0); void RetString(string a0); void RetBool(bool a0); void RetDouble(double a0); void GetIntParam(int& a0[]); void GetStringParam(string a0); void GetBoolParam(bool& a0[]); void GetDoubleParam(double& a0[]); #import int gi_unused_76 = 0; int init() { Comment("EA begin"); int li_0 = SysInitialize(""); return (0); } int deinit() { DeInit(); return (0); } int start() { int li_4; bool li_0 = FALSE; while (!li_0) { li_4 = GetCommand(); switch (li_4) { case 1000: li_0 = TRUE; break; case 4: Exec_SendOrder(); break; case 7: Exec_ModifyOrder(); break; case 5: Exec_MarketInfo(); break; case 27: Exec_Symbol(); break; case 18: Exec_OrdersTotal(); break; case 28: Exec_OrderSelectByTicket(); break; case 12: Exec_OrderOpenPrice(); break; case 16: Exec_OrderClosePrice(); break; case 30: Exec_OrderType(); break; case 31: Exec_OrderTicket(); break; case 10: Exec_OrderClose(); break; case 29: Exec_CloseAllOrders(); break; case 9: Exec_OrdersProfit(); break; case 8: Exec_OrderStoploss(); break; case 8: Exec_OrderStoploss(); break; case 32: Exec_OrderSwap(); break; case 33: Exec_OrderSymbol(); break; case 34: Exec_OrderTakeProfit(); break; case 35: Exec_OrderPrint(); break; case 11: Exec_OrderOpenTime(); break; case 36: Exec_OrderMagicNumber(); break; case 13: Exec_OrderLots(); break; case 14: Exec_OrderExpiration(); break; case 15: Exec_OrderCommission(); break; case 37: Exec_OrderComment(); break; case 38: Exec_OrderCloseTime(); break; case 24: Exec_AccountBalance(); break; case 39: Exec_AccountCredit(); break; case 40: Exec_AccountCompany(); break; case 41: Exec_AccountCurrency(); break; case 42: Exec_AccountAquity(); break; case 19: Exec_AccountFreeMargChk(); break; case 43: Exec_AccountFreeMargin(); break; case 44: Exec_AccountFreeMarginMode(); break; case 45: Exec_AccountLeverage(); break; case 46: Exec_AccountMargin(); break; case 47: Exec_AccountName(); break; case 23: Exec_AccountNumber(); break; case 22: Exec_AccountProfit(); break; case 48: Exec_AccountServer(); break; case 21: Exec_AccountStopOutLevel(); break; case 20: Exec_AccountStopOutMode(); break; case 49: Exec_TimeCurrent(); break; case 50: Exec_ObjectCreate(); break; case 51: Exec_ObjectDelete(); break; case 52: Exec_ObjectMove(); break; case 53: Exec_ObjectDeleteAll(); break; case 54: Exec_ObjectDeleteAll_All(); break; case 55: Exec_HorLine(); break; case 56: Exec_VertLine(); break; case 57: Exec_Rectangle(); break; case 58: Exec_ARROW(); break; case 59: Exec_SetColorProp(); break; case 60: Exec_SetDateProp(); break; case 61: Exec_SetBoolProp(); break; case 62: Exec_SetIntegerProp(); break; case 63: Exec_SetDoubleProp(); break; case 64: Exec_GetAlltickets(); break; case 65: Exec_GetLastError(); break; case 66: Exec_CloseOrderFinal(); break; case 67: Exec_Print(); } } return (0); } void Exec_ObjectDelete() { string l_name_0 = "SDLFJSLKDFJOIWERIOKDSFNSKLWEUROIWIORUWOIRU"; GetStringParam(l_name_0); if (!ObjectDelete(l_name_0)) RetInt(GetLastError()); } void Exec_ObjectMove() { int lia_8[1]; int lia_12[1]; double lda_24[1]; string l_name_0 = "DSDLSKFJLSKJDKFLJSLDKFJLKSJFLKDJLFKSJLDFJLSKDKFLSFJLLSDFJLSK"; string ls_16 = "LSDLFJSLDFJLSJDFLSJFREWPOEIRPWIEROPWIEPRIPPWP"; GetStringParam(l_name_0); GetIntParam(lia_12); GetStringParam(ls_16); GetDoubleParam(lda_24); int l_str2time_28 = StrToTime(ls_16); bool l_bool_32 = ObjectMove(l_name_0, lia_12[0], l_str2time_28, lda_24[0]); int l_error_36 = 0; if (l_bool_32) l_error_36 = GetLastError(); RetInt(l_error_36); } void Exec_MarketInfo() { int lia_8[1]; string l_symbol_0 = "SIERIOROWLDKFMSLKMFLSDKMFLSDKMFSLKDFMSLD"; GetStringParam(l_symbol_0); GetIntParam(lia_8); double l_market_info_12 = MarketInfo(l_symbol_0, lia_8[0]); RetDouble(l_market_info_12); } void Exec_Print() { string ls_0 = "097809JJGJGHJJ987897979797979797900080890000SIERIOROWLDKFMSLKMFLSDKMFLSDKMFSLKDFMSLD"; GetStringParam(ls_0); Print(ls_0); RetInt(0); } void Exec_SendOrder() { int lia_8[1]; double lda_12[1]; double lda_16[1]; int lia_20[1]; double lda_24[1]; double lda_28[1]; int lia_40[1]; int lia_52[1]; int l_str2time_56; string l_symbol_0 = "SDKLJFKLSJFLKSJDLKFJFLSKDJ"; string l_comment_32 = "FJLJLBRPOITEPORTE0480398049830ASKDJALKSJDLAKSJDALKJDLAKSJDKLAJDALSJDLASKJDLAKS4"; string ls_44 = "LDFJSLJFSDLIEWRWOEEMCVXNVNXCMVNXDKLFS"; GetStringParam(l_symbol_0); GetIntParam(lia_8); GetDoubleParam(lda_12); GetDoubleParam(lda_16); GetIntParam(lia_20); GetDoubleParam(lda_24); GetDoubleParam(lda_28); GetStringParam(l_comment_32); GetIntParam(lia_40); GetStringParam(ls_44); GetIntParam(lia_52); if (ls_44 != "0") l_str2time_56 = 0; else l_str2time_56 = StrToTime(ls_44); if (lda_16[0] == -1.0) { if (lia_8[0] == 0) lda_16[0] = Ask; if (lia_8[0] == 1) lda_16[0] = Bid; } int l_ticket_60 = OrderSend(l_symbol_0, lia_8[0], lda_12[0], lda_16[0], lia_20[0], lda_24[0], lda_28[0], l_comment_32, lia_40[0], l_str2time_56, lia_52[0]); RetInt(l_ticket_60); } void Exec_ModifyOrder() { int lia_0[1]; double lda_4[1]; double lda_8[1]; double lda_12[1]; int l_error_28; int l_str2time_36; double l_ord_open_price_56; string ls_16 = "LDFJSLJFSDLIEWRWOEEMCVXNVNXCHKHKHKHKHKHKKHKHKMVNXDKLFS"; GetIntParam(lia_0); GetDoubleParam(lda_4); GetDoubleParam(lda_8); GetDoubleParam(lda_12); GetStringParam(ls_16); bool l_bool_24 = OrderSelect(lia_0[0], SELECT_BY_TICKET); if (!l_bool_24) { l_error_28 = GetLastError(); RetInt(l_error_28); } int l_cmd_32 = OrderType(); if (ls_16 != "0") l_str2time_36 = 0; else l_str2time_36 = StrToTime(ls_16); double ld_unused_40 = lda_8[0]; double ld_unused_48 = lda_12[0]; if (lda_4[0] == -1.0) l_ord_open_price_56 = OrderOpenPrice(); else l_ord_open_price_56 = lda_4[0]; l_bool_24 = OrderModify(lia_0[0], l_ord_open_price_56, lda_8[0], lda_12[0], l_str2time_36); int l_error_64 = 0; if (!l_bool_24) l_error_64 = GetLastError(); RetInt(l_error_64); } void Exec_OrderClose() { int lia_0[1]; double lda_4[1]; double lda_8[1]; int lia_12[1]; int lia_16[1]; GetIntParam(lia_0); GetDoubleParam(lda_4); GetDoubleParam(lda_8); GetIntParam(lia_12); GetIntParam(lia_16); int l_ord_close_20 = OrderClose(lia_0[0], lda_4[0], lda_8[0], lia_12[0], lia_16[0]); RetBool(l_ord_close_20); } void Exec_CloseOrderFinal() { int lia_0[1]; GetIntParam(lia_0); bool li_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); if (!li_4) RetBool(0); li_4 = OrderClose(lia_0[0], OrderLots(), OrderOpenPrice(), 3, Red); RetBool(li_4); } void Exec_CloseAllOrders() { double l_market_info_8; int li_16; int lia_24[]; int l_ord_total_0 = OrdersTotal(); int li_unused_4 = 0; int l_ord_total_20 = OrdersTotal(); if (l_ord_total_20 == 0) { RetInt(-1); return; } int li_28 = ArrayResize(lia_24, l_ord_total_20); for (int l_pos_32 = 0; l_pos_32 < l_ord_total_20; l_pos_32++) { OrderSelect(l_pos_32, SELECT_BY_POS); lia_24[l_pos_32] = OrderTicket(); } if (li_28 <= 0) { RetInt(-1); return; } for (int l_index_40 = 0; l_index_40 < li_28; l_index_40++) { OrderSelect(lia_24[l_index_40], SELECT_BY_TICKET); if (OrderType() == OP_BUY) li_16 = 9; else li_16 = 10; l_market_info_8 = MarketInfo(OrderSymbol(), li_16); Print("Closing Order # ", lia_24[l_index_40], " symbol: ", OrderSymbol(), " price: ", l_market_info_8); if (OrderClose(lia_24[l_index_40], OrderLots(), l_market_info_8, 3)) Print("Order # ", lia_24[l_index_40], " closed"); else { Print("Failed to close Order # ", lia_24[l_index_40], " Error: ", GetLastError()); RetInt(-2); return; } } RetInt(li_28); } void Exec_ObjectDeleteAll() { int lia_0[1]; int lia_4[1]; GetIntParam(lia_0); GetIntParam(lia_4); bool li_8 = ObjectsDeleteAll(lia_0[0], lia_4[0]); int l_error_12 = 0; if (li_8) l_error_12 = GetLastError(); RetInt(l_error_12); } void Exec_ObjectDeleteAll_All() { ObjectsDeleteAll(); RetInt(0); } void Exec_Symbol() { string ls_0 = Symbol(); RetString(ls_0); } void Exec_AccountName() { string ls_0 = AccountName(); RetString(ls_0); } void Exec_AccountBalance() { double ld_0 = AccountBalance(); RetDouble(ld_0); } void Exec_AccountMargin() { double ld_0 = AccountMargin(); RetDouble(ld_0); } void Exec_AccountProfit() { double ld_0 = AccountProfit(); RetDouble(ld_0); } void Exec_AccountCredit() { double ld_0 = AccountCredit(); RetDouble(ld_0); } void Exec_AccountLeverage() { int l_leverage_0 = AccountLeverage(); RetInt(l_leverage_0); } void Exec_AccountAquity() { double ld_0 = AccountEquity(); RetDouble(ld_0); } void Exec_AccountFreeMargin() { double l_free_magrin_0 = AccountFreeMargin(); RetDouble(l_free_magrin_0); } void Exec_AccountNumber() { RetInt(AccountNumber()); } void Exec_AccountStopOutLevel() { RetInt(AccountStopoutLevel()); } void Exec_AccountStopOutMode() { RetInt(AccountStopoutMode()); } void Exec_AccountFreeMarginMode() { int li_0 = AccountFreeMarginMode(); RetInt(li_0); } void Exec_AccountFreeMargChk() { int lia_8[1]; double lda_12[1]; string ls_0 = "KJKNKNKNIUHIUHILHLKBNBHJHGJHKKJK"; GetStringParam(ls_0); GetIntParam(lia_8); GetDoubleParam(lda_12); double ld_16 = AccountFreeMarginCheck(ls_0, lia_8[0], lda_12[0]); RetDouble(ld_16); } void Exec_ObjectCreate() { int lia_8[1]; int lia_12[1]; double lda_24[1]; double lda_36[1]; double lda_48[1]; string l_name_0 = "KJKNKNKNIUHIUHILHLKBNBHJHGJHKKJK"; string ls_16 = "DJEIORJWOERJWOIERJOWIEJRWIOEJJ"; string ls_28 = "4204JLKJLSDJFLKDJKLDKLSKDLLLL"; string ls_40 = "DSLKJDSKFJLSDJFLSJDFLSKDJLSKL"; GetStringParam(l_name_0); GetIntParam(lia_8); GetIntParam(lia_12); GetStringParam(ls_16); GetDoubleParam(lda_24); GetStringParam(ls_28); GetDoubleParam(lda_36); GetStringParam(ls_40); GetDoubleParam(lda_48); int l_str2time_52 = StrToTime(ls_16); int l_str2time_56 = StrToTime(ls_28); int l_str2time_60 = StrToTime(ls_40); bool l_bool_64 = ObjectCreate(l_name_0, lia_8[0], lia_12[0], l_str2time_52, lda_24[0], l_str2time_56, lda_36[0], l_str2time_60, lda_48[0]); int l_error_68 = 0; if (!l_bool_64) l_error_68 = GetLastError(); RetInt(l_error_68); } void Exec_HorLine() { double lda_8[1]; int lia_12[1]; string l_name_0 = "6678JBHMHLUIUH89KJKNKNKNIUHIUHILHLKBNBHJHGJHKKJK"; GetStringParam(l_name_0); GetDoubleParam(lda_8); GetIntParam(lia_12); int l_datetime_16 = TimeCurrent(); int l_bool_20 = ObjectCreate(l_name_0, OBJ_HLINE, 0, l_datetime_16, lda_8[0]); int l_bool_24 = ObjectSet(l_name_0, OBJPROP_COLOR, lia_12[0]); RetBool(l_bool_24); } void Exec_VertLine() { int lia_16[1]; string l_name_0 = "6678JBHMHLUIUH89KJKNKNKNIUHIUHILJHKKJK"; string ls_8 = "JKOEIWRUEIJLVMEURWOEIRUWO"; GetStringParam(l_name_0); GetStringParam(ls_8); GetIntParam(lia_16); int l_str2time_20 = StrToTime(ls_8); int l_bool_24 = ObjectCreate(l_name_0, OBJ_VLINE, 0, l_str2time_20, 0); int l_bool_28 = ObjectSet(l_name_0, OBJPROP_COLOR, lia_16[0]); RetBool(l_bool_28); } void Exec_Rectangle() { double lda_24[1]; double lda_28[1]; int lia_32[1]; string l_name_0 = "HKHSFKHDFKAHKLHDFKJGJKGKJGKJBLKJLKLKLLV"; string ls_8 = "6678JBHMHLUIUH89KJKNKNKNIUHIUH"; string ls_16 = "GUYUI7874HGHMJGJKKLKMLMLKLMLM"; GetStringParam(l_name_0); GetIntParam(lia_32); GetStringParam(ls_8); GetDoubleParam(lda_24); GetStringParam(ls_16); GetDoubleParam(lda_28); int l_str2time_36 = StrToTime(ls_8); int l_str2time_40 = StrToTime(ls_16); int l_bool_44 = ObjectCreate(l_name_0, OBJ_RECTANGLE, 0, l_str2time_36, lda_24[0], l_str2time_40, lda_28[0]); int l_bool_48 = ObjectSet(l_name_0, OBJPROP_COLOR, lia_32[0]); RetBool(l_bool_48); } void Exec_SetColorProp() { int lia_8[1]; int lia_12[1]; string l_name_0 = "HKHSFKHDFKAHKLHDFKJGJKGKJGKJBLKJLKKSD"; GetStringParam(l_name_0); GetIntParam(lia_8); GetIntParam(lia_12); int l_bool_16 = ObjectSet(l_name_0, lia_8[0], lia_12[0]); RetBool(l_bool_16); } void Exec_SetDateProp() { int lia_16[1]; int lia_20[1]; string l_name_0 = "HKHSFKHDFKAHKLHDFKJGJKGKJGKJBLVCBMOLILHALKSD"; string ls_8 = "6678NIUHIUHILHLKBNBHJHGJHKKJK"; GetStringParam(l_name_0); GetIntParam(lia_16); GetStringParam(ls_8); color l_str2time_24 = StrToTime(ls_8); int l_bool_28 = ObjectSet(l_name_0, lia_16[0], l_str2time_24); RetBool(l_bool_28); } void Exec_SetBoolProp() { int lia_8[1]; bool lba_12[1]; string l_name_0 = "689KJKNKNKNIUHIUHILHLKBNBHJHGJHKKJK"; GetStringParam(l_name_0); GetIntParam(lia_8); GetBoolParam(lba_12); int l_bool_16 = ObjectSet(l_name_0, lia_8[0], lba_12[0]); RetBool(l_bool_16); } void Exec_SetIntegerProp() { int lia_8[1]; int lia_12[1]; string l_name_0 = "IUH89KJKNKNKNIUHIUHILHLKBNBHJHGJHKKJK"; GetStringParam(l_name_0); GetIntParam(lia_8); GetIntParam(lia_12); int l_bool_16 = ObjectSet(l_name_0, lia_8[0], lia_12[0]); RetBool(l_bool_16); } void Exec_SetDoubleProp() { int lia_8[1]; double lda_12[1]; string l_name_0 = "6678JBHMHLUIUH89KJKNKNKNBNBHJHGJHKKJK"; GetStringParam(l_name_0); GetIntParam(lia_8); GetDoubleParam(lda_12); int l_bool_16 = ObjectSet(l_name_0, lia_8[0], lda_12[0]); RetBool(l_bool_16); } void Exec_ARROW() { double lda_16[1]; int lia_20[1]; string l_name_0 = "6678JBHMHLUIUH89KJKNKNKNIUHIUHILHLKBNBHJHGJHKKJK"; string ls_8 = "203894LEJMLMFDSFDSFHKJSDKFHKDJFH"; GetStringParam(l_name_0); GetStringParam(ls_8); GetDoubleParam(lda_16); GetIntParam(lia_20); int l_str2time_24 = StrToTime(ls_8); int l_bool_28 = ObjectCreate(l_name_0, OBJ_ARROW, 0, l_str2time_24, lda_16[0]); int l_bool_32 = ObjectSet(l_name_0, OBJPROP_COLOR, lia_20[0]); RetBool(l_bool_32); } void Exec_AccountCompany() { string ls_0 = AccountCompany(); RetString(ls_0); } void Exec_AccountServer() { string ls_0 = AccountServer(); RetString(ls_0); } void Exec_AccountCurrency() { string ls_0 = AccountCurrency(); RetString(ls_0); } void Exec_OrdersTotal() { RetInt(OrdersTotal()); } void Exec_OrderSelectByTicket() { int lia_0[1]; GetIntParam(lia_0); int l_bool_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); RetBool(l_bool_4); } void Exec_OrdersProfit() { int lia_0[1]; GetIntParam(lia_0); int l_bool_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); RetDouble(OrderProfit()); } void Exec_OrderCommission() { int lia_0[1]; GetIntParam(lia_0); int l_bool_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); RetDouble(OrderCommission()); } void Exec_OrderTakeProfit() { int lia_0[1]; GetIntParam(lia_0); int l_bool_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); RetDouble(OrderTakeProfit()); } void Exec_OrderOpenTime() { int lia_0[1]; GetIntParam(lia_0); int l_bool_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); int l_datetime_8 = OrderOpenTime(); string l_time2str_12 = TimeToStr(l_datetime_8, TIME_DATE|TIME_MINUTES); RetString(l_time2str_12); } void Exec_OrderCloseTime() { int lia_0[1]; GetIntParam(lia_0); int l_bool_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); int l_datetime_8 = OrderCloseTime(); string l_time2str_12 = TimeToStr(l_datetime_8, TIME_DATE|TIME_MINUTES); RetString(l_time2str_12); } void Exec_TimeCurrent() { int l_datetime_0 = TimeCurrent(); string l_time2str_4 = TimeToStr(l_datetime_0, TIME_DATE|TIME_MINUTES); RetString(l_time2str_4); } void Exec_OrderComment() { int lia_0[1]; GetIntParam(lia_0); int l_bool_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); string ls_8 = OrderComment(); RetString(ls_8); } void Exec_OrderExpiration() { int lia_0[1]; GetIntParam(lia_0); int l_bool_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); int l_datetime_8 = OrderExpiration(); string l_time2str_12 = TimeToStr(l_datetime_8, TIME_DATE|TIME_MINUTES); RetString(l_time2str_12); } void Exec_OrderMagicNumber() { int lia_0[1]; GetIntParam(lia_0); int l_bool_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); int l_magic_8 = OrderMagicNumber(); RetInt(l_magic_8); } void Exec_OrderPrint() { int lia_0[1]; GetIntParam(lia_0); int l_bool_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); OrderPrint(); RetBool(1); } void Exec_OrderSwap() { int lia_0[1]; GetIntParam(lia_0); int l_bool_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); RetDouble(OrderSwap()); } void Exec_OrderLots() { int lia_0[1]; GetIntParam(lia_0); int l_bool_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); RetDouble(OrderLots()); } void Exec_OrderSymbol() { int lia_0[1]; GetIntParam(lia_0); int l_bool_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); string l_symbol_8 = OrderSymbol(); RetString(l_symbol_8); } void Exec_OrderStoploss() { int lia_0[1]; GetIntParam(lia_0); int l_bool_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); RetDouble(OrderStopLoss()); } void Exec_OrderOpenPrice() { int lia_0[1]; GetIntParam(lia_0); bool l_bool_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); if (!l_bool_4) RetDouble(-1); double l_ord_open_price_8 = OrderOpenPrice(); RetDouble(l_ord_open_price_8); } void Exec_OrderClosePrice() { int lia_0[1]; GetIntParam(lia_0); bool l_bool_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); if (!l_bool_4) RetDouble(-1); double ld_8 = OrderClosePrice(); RetDouble(ld_8); } void Exec_OrderType() { int lia_0[1]; GetIntParam(lia_0); bool l_bool_4 = OrderSelect(lia_0[0], SELECT_BY_TICKET); if (!l_bool_4) RetDouble(-1); int l_cmd_8 = OrderType(); RetInt(l_cmd_8); } void Exec_GetAlltickets() { string l_ticket_0; string l_str_concat_8; int l_ticket_24; int l_ord_total_16 = OrdersTotal(); if (l_ord_total_16 == 0) { RetString("#"); return; } for (int l_pos_20 = 0; l_pos_20 < l_ord_total_16; l_pos_20++) { if (OrderSelect(l_pos_20, SELECT_BY_POS) != FALSE) { l_ticket_24 = OrderTicket(); l_ticket_0 = l_ticket_24; l_str_concat_8 = StringConcatenate(l_ticket_0, ",", l_str_concat_8); } } RetString(l_str_concat_8); } void Exec_GetLastError() { RetInt(GetLastError()); } void Exec_OrderTicket() { RetInt(OrderTicket()); }