發表文章

目前顯示的是 3月, 2020的文章

[MT4/MQL4] check equal or not conditions for double / double 值比較

bool checkDoubles( double a, double b, string check) { if (check== ">" ){ if (a - b > Point / 2 ) return ( 1 ); else return ( 0 ); } else if (check== "<" ){ if (b - a > Point / 2 ) return ( 1 ); else return ( 0 ); } else if (check== ">=" ){ if (a - b > - Point ) return ( 1 ); else return ( 0 ); } if (check== "<=" ){ if (b - a > - Point ) return ( 1 ); else return ( 0 ); } else if (check== "!=" ){ if ( MathAbs (a - b) > Point / 2 ) return ( 1 ); else return ( 0 ); } else { Print ( "Sorry you've entered a wrong check value" ); } return ( 0 ); } Ref:  https://www.mql5.com/en/forum/136997/page2#593570

[MT4/MQL4] Order Handle Guild / 訂單處理說明

Create / 建立 OrderSend The main function used to open market or place a pending order. int   OrderSend (     string     symbol ,                // symbol     int        cmd ,                    // operation     double     volume ,                // volume     double     price ,                 // price     int        slippage ,              // slippage     double     stoploss ,               // stop loss     double     takeprofit ,            // take profit     string     comment=NULL ,         // comment     int        magic=0 ,               // magic number     datetime   expiration=0 ,          // pending order expiration     color      arrow_color=clrNONE    // color    ); Ref:  https://docs.mql4.com/trading/ordersend Show how many Orders / 全部的訂單有幾筆 OrdersTotal Returns the number of market and pending orders. int   OrdersTotal (); Ref:  https://docs.mql4.com/trading/orderstotal Select Order (i n Transaction b y Position or by Order ID; All

[MT4/MQL4] Order Type / 訂單屬性

ID Value Description OP_BUY 0 Buy operation OP_SELL 1 Sell operation OP_BUYLIMIT 2 Buy limit pending order OP_SELLLIMIT 3 Sell limit pending order OP_BUYSTOP 4 Buy stop pending order OP_SELLSTOP 5 Sell stop pending order Ref:  https://docs.mql4.com/constants/tradingconstants/orderproperties

[MT4/MQL4] Error Code / 程式錯誤代碼

Trade Server Return Codes Code ID Description 0 ERR_NO_ERROR No error returned 1 ERR_NO_RESULT No error returned, but the result is unknown 2 ERR_COMMON_ERROR Common error 3 ERR_INVALID_TRADE_PARAMETERS Invalid trade parameters 4 ERR_SERVER_BUSY Trade server is busy 5 ERR_OLD_VERSION Old version of the client terminal 6 ERR_NO_CONNECTION No connection with trade server 7 ERR_NOT_ENOUGH_RIGHTS Not enough rights 8 ERR_TOO_FREQUENT_REQUESTS Too frequent requests 9 ERR_MALFUNCTIONAL_TRADE Malfunctional trade operation 64 ERR_ACCOUNT_DISABLED Account disabled 65 ERR_INVALID_ACCOUNT Invalid account 128 ERR_TRADE_TIMEOUT Trade timeout 129 ERR_INVALID_PRICE Invalid price 130 ERR_INVALID_STOPS Invalid stops 131 ERR_INVALID_TRADE_VOLUME Invalid trade volume 132 ERR_MARKET_CLOSED Market is closed 133 ERR_TRADE_DISABLED Trade is disabled 134 ERR_NOT_ENOUGH_MONEY Not enough money 135 ERR_PRICE_CHANGED Price changed 136 ERR_OFF_QUOTES Off quotes 137 ERR_BROKER_BUSY Broker