mql code in c#
Noman Yaqoob: what is wrong with this c# code. I am using TradePlatform.mt4 api:
This forum is for mainly for MQL coding. TradePlatform is a 3rd party API so it might be better for you to discuss the issue on their forum: https://archive.codeplex.com/?p=tradeplatform
EDIT: PS! Also, it seems that it has not been touched for over 4 years, so don't expect much from that project. It might be better for you to actually learn MQL instead of using a 3rd part API.
what is wrong with this c# code. I am using TradePlatform.mt4 api:
double bid = 0.0;
double ask = 0.0;
double balance = 0.0;
int ticket = 0;
bool connected=false;
Bridge.InitializeHosts(true);
terminalA = Bridge.GetTerminal(12773749, "EURUSD");
terminalA.MqlScope(mql => connected=mql.IsConnected());
terminalA.MqlScope(mql => bid=mql.Bid());
terminalA.MqlScope(mql => ask = mql.Ask());
terminalA.MqlScope(mql => balance = mql.AccountCredit());
terminalA.MqlScope(mql => ticket = mql.OrderSend("USDCAD",ORDER_TYPE.OP_BUY, 0.1, ask, 0, 0.0, 0.0, "test order"));
here 12773749 is account number that i have created on web terminal and my configuration code is as follow:
<configSections>
<section name="BridgeConfiguration" type="TradePlatform.MT4.Core.Config.BridgeConfiguration, TradePlatform.MT4.Core" />
</configSections>
<BridgeConfiguration wcfBaseAddress="http://localhost:27917/mt4api">
<Hosts>
<Host name="host1" ipAddress="127.0.0.1" port="2007">
<Handlers>
<!-- Experts -->
<Handler name="MACrossExpert" typeName="TradePlatform.MT4.Demo.Library.Experts.MACrossExpert" assemblyName="TradePlatform.MT4.Demo.Library" />
<!-- Indicators -->
<Handler name="PrevDayHighLowIndicator" typeName="TradePlatform.MT4.Demo.Library.Indicators.PrevDayHighLowIndicator" assemblyName="TradePlatform.MT4.Demo.Library" />
<!-- Scripts -->
<Handler name="ImportOrdersScript" typeName="TradePlatform.MT4.Demo.Library.Scripts.ImportOrdersScript" assemblyName="TradePlatform.MT4.Demo.Library" />
<Handler name="SendEmailScript" typeName="TradePlatform.MT4.Demo.Library.Scripts.SendEmailScript" assemblyName="TradePlatform.MT4.Demo.Library" />
<!-- Tests -->
<Handler name="UnitTestScript" typeName="TradePlatform.MT4.SDK.Library.Scripts.UnitTestScript" assemblyName="TradePlatform.MT4.SDK.Library" />
<Handler name="SmokeTestScript" typeName="TradePlatform.MT4.SDK.Library.Scripts.SmokeTestScript" assemblyName="TradePlatform.MT4.SDK.Library">
<Parameters>
<Parameter propertyName="TestProperty" propertyValue="25" />
</Parameters>
</Handler>
<!-- Common -->
<Handler name="QuoteListener" typeName="TradePlatform.MT4.Core.QuoteListener" assemblyName="TradePlatform.MT4.Core" />
</Handlers>
</Host>
<Host name="host2" ipAddress="127.0.0.1" port="2008">
<Handlers></Handlers>
</Host>
</Hosts>
</BridgeConfiguration>