This project is read-only.

Return value of all methods are null.

Nov 30, 2012 at 11:40 PM
Edited Dec 1, 2012 at 6:40 AM

No matter what method i calling they always crash with ArgumentNullException when method tries to convert returnValue (string) to specified type. Is it because today saturday,  3.40 a.m. and market is closed?

Also, QuoteReceived won't fire.

Dec 3, 2012 at 7:40 PM

To make your QuoteReceived fire make sure you enter the right value under properties of your Expert_NET

Double click your EA in MetaTrader
Go to tab "Input"
Item "System_NET_HandlerName" enter value "QuoteListener".

Did this solve this issue?

Dec 11, 2012 at 6:32 PM
Edited Dec 11, 2012 at 6:32 PM

Have you solved your ArgumentNullException? If not can you provide the method code calling this method?

Dec 13, 2012 at 2:42 PM

Yes, i realised that all methods can be called only when QuoteReceived fires. And QuoteReceived fires only when market is open.

Dec 13, 2012 at 2:46 PM

The thing i want to know: is it possible to keep permanent connection to MetaTrader? 

Dec 17, 2012 at 10:59 PM
Edited Dec 17, 2012 at 10:59 PM

Hi,

I think you're wrong. Sure you'll need the handler the QuoteReceived gives you:

private void metaTrader4_QuoteRecieved(QuoteListener mql)
{
            double bid = mql.Bid();
}

But in any other event you can do the same things this way:

metaTrader4.MqlScope(mql => 
{
// your code here, like:
mql.OrderSend("EURUSD", ORDER_TYPE.OP_SELL, 1, mql.Bid(), 10, 0, 0));
}
Dec 19, 2012 at 1:23 PM

Calling MqlScope just enqueuing mql-method call request which will be executed on next quote received. But sending orders using mqlscope doesn't returns order number.

Instead of this i'm calling OrderSend directly on QuoteReceived. But i faced a problem: sometimes OrderSend just returns -1 without no explanation. (API hasn't GetLastError method).