MQL4 - automated forex trading   /  

Forum

Easy to use .NET MT4 API

Back to topics list  | 1 2 To post a new topic, please log in or register. You can also visit MQL5 forum

avatar
14
timurila 2009.07.21 16:59 

I have developed some times ago easy to use .NET MT4 API and can sell it. Also could provide trial version.

API shows tooltips to all functions:


ToolTip

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

article

Reporting the Eleventh Week (8-14 December)

Balance charts of top ten Participants drifted apart.


avatar
14
timurila 2009.08.11 01:04 

Trial version of Reduced .NET MT4 API attached. This version called reduced because it doesn't support back testing, just real time trading. It allows communicating with MT4 from .NET executable. Later would be presented Complete .NET MT4 API (as separate product) that allows to create EA in .NET DLL and back testing would be available as well as real time trading. Tool tips and debugging in Visual Studio available in Reduced .NET MT4 API.


Regards

Tim

timurila@gmail.com


Attached files:
  Reduced_MT4_.NET_API_Trial_1.0.1.zip (2 417.39 KB)

avatar
14
timurila 2009.08.14 00:59 

I've decided to split API's on following:

1 .NET executable to MT4 API(previously Reduced) - allows communicating with MT4 from .NET executable. Back testing in MT4 is not possible with this API, just real time trading. API good for bridging between MT4 and another platforms. Also could be useful for people who already have the system written on non MQL language and want to trade it on MT4 without porting to MQL. Programmer just uses special class to call any MQL functions(trading, indicators, checkup, etc).

2 .NET Expert Advisor for MT4 API(previously Complete) - 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. Almsot ready!

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



avatar
14
timurila 2009.08.17 18:23 

New 1.0.3 version of MT4 .NET API avaliable.

Fixed problem with tooltips.

Previuosly were realized just trading and checkup functions. From now account functions also available.


Tim

timurila@gmail.com

www.tradingapi.net

Attached files:
  MT4_.NET_API_1.0.3_Trial.zip (2 431.99 KB)

avatar
14
timurila 2009.09.07 18:40 


Latest 1.0.4 version attached.


Tim

timurila@gmail.com

www.tradingapi.net

Attached files:
  MT4_.NET_API_1.0.4_Trial.zip (2 433.03 KB)

avatar
14
timurila 2009.09.15 09:29 

New 1.0.7 version.

Was fixed problem with contolling several MT4 plaforms from one application.


Tim

timurila@gmail.com

www.tradingapi.net

Attached files:
  MT4_.NET_API_1.0.7_Trial.zip (2 433.60 KB)

avatar
5
ilTallman 2009.09.16 02:25 
timurila wrote >>
www.tradingapi.net

Does this API allow me to get data out of MT4 platform an into another? I need to get Close, High, Low, Bid, Ask and Volume out. I would also like to get RSI and MACD.


avatar
14
timurila 2009.09.16 07:58 
ilTallman:

Does this API allow me to get data out of MT4 platform an into another? I need to get Close, High, Low, Bid, Ask and Volume out. I would also like to get RSI and MACD.

If you want to use in MT EA data from another MT platform this API it's just the part of solution. I could make the second part for you also.


Tim

timurila@gmail.com

www.tradingapi.net


avatar
14
timurila 2009.09.16 10:09 
ilTallman:

Does this API allow me to get data out of MT4 platform an into another? I need to get Close, High, Low, Bid, Ask and Volume out. I would also like to get RSI and MACD.


But another way is to work(get data and send orders) with both MT4 platforms from one .NET application. In this case this API is enough.


Tim

timurila@gmail.com

www.tradingapi.net


avatar
14
timurila 2009.09.17 22:28 
ilTallman:

Does this API allow me to get data out of MT4 platform an into another? I need to get Close, High, Low, Bid, Ask and Volume out. I would also like to get RSI and MACD.

If you know SQL I also can propose MT4 MSSQL API that allows to work with MSSQL database from MQL. In this case you could make exchange between platforms via DB.


Tim

timurila@gmail.com

www.tradingapi.net


avatar
14
timurila 2009.09.23 23:18 

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

www.tradingapi.net

Back to topics list   | 1 2  

To add comments, please log in or register