public static double Open(this MqlHandler handler, int i)
 {
     return Convertor.ToDouble(handler.CallMqlMethod("Open", new object[1]
       {
     (object) i
       }));
 }
 public static bool SendNotification(this MqlHandler handler, string notification)
 {
     return Convertor.ToBoolean(handler.CallMqlMethod("SendNotification", new object[1]
       {
     (object) notification
       }));
 }
 public static void Print(this MqlHandler handler, string message)
 {
     handler.CallMqlMethod("Print", new object[1]
       {
     (object) message
       });
 }
 public static void PlaySound(this MqlHandler handler, string filename)
 {
     handler.CallMqlMethod("PlaySound", new object[1]
       {
     (object) filename
       });
 }
Beispiel #5
0
        /// <summary>
        ///     Closes opened order. If the function succeeds, the return value is true. If the function fails, the return value is false. To get the detailed error information, call GetLastError().
        /// </summary>
        /// <param name="handler"></param>
        /// <param name="ticket">Unique number of the order ticket.</param>
        /// <param name="lots">Number of lots.</param>
        /// <param name="price">Preferred closing price.</param>
        /// <param name="slippage">Value of the maximum price slippage in points.</param>
        /// <param name="color">Color of the closing arrow on the chart. If the parameter is missing or has CLR_NONE value closing arrow will not be drawn on the chart.</param>
        /// <returns></returns>
        public static bool OrderClose(this MqlHandler handler, int ticket, double lots, double price, int slippage,
                                      int color = 0)
        {
            string retrunValue = handler.CallMqlMethod("OrderClose", ticket, lots, price, slippage, color);

            return Convertor.ToBoolean(retrunValue);
        }
Beispiel #6
0
        public static int OrderReliableLastErr(this MqlHandler handler)
        {
            string returnValue = handler.CallMqlMethod("OrderReliableLastErr", null);

            try
            {
                return Convertor.ToInt(returnValue);
            }
            catch (Exception)
            {
                return 0;
            }
        }
Beispiel #7
0
 /// <summary>
 ///     Prints a message to the experts log. Parameters can be of any type.
 /// </summary>
 /// <param name="handler"></param>
 /// <param name="message"> </param>
 public static void Print(this MqlHandler handler, string message)
 {
     string retrunValue = handler.CallMqlMethod("Print", message);
 }
Beispiel #8
0
        /// <summary>
        ///     Returns various data about securities listed in the Market Watch window.
        /// </summary>
        /// <param name="handler"></param>
        /// <param name="symbol"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        public static double MarketInfo(this MqlHandler handler, string symbol, MARKER_INFO_MODE mode)
        {
            string retrunValue = handler.CallMqlMethod("MarketInfo", symbol, (int) mode);

            return Convertor.ToDouble(retrunValue);
        }
        /// <summary>
        ///     Returns free margin that remains after the specified position has been opened at the current price on the current account. If the free margin is insufficient, an error 134 (ERR_NOT_ENOUGH_MONEY) will be generated.
        /// </summary>
        /// <param name="handler"></param>
        /// <param name="symbol"></param>
        /// <param name="cmd"></param>
        /// <param name="volume"></param>
        /// <returns></returns>
        public static double AccountFreeMarginCheck(this MqlHandler handler, string symbol, ORDER_TYPE cmd,
                                                    double volume)
        {
            string retrunValue = handler.CallMqlMethod("AccountFreeMarginCheck", symbol, (int) cmd, volume);

            return Convertor.ToDouble(retrunValue);
        }
Beispiel #10
0
        /// <summary>
        ///     Returns currency name of the current account.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static string AccountCurrency(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("AccountCurrency", null);

            return retrunValue;
        }
Beispiel #11
0
        /// <summary>
        ///     Returns the connected server name.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static string AccountServer(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("AccountServer", null);

            return retrunValue;
        }
Beispiel #12
0
        /// <summary>
        ///     If indicator with name was found, the function returns the window index containing this specified indicator, otherwise it returns -1.
        /// </summary>
        /// <param name="handler"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static int WindowFind(this MqlHandler handler, string name)
        {
            string retrunValue = handler.CallMqlMethod("WindowFind", name);

            return Convertor.ToInt(retrunValue);
        }
Beispiel #13
0
 /// <summary>
 ///     The function sets a flag hiding indicators called by the Expert Advisor.
 /// </summary>
 /// <param name="handler"> </param>
 /// <param name="hide"></param>
 public static void HideTestIndicators(this MqlHandler handler, bool hide)
 {
     string retrunValue = handler.CallMqlMethod("HideTestIndicators", hide ? 1 : 0);
 }
Beispiel #14
0
        /// <summary>
        ///     Returns the price part of the chart point where expert or script was dropped.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static double WindowPriceOnDropped(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("WindowPriceOnDropped");

            return Convertor.ToDouble(retrunValue);
        }
