Hi,
Please find the below code.
using System;
using System.Configuration;
using nj4x.Metatrader;
namespace nj4x_sbs_1
{
class Program
{
static void Main(string[] args)
{
// Create strategy
var mt4 = new nj4x.Strategy();
// Connect to the Terminal Server
mt4.Connect( "127.0.0.1", 7788,
mt4Server: new Broker(ConfigurationManager.AppSettings["broker"]),
mt4User: ConfigurationManager.AppSettings["account"],
mt4Password: ConfigurationManager.AppSettings["password"]
);
// Use API methods …
Console.WriteLine(String.Format("Account {0}", mt4.AccountNumber()));
Console.WriteLine(String.Format("Equity {0}", mt4.AccountEquity()));
double bid = mt4.Marketinfo(symbol: "EURUSD", type: MarketInfo.MODE_BID);
double ask = mt4.Marketinfo("GBPUSD", MarketInfo.MODE_ASK);
Console.WriteLine(String.Format("BID {0}", bid));
Console.WriteLine(String.Format("ask {0}", ask));
var s = new MyStrategy();
//place order
//s.place_order(bid, ask);
int total = mt4.OrdersHistoryTotal();
//Console.WriteLine("Total order:", total);
//
Console.ReadLine();
//s.order_history();
//Console.ReadLine();
}
}
}
Regards,
Saravanan.B