//+------------------------------------------------------------------+ //| trade_lib_tester.mqh | //| komposter | //| mailto:komposterius@mail.ru | //+------------------------------------------------------------------+ #include #include static string comment = ""; extern int Slippage = 10; extern color OrderBuyColor = Lime; extern color OrderSellColor = Red; ///////////////////////////////////////////////////////////////////////////////// /**/ void _start_trade_lib ( string _Symbol, int TimeFrame ) ///////////////////////////////////////////////////////////////////////////////// // создаёт коммент к ордеру типа "ExpertName ( Symbol, TimeFrame )", если он (коммент) не задаётся вручную // если эксперт работает по одному инструменту/ТФ нужно вызвать ф-цию из init(), // если по нескольким, то из start() ///////////////////////////////////////////////////////////////////////////////// { comment = ExpertName + "(" + _Symbol + ", " + TimeFrame_str ( TimeFrame ) + ")"; } ///////////////////////////////////////////////////////////////////////////////// /**/ bool _IsExpertOrder ( int _MagicNumber ) ///////////////////////////////////////////////////////////////////////////////// // Проверка наличия позиций/ордеров, открытых экспертом + вывод информации. // Если таковые есть, возвращает true, если нет - возвращает false ///////////////////////////////////////////////////////////////////////////////// { for ( int z = 0; z < OrdersTotal(); z ++ ) { if ( OrderSelect( z, SELECT_BY_POS ) == false ) { break; } if ( OrderMagicNumber() == _MagicNumber ) { return(true); } } return(false); } ///////////////////////////////////////////////////////////////////////////////// /**/ int _OrderSend ( string _Symbol, int _OrderType, double _Volume, double _OpenPrice, int _Slippage = 5, double _StopLoss = 0, double _TakeProfit = 0, string _Comment = "", int _MagicNumber = 0, datetime _Expiration = 0, color _Color = CLR_NONE ) ///////////////////////////////////////////////////////////////////////////////// // Стандартная ф-ция OrderSend + проверка значений + вывод информации. // При успешном выполнении возвращает OrderTicket, при ошибке установки возвращает "-1", при ошибке проверки возвращает "-2" ///////////////////////////////////////////////////////////////////////////////// { //Print( "_OrderSend( ", _Symbol, ", ", _OrderType, ", ", _Volume, ", ", _OpenPrice, ", ", _Slippage, ", ", _StopLoss, ", ", _TakeProfit, ", ", _Comment, ", ", _MagicNumber, ", ", _Expiration, ", ", _Color, " ) - loaded..." ); int digits = Digits; // - Первоначальные проверки и нормализация if ( _OrderType == OP_BUY ) { _OpenPrice = Ask; } if ( _OrderType == OP_SELL ) { _OpenPrice = Bid; } _Volume = NormalizeDouble( _Volume, 1 ); _OpenPrice = NormalizeDouble( _OpenPrice, digits ); _StopLoss = NormalizeDouble( _StopLoss, digits ); _TakeProfit = NormalizeDouble( _TakeProfit, digits ); // - Проверки if ( _OrderCheck( _Symbol, _OrderType, _Volume, _OpenPrice, _StopLoss, _TakeProfit, _Expiration ) != 1 ) { return(-2); } if ( _Color <= 0 ) { _Color = OrderSellColor; if ( _OrderType == OP_BUY || _OrderType == OP_BUYLIMIT || _OrderType == OP_BUYSTOP ) { _Color = OrderBuyColor; } } if ( _Comment == "" ) _Comment = comment; // - 2-хкратная попытка открыть позицию/установить ордер for ( int x = 0; x < 2; x ++ ) { int ordersend = OrderSend ( _Symbol, _OrderType, _Volume, _OpenPrice, _Slippage, _StopLoss, _TakeProfit, _Comment, _MagicNumber, _Expiration, _Color ); if ( ordersend > 0 ) { // - если всё хорошо, выводим информацию и выходим return(ordersend); } // - если нет, выводим информацию, отдаём на отработку код ошибки и ждём 10 сек перед следующей попыткой int error_code = GetLastError(); Print ( "Ошибка при установке ордера!!!" ); Processing_Error ( error_code ); Sleep(10000); } // - если не удалось установить ордер/открыть позицию с 2-х попыток - выходим return(-1); } ///////////////////////////////////////////////////////////////////////////////// /**/ int _OrderModify ( int _OrderTicket, double New_OpenPrice, double New_StopLoss, double New_TakeProfit, datetime New_Expiration, color _Color = CLR_NONE ) ///////////////////////////////////////////////////////////////////////////////// // Стандартная ф-ция OrderModify + проверки + вывод информации. // При успешном выполнении возвращает "1", при ошибке возвращает "-1", при ошибке выбора ордера возвращает "-2", при ошибке проверки возвращает "-3" ///////////////////////////////////////////////////////////////////////////////// { if ( OrderSelect( _OrderTicket, SELECT_BY_TICKET ) == false ) { return(-2); } string _Symbol = OrderSymbol(); int _OrderType = OrderType(); int digits = Digits; if ( New_OpenPrice <= 0 ) { New_OpenPrice = OrderOpenPrice(); } if ( New_StopLoss <= 0 ) { New_StopLoss = OrderStopLoss(); } if ( New_TakeProfit <= 0 ) { New_TakeProfit = OrderTakeProfit(); } if ( New_Expiration <= 0 ) { New_Expiration = OrderExpiration(); } if ( _OrderType == OP_BUY || _OrderType == OP_SELL ) { New_OpenPrice = OrderOpenPrice(); New_Expiration = 0; } double _Volume = NormalizeDouble( OrderLots(), 1 ); New_OpenPrice = NormalizeDouble( New_OpenPrice, digits ); New_StopLoss = NormalizeDouble( New_StopLoss, digits ); New_TakeProfit = NormalizeDouble( New_TakeProfit, digits ); if ( _OrderCheck( _Symbol, _OrderType, _Volume, New_OpenPrice, New_StopLoss, New_TakeProfit, New_Expiration ) != 1 ) { return(-3); } if ( _Color <= 0 ) { _Color = OrderSellColor; if ( _OrderType == OP_BUY || _OrderType == OP_BUYLIMIT || _OrderType == OP_BUYSTOP ) { _Color = OrderBuyColor; } } for ( int x = 0; x < 2; x ++ ) { if ( OrderSelect( _OrderTicket, SELECT_BY_TICKET ) == false ) { return(-2); } int ordermodify = OrderModify( _OrderTicket, New_OpenPrice, New_StopLoss, New_TakeProfit, New_Expiration, _Color ); if ( ordermodify > 0 ) { return(1); } int error_code = GetLastError(); Print ( "Ошибка при модификации ордера!!!" ); Processing_Error ( error_code ); Sleep(10000); } return(-1); } ///////////////////////////////////////////////////////////////////////////////// /**/ int _OrderClose ( int _OrderTicket, double _Volume, int _Slippage = 5, color _Color = CLR_NONE ) ///////////////////////////////////////////////////////////////////////////////// // Стандартная ф-ция OrderClose + вывод информации. // При успешном выполнении возвращает "1", при ошибке возвращает "-1", при ошибке № ордера возвращает "-2" ///////////////////////////////////////////////////////////////////////////////// { if ( OrderSelect( _OrderTicket, SELECT_BY_TICKET ) == false ) { return(-2); } int _OrderType = OrderType(); string ordersymbol = OrderSymbol(); if ( _Volume < 0.1 || _Volume > OrderLots() ) { _Volume = OrderLots(); } _Volume = NormalizeDouble( _Volume, 1 ); int digits = Digits; if ( _OrderType > OP_SELL ) { return(-1); } if ( _Slippage < 0 ) { _Slippage = 0; } double _ClosePrice = NormalizeDouble( Ask, digits ); if ( _OrderType == OP_BUY ) { _ClosePrice = NormalizeDouble( Bid, digits ); } if ( _Color <= 0 ) { _Color = OrderSellColor; if ( _OrderType == OP_BUY || _OrderType == OP_BUYLIMIT || _OrderType == OP_BUYSTOP ) { _Color = OrderBuyColor; } } for ( int x = 0; x < 2; x ++ ) { if ( OrderSelect( _OrderTicket, SELECT_BY_TICKET ) == false ) { return(-2); } int orderclose = OrderClose( _OrderTicket, _Volume, _ClosePrice, _Slippage, _Color ); if ( orderclose > 0 ) { return(1); } int error_code = GetLastError(); Print ( "Ошибка при закрытии позиции!!!" ); Processing_Error ( error_code ); Sleep(10000); } return(-1); } ///////////////////////////////////////////////////////////////////////////////// /**/ int _OrderDelete ( int _OrderTicket ) ///////////////////////////////////////////////////////////////////////////////// // Стандартная ф-ция OrderDelete + вывод информации. // При успешном выполнении возвращает "1", при ошибке удаления возвращает "-1", при ошибке № ордера, возвращает "-2" ///////////////////////////////////////////////////////////////////////////////// { if ( OrderSelect( _OrderTicket, SELECT_BY_TICKET ) == false ) { return(-2); } int _OrderType = OrderType(); if ( _OrderType <= OP_SELL ) { return(-1); } for ( int x = 0; x < 2; x ++ ) { if ( OrderSelect( _OrderTicket, SELECT_BY_TICKET ) == false ) { return(-2); } int orderdelete = OrderDelete( _OrderTicket ); if ( orderdelete > 0 ) { return(1); } int error_code = GetLastError(); Print ( "Ошибка при удалении ордера!!!" ); Processing_Error ( error_code ); Sleep(10000); } return(-1); } ///////////////////////////////////////////////////////////////////////////////// /**/ int _TrailingStop ( int _OrderTicket, int TrailingStop, color _Color = CLR_NONE ) ///////////////////////////////////////////////////////////////////////////////// // TrailingStop + вывод информации // При успешном смещёнии возвращает "1", при отстутствии необходимости двигать - "0", при ошибке "-1", при ошибке № ордера, возвращает "-2" ///////////////////////////////////////////////////////////////////////////////// { if ( TrailingStop <= 0 ) { return(0); } if ( OrderSelect( _OrderTicket, SELECT_BY_TICKET ) == false ) { return(-2); } string _Symbol = OrderSymbol(); int _OrderType = OrderType(); double point = Point; int digits = Digits; double bid = NormalizeDouble( Bid, digits ); double ask = NormalizeDouble( Ask, digits ); double spread = ( Ask - Bid ) * point; double orderopenprice = NormalizeDouble ( OrderOpenPrice(), digits ); double orderstoploss = NormalizeDouble ( OrderStopLoss(), digits ); double ordertakeprofit = NormalizeDouble ( OrderTakeProfit(), digits ); datetime orderexpiration = OrderExpiration(); double NewStopLoss; string _OrderType_str = _OrderType_str ( _OrderType ); if ( _Color <= 0 ) { _Color = OrderSellColor; if ( _OrderType == OP_BUY || _OrderType == OP_BUYLIMIT || _OrderType == OP_BUYSTOP ) { _Color = OrderBuyColor; } } if ( _OrderType == OP_BUY ) { NewStopLoss = NormalizeDouble( bid - TrailingStop * point, digits ); if ( ( bid - orderopenprice ) > 0 ) { if ( orderstoploss <= 0 || NewStopLoss - orderstoploss > spread )//TrailingStop < ( bid - orderstoploss ) / point ) { for ( int x = 0; x < 1; x ++ ) { if ( OrderSelect( _OrderTicket, SELECT_BY_TICKET ) == false ) { return(-2); } int ordermodify = OrderModify( _OrderTicket, orderopenprice, NewStopLoss, ordertakeprofit, orderexpiration, _Color ); if ( ordermodify > 0 ) { return(1); } int error_code = GetLastError(); Print ( "Ошибка Trailing Stop!!!" ); Processing_Error ( error_code ); Sleep(10000); } return(-1); } } } if ( _OrderType == OP_SELL ) { NewStopLoss = NormalizeDouble( ask + TrailingStop * point, digits ); if ( ( orderopenprice - ask ) > 0 ) { if ( orderstoploss <= 0 || orderstoploss - NewStopLoss > spread )//TrailingStop > ( ask + orderstoploss ) / point ) { for ( x = 0; x < 1; x ++ ) { if ( OrderSelect( _OrderTicket, SELECT_BY_TICKET ) == false ) { return(-2); } ordermodify = OrderModify( _OrderTicket, orderopenprice, NewStopLoss, ordertakeprofit, orderexpiration, _Color ); if ( ordermodify > 0 ) { return(1); } error_code = GetLastError(); Print ( "Ошибка Trailing Stop!!!" ); Processing_Error ( error_code ); Sleep(10000); } return(-1); } } } return(0); } ///////////////////////////////////////////////////////////////////////////////// /**/ int _BreakEven ( int _OrderTicket, int BreakEven_After, color _Color = CLR_NONE ) ///////////////////////////////////////////////////////////////////////////////// // Автостоп в безубыток + вывод информации // При успешном смещёнии возвращает "1", при отстутствии необходимости - "0", при ошибке "-1", при ошибке № ордера, возвращает "-2" ///////////////////////////////////////////////////////////////////////////////// { if ( BreakEven_After <= 0 ) { return(0); } if ( OrderSelect( _OrderTicket, SELECT_BY_TICKET ) == false ) { return(-2); } string _Symbol = OrderSymbol(); int _OrderType = OrderType(); double point = Point; int digits = Digits; double bid = NormalizeDouble( Bid, digits ); double ask = NormalizeDouble( Ask, digits ); double orderopenprice = NormalizeDouble ( OrderOpenPrice(), digits ); double orderstoploss = NormalizeDouble ( OrderStopLoss(), digits ); double ordertakeprofit = NormalizeDouble ( OrderTakeProfit(), digits ); datetime orderexpiration = OrderExpiration(); double NewStopLoss; string _OrderType_str = _OrderType_str ( _OrderType ); if ( _Color <= 0 ) { _Color = OrderSellColor; if ( _OrderType == OP_BUY || _OrderType == OP_BUYLIMIT || _OrderType == OP_BUYSTOP ) { _Color = OrderBuyColor; } } if ( _OrderType == OP_BUY ) { NewStopLoss = bid - BreakEven_After * point; _Color = GlobalVariableGet( "OrderBuyColor" ); if ( ( bid - orderopenprice ) >= ( BreakEven_After * point ) ) { if ( orderstoploss <= 0 || orderstoploss < NewStopLoss ) { for ( int x = 0; x < 1; x ++ ) { if ( OrderSelect( _OrderTicket, SELECT_BY_TICKET ) == false ) { return(-2); } int ordermodify = OrderModify( _OrderTicket, orderopenprice, NewStopLoss, ordertakeprofit, orderexpiration, _Color ); if ( ordermodify > 0 ) { return(1); } int error_code = GetLastError(); Print ( "Ошибка BreakEven!!!" ); Processing_Error ( error_code ); Sleep(10000); } return(-1); } } } if ( _OrderType == OP_SELL ) { NewStopLoss = ask + BreakEven_After * point; if ( ( orderopenprice - ask ) >= ( BreakEven_After * point ) ) { if ( orderstoploss <= 0 || orderstoploss > NewStopLoss ) { for ( x = 0; x < 1; x ++ ) { if ( OrderSelect( _OrderTicket, SELECT_BY_TICKET ) == false ) { return(-2); } ordermodify = OrderModify( _OrderTicket, orderopenprice, NewStopLoss, ordertakeprofit, orderexpiration, _Color ); if ( ordermodify > 0 ) { return(1); } error_code = GetLastError(); Print ( "Ошибка BreakEven!!!" ); Processing_Error ( error_code ); Sleep(10000); } return(-1); } } } return(0); } ///////////////////////////////////////////////////////////////////////////////// /**/ int _OrderCheck ( string _Symbol, int _OrderType, double _Volume, double _OpenPrice, double _StopLoss, double _TakeProfit, datetime _Expiration ) ///////////////////////////////////////////////////////////////////////////////// // проверяет растояния OP,SL,TP, объём и время истечения для ф-ций _OrderSend и _OrderModify. // При успешной проверке возвращает "1", при ошибке возвращает "-1" ///////////////////////////////////////////////////////////////////////////////// { int return_tmp; int digits = Digits; double ask = NormalizeDouble( Ask, digits ); double bid = NormalizeDouble( Bid, digits ); double point = Point; int stoplevel = MarketInfo( _Symbol, MODE_STOPLEVEL ); string ask_str = DoubleToStr( ask, digits ); string bid_str = DoubleToStr( bid, digits ); string _OpenPrice_str = DoubleToStr( _OpenPrice, digits ); string _StopLoss_str = DoubleToStr( _StopLoss, digits ); string _TakeProfit_str = DoubleToStr( _TakeProfit, digits ); string _Expiration_str = TimeToStr( _Expiration ); // _OrderType должен быть от 0 до 5 if ( _OrderType < 0 || _OrderType > 5 ) { Print ( "Invalid OrderType ( " + _OrderType + " )!!!" ); return_tmp = -1; } if ( _OrderType == OP_BUY || _OrderType == OP_BUYLIMIT || _OrderType == OP_BUYSTOP ) { // - OP_BUY if ( _OrderType == OP_BUY ) { // - - время истечения - должно быть 0 if ( _Expiration != 0 ) { Print ( "Expiration Time = " + _Expiration_str + " - Для маркет-ордера нельзя установить время истечения!!!" ); return_tmp = -1; } } // - OP_BUYLIMIT ордер if ( _OrderType == OP_BUYLIMIT ) { if ( ask - _OpenPrice < stoplevel * point ) { // - - цена открытия - должна быть ниже Ask if ( ask - _OpenPrice < 0 ) { Print ( "Open Price = " + _OpenPrice_str + " - Неправильно (выше цены - " + ask_str + ")!!!" ); } // - - минимальный отступ - stoplevel else { Print ( "Open Price = " + _OpenPrice_str + " - слишком близко к рынку (" + ask_str + ")!!!" ); } return_tmp = -1; } // - - время истечения (если есть) - должно быть > текущего серверного времени if ( _Expiration > 0 && _Expiration <= CurTime() ) { Print ( "Expiration Time = " + _Expiration_str + " - Время истечения нельзя установить в прошлом!!!" ); return_tmp = -1; } } // - OP_BUYSTOP ордер if ( _OrderType == OP_BUYSTOP ) { // - - цена открытия - должна быть выше Ask if ( _OpenPrice - ask < stoplevel * point ) { if ( _OpenPrice - ask < 0 ) { Print ( "Open Price = " + _OpenPrice_str + " - Неправильно (ниже цены - " + ask_str + ")!!!" ); } // - - минимальный отступ - stoplevel else { Print ( "Open Price = " + _OpenPrice_str + " - слишком близко к рынку (" + ask_str + ")!!!" ); } return_tmp = -1; } // - - время истечения (если есть) - должно быть > текущего серверного времени if ( _Expiration > 0 && _Expiration <= CurTime() ) { Print ( "Expiration Time = " + _Expiration_str + " - Время истечения нельзя установить в прошлом!!!" ); return_tmp = -1; } } // Проверки всех "длинных" ордеров/позиций // - _StopLoss (если есть) должен быть ниже _OpenPrice if ( _StopLoss > 0 && ( _OpenPrice - _StopLoss ) / point < stoplevel ) { if ( ( _OpenPrice - _StopLoss ) / point < 0 ) { Print ( "Stop Loss = " + _StopLoss_str + " - Неправильно (выше цены - " + _OpenPrice_str + ")!!!" ); } // - - минимальный отступ - stoplevel else { Print ( "Stop Loss = " + _StopLoss_str + " - слишком близко (" + _OpenPrice_str + ")!!!" ); } return_tmp = -1; } // - _TakeProfit (если есть) должен быть выше _OpenPrice if ( _TakeProfit > 0 && ( _TakeProfit - _OpenPrice ) / point < stoplevel ) { if ( ( _TakeProfit - _OpenPrice ) / point < 0 ) { Print ( "Take Profit = " + _TakeProfit_str + " - Неправильно (ниже цены - " + _OpenPrice_str + ")!!!" ); } // - - минимальный отступ - stoplevel else { Print ( "Take Profit = " + _TakeProfit_str + " - слишком близко (" + _OpenPrice_str + ")!!!" ); } return_tmp = -1; } } if ( _OrderType == OP_SELL || _OrderType == OP_SELLLIMIT || _OrderType == OP_SELLSTOP ) { // - OP_SELL if ( _OrderType == OP_SELL ) { // - - время истечения - должно быть 0 if ( _Expiration > 0 ) { Print ( "Expiration Time = " + _Expiration_str + " - Для маркет-ордера нельзя установить время истечения!!!" ); return_tmp = -1; } } // - OP_SELLLIMIT if ( _OrderType == OP_SELLLIMIT ) { // - - цена открытия - должна быть выше Bid if ( _OpenPrice - bid < stoplevel*point ) { if ( _OpenPrice - bid < 0 ) { Print ( "Open Price = " + _OpenPrice_str + " - Неправильно (ниже цены - " + bid_str + ")!!!" ); } // - - минимальный отступ - stoplevel else { Print ( "Open Price = " + _OpenPrice_str + " - слишком близко к рынку (" + bid_str + ")!!!" ); } return_tmp = -1; } // - - время истечения (если есть) - должно быть > текущего серверного времени if ( _Expiration > 0 && _Expiration <= CurTime() ) { Print ( "Expiration Time = " + _Expiration_str + " - Время истечения нельзя установить в прошлом!!!" ); return_tmp = -1; } } // - OP_SELLSTOP if ( _OrderType == OP_SELLSTOP ) { // - - цена открытия - должна быть ниже Bid if ( bid - _OpenPrice < stoplevel * point ) { if ( bid - _OpenPrice < 0 ) { Print ( "Open Price = " + _OpenPrice_str + " - Неправильно (выше цены - " + bid_str + ")!!!" ); } // - - минимальный отступ - stoplevel else { Print ( "Open Price = " + _OpenPrice_str + " - слишком близко к рынку (" + bid_str + ")!!!" ); } return_tmp = -1; } // - - время истечения (если есть) - должно быть > текущего серверного времени if ( _Expiration > 0 && _Expiration <= CurTime() ) { Print ( "Expiration Time = " + _Expiration_str + " - Время истечения нельзя установить в прошлом!!!" ); return_tmp = -1; } } // Проверки всех "коротких" ордеров/позиций // - _StopLoss (если есть) должен быть выше _OpenPrice if ( _StopLoss > 0 && ( _StopLoss - _OpenPrice ) / point < stoplevel ) { if ( ( _StopLoss - _OpenPrice ) / point < 0 ) { Print ( "Stop Loss = " + _StopLoss_str + " - Неправильно (ниже цены - " + _OpenPrice_str + ")!!!" ); } // - - минимальный отступ - stoplevel else { Print ( "Stop Loss = " + _StopLoss_str + " - слишком близко (" + _OpenPrice_str + ")!!!" ); } return_tmp = -1; } // - _TakeProfit (если есть) должен быть ниже _OpenPrice if ( _TakeProfit > 0 && ( _OpenPrice - _TakeProfit ) / point < stoplevel ) { if ( ( _OpenPrice - _TakeProfit ) / point < 0 ) { Print ( "Take Profit = " + _TakeProfit_str + " - Неправильно (выше цены - " + _OpenPrice_str + ")!!!" ); } // - - минимальный отступ - stoplevel else { Print ( "Take Profit = " + _TakeProfit_str + " - слишком близко (" + _OpenPrice_str + ")!!!" ); } return_tmp = -1; } } // Обьём должен быть больше 0.1 if ( _Volume < 0.1 ) { Print ( "Lots < 0.1 !!!" ); return_tmp = -1; } // если есть хоть одна ошибка, возвращаем -1 if ( return_tmp < 0 ) { //Print( "_OrderCheck( ", _Symbol, ", ", _OrderType, ", ", _Volume, ", ", _OpenPrice, ", ", _StopLoss, ", ", _TakeProfit, ", ", _Expiration, " ) - some error was found. return(-1);" ); return(-1); } // если все проверки прошли успешно, возвращаем 1 //Print( "_OrderCheck( ", _Symbol, ", ", _OrderType, ", ", _Volume, ", ", _OpenPrice, ", ", _StopLoss, ", ", _TakeProfit, ", ", _Expiration, " ) - no errors found. return(1);" ); return(1); } ///////////////////////////////////////////////////////////////////////////////// /**/ string _OrderType_str ( int _OrderType ) ///////////////////////////////////////////////////////////////////////////////// // возвращает OrderType в виде текста ///////////////////////////////////////////////////////////////////////////////// { string _OrderType_str; switch ( _OrderType ) { case OP_BUY: _OrderType_str = "Buy"; break; case OP_SELL: _OrderType_str = "Sell"; break; case OP_BUYLIMIT: _OrderType_str = "BuyLimit"; break; case OP_BUYSTOP: _OrderType_str = "BuyStop"; break; case OP_SELLLIMIT: _OrderType_str = "SellLimit"; break; case OP_SELLSTOP: _OrderType_str = "SellStop"; break; } return(_OrderType_str); } ///////////////////////////////////////////////////////////////////////////////// /**/ string TimeFrame_str ( int TimeFrame ) ///////////////////////////////////////////////////////////////////////////////// { string TimeFrame_str; switch ( TimeFrame ) { case PERIOD_MN1: TimeFrame_str = "Monthly"; break; case PERIOD_W1: TimeFrame_str = "Weekly"; break; case PERIOD_D1: TimeFrame_str = "Daily"; break; case PERIOD_H4: TimeFrame_str = "H4"; break; case PERIOD_H1: TimeFrame_str = "H1"; break; case PERIOD_M15: TimeFrame_str = "M15"; break; case PERIOD_M5: TimeFrame_str = "M5"; break; case PERIOD_M1: TimeFrame_str = "M1"; break; } return(TimeFrame_str); } ///////////////////////////////////////////////////////////////////////////////// /**/ void Processing_Error ( int ErrorCode ) ///////////////////////////////////////////////////////////////////////////////// { string ErrorDescription = ErrorDescription( ErrorCode ); Print ( "GetLastError = ", ErrorCode ); Print ( ErrorDescription ); }