Beispiel #15
0
        /// <summary>
        ///     Returns minimal value of the vertical scale of the specified subwindow of the current chart (0-main chart window, the indicators' subwindows are numbered starting from 1).
        /// </summary>
        /// <param name="handler"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        public static double WindowPriceMin(this MqlHandler handler, int index = 0)
        {
            string retrunValue = handler.CallMqlMethod("WindowPriceMin", index);

            return Convertor.ToDouble(retrunValue);
        }
Beispiel #16
0
        /// <summary>
        ///     Function returns the amount of bars visible on the chart.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static int WindowBarsPerChart(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("WindowBarsPerChart");

            return Convertor.ToInt(retrunValue);
        }
Beispiel #17
0
        /// <summary>
        ///     Returns name of the executed expert, script, custom indicator, or library, depending on the MQL4 program, from which this function has been called.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static string WindowExpertName(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("WindowExpertName");

            return retrunValue;
        }
Beispiel #18
0
 /// <summary>
 ///     Redraws the current chart forcedly. It is normally used after the objects properties have been changed.
 /// </summary>
 /// <param name="handler"></param>
 public static void WindowRedraw(this MqlHandler handler)
 {
     string retrunValue = handler.CallMqlMethod("WindowRedraw");
 }
 public static void ExtMapBuffer2(this MqlHandler handler, int index, double value)
 {
     string retrunValue = handler.CallMqlMethod("ExtMapBuffer2", index, value);
 }
Beispiel #20
0
        /// <summary>
        ///     Saves current chart screen shot as a GIF file. Returns FALSE if it fails.
        /// </summary>
        /// <param name="handler"></param>
        /// <param name="filename"></param>
        /// <param name="size_x"></param>
        /// <param name="size_y"></param>
        /// <param name="start_bar"></param>
        /// <param name="chart_scale"></param>
        /// <param name="chart_mode"></param>
        /// <returns></returns>
        public static bool WindowScreenShot(this MqlHandler handler, string filename, int size_x, int size_y,
                                            int start_bar = -1, int chart_scale = -1, int chart_mode = -1)
        {
            string retrunValue = handler.CallMqlMethod("WindowScreenShot", filename, size_x, size_y, start_bar,
                                                       chart_scale, chart_mode);

            return Convertor.ToBoolean(retrunValue);
        }
Beispiel #21
0
        /// <summary>
        ///     Returns the calculation mode for the Stop Out level. Calculation mode can take the following values:
        ///     0 - calculation of percentage ratio between margin and equity;
        ///     1 - comparison of the free margin level to the absolute value.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static int AccountStopoutMode(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("AccountStopoutMode", null);

            return Convertor.ToInt(retrunValue);
        }
Beispiel #22
0
        /// <summary>
        ///     Returns the time part of the chart point where expert or script was dropped.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static DateTime WindowTimeOnDropped(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("WindowTimeOnDropped");

            return Convertor.ToDateTime(retrunValue);
        }
Beispiel #23
0
        /// <summary>
        ///     Returns free margin value of the current account.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static double AccountFreeMargin(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("AccountFreeMargin", null);

            return Convertor.ToDouble(retrunValue);
        }
Beispiel #24
0
        /// <summary>
        ///     Returns the value at Y axis in pixels for the chart window client area point at which the expert or script was dropped.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static int WindowYOnDropped(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("WindowYOnDropped");

            return Convertor.ToInt(retrunValue);
        }
Beispiel #25
0
        /// <summary>
        ///     The GetTickCount() function retrieves the number of milliseconds that have elapsed since the system was started. It is limited to the resolution of the system timer.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static int GetTickCount(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("GetTickCount", null);

            return Convertor.ToInt(retrunValue);
        }
Beispiel #26
0
        /// <summary>
        ///     Returns the amount of minutes determining the used period (chart timeframe).
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static int Period(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("Period");

            return Convertor.ToInt(retrunValue);
        }
Beispiel #27
0
 /// <summary>
 ///     Function plays a sound file. The file must be located in the terminal_dir\sounds directory or in its subdirectory.
 /// </summary>
 /// <param name="handler"></param>
 /// <param name="filename"></param>
 public static void PlaySound(this MqlHandler handler, string filename)
 {
     string retrunValue = handler.CallMqlMethod("PlaySound", filename);
 }
Beispiel #28
0
        /// <summary>
        ///     Refreshing of data in pre-defined variables and series arrays.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static bool RefreshRates(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("RefreshRates");

            return Convertor.ToBoolean(retrunValue);
        }
Beispiel #29
0
        /// <summary>
        ///     Sends Push notification to mobile terminals whose MetaQuotes IDs are specified on the "Notifications" tab in options window.
        /// </summary>
        /// <param name="handler"></param>
        /// <param name="notification"></param>
        /// <returns></returns>
        public static bool SendNotification(this MqlHandler handler, string notification)
        {
            string retrunValue = handler.CallMqlMethod("SendNotification", notification);

            return Convertor.ToBoolean(retrunValue);
        }
Beispiel #30
0
        /// <summary>
        ///     Returns a text string with the name of the current financial instrument.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static string Symbol(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("Symbol");

            return retrunValue;
        }