Easy to use MT4 .NET APIBack to topics list |
|
timurila
2009.08.11 20:20
I want to present fallowing API's(each supports tooltips and debugging in Visual Studio.): 2 .NET Expert Advisor for MT4 API - allows to create Expert Advisor on powerfull .NET. Back testing avaliable. Programmer need to create class that implements special interface. As result his class will get init, deinit, start signals and inside this class programmer could call any MQL functions. 3 .NET classes from MT4 API - appropriate for people who creates EA's on MQL but want to operate with .NET classes and call their methods from MQL Editor. Tim timurila@gmail.com |
|
timurila
2009.08.11 20:21
Trial version of .NET executable to MT4 API
attached. Instructions, sample VB and C# projects included in archive. C# example: using System; using System.Collections.Generic; using System.Text; using MetaTraderApi; namespace TestClient { public class ExtendedMT : MetaTrader { public ExtendedMT(string channelName) : base(channelName) { } public int buy(string symbol) { double ask = MarketInfo(symbol, InfoMode.ASK); int ticket = OrderSend(symbol, Op.BUY, 1, ask, 0, 0, 0); if(ticket<=0) throw new Exception(GetLastErrorDescription()); return ticket; } public int sell(string symbol) { double bid = MarketInfo(symbol, InfoMode.BID ); int ticket = OrderSend(symbol, Op.SELL, 1, bid, 0, 0, 0); if (ticket <= 0) throw new Exception(GetLastErrorDescription()); return ticket; } public void closeAll() { while (OrdersTotal()>0) { if(OrderSelect(0, SelectMode.BY_POS)) { double price = 0; if(OrderType() == Op.BUY ) price = MarketInfo(OrderSymbol(), InfoMode.BID); if(OrderType() == Op.SELL) price = MarketInfo(OrderSymbol(), InfoMode.ASK); if(!OrderClose(OrderTicket(), OrderLots(), price,0)) throw new Exception(GetLastErrorDescription()); } else throw new Exception(GetLastErrorDescription()); } } public void printOrders() { int count = OrdersTotal(); for (int i = 0; i < count; i++) { if (OrderSelect(i, SelectMode.BY_POS)) Console.WriteLine(OrderSymbol() + " " + OrderExpiration()); else throw new Exception(GetLastErrorDescription()); } } public int buyPending(string symbol) { double ask = MarketInfo(symbol, InfoMode.ASK); double point = MarketInfo(symbol, InfoMode.POINT); double price = ask + 10 * point; int ticket = OrderSend(symbol, Op.BUYSTOP, 1, price, 0, 0, 0, null, 0, DateTime.Now.AddHours(1)); if (ticket <= 0) throw new Exception(GetLastErrorDescription()); return ticket; } } } Regards Tim timurila@gmail.com |
|
nickfx
2009.08.12 09:25
Disappointed... It's just using a MT4 side EA as a proxy... Ugly solution I'd say. |
|
timurila
2009.08.12 16:17
nickfx :
Disappointed... It's just using a MT4 side EA as a proxy... Ugly solution I'd say. Thanks for the interest. What kind of API(or way of realization) you would be glad to see? |
|
timurila
2009.08.17 18:19
|
|
timurila
2009.09.07 18:43
|
|
timurila
2009.09.15 09:27
New 1.0.7 version. Was fixed problem with contolling several MT4 plaforms from one application. Tim timurila@gmail.com |
|
timurila
2009.09.23 23:13
New 1.1.1 version available to download. New Common and Indicator function groups were added. See documentation for additional details. Tim timurila@gmail.com |
