Download MetaTrader 5
To add comments, please log in or register
1000 paid orders are executed in Freelance service. Sign up!
Anton Hughes
47
Anton Hughes 2016.01.26 08:22 

Hello

 When using c++, is it possible to access the mql methods from within the c++ code? Or is it only possible to pass primitives between the c++ and mql?

 

To clarify, I am wanting the ability to call orderSend in c++ code.

 

Thanks 

Jason Separovic
15
Jason Separovic 2016.01.26 08:39  

You have to get the MQL code to initiate the process. Check here for a solution in C# :  https://github.com/jseparovic/MQL4CSharp

It's quite simple really, just makes use of the onTimer function and launches the C# code in it's own thread, so it can block while the MQL function completes and sets the result 

Anton Hughes
47
Anton Hughes 2016.01.26 08:53  
jseparovic:

You have to get the MQL code to initiate the process. Check here for a solution in C# :  https://github.com/jseparovic/MQL4CSharp

It's quite simple really, just makes use of the onTimer function and launches the C# code in it's own thread, so it can block while the MQL function completes and sets the result 

Thanks jseparovic 

 You have a very interesting project there!

Whats the story of the AlgoTrader github repo? Seems someone didnt like you using that! 

whroeder1
13656
whroeder1 2016.01.26 18:03  
Terminal calls start. Mt4 calls the DLL. The DLL returns a command to open an order. Mt4 calls OrderSend. No extra threads required.
Jason Separovic
15
Jason Separovic 2016.01.27 00:35  
magick93:

Thanks jseparovic 

 You have a very interesting project there!

Whats the story of the AlgoTrader github repo? Seems someone didnt like you using that! 

I just noticed that. I hadn't even looked at it yet. Seems as though they retracted their opensource
Jason Separovic
15
Jason Separovic 2016.01.27 00:38  
WHRoeder:
Terminal calls start. Mt4 calls the DLL. The DLL returns a command to open an order. Mt4 calls OrderSend. No extra threads required.

How do you get the command response back though within the same C# call?

So C# call to OrderSend waits until MT4 detects the command and sets the result. It must be in a separate thread if it is blocking.

whroeder1
13656
whroeder1 2016.01.27 02:25  
jseparovic: How do you get the command response back though within the same C# call?
There is no "same C# call." You call the DLL it returns values (function value or parameters passed by referenced) The DLL call is over; check the results and do the OrderSend.
Jason Separovic
15
Jason Separovic 2016.01.27 08:37  
WHRoeder:
There is no "same C# call." You call the DLL it returns values (function value or parameters passed by referenced) The DLL call is over; check the results and do the OrderSend.

"There is no "same C# call.""??  haha, yes there is!

You are missing the point, that it the goal of my api!  The idea of this library it to write code purely in C#, and never touch MQL.

So therefore if I want to call OrderSend in C#, I must have it in a separate thread, as multiple DLL calls from MT4 need to be made during the start and end of the C# method. The C# method blocks, while MT4 does it's stuff.

I'm just offering a different approach. no need to get all black and white about it

Jason Separovic
15
Jason Separovic 2016.01.27 08:41  
magick93:

Thanks jseparovic 

 You have a very interesting project there!

Whats the story of the AlgoTrader github repo? Seems someone didnt like you using that! 

hey magick,

I just committed a bunch of the framework stuff. Checkout https://github.com/jseparovic/MQL4CSharp/blob/master/MQL4CSharp/UserDefined/Strategy/MaCrossStrategy.cs

This is the basic idea I'm going for. All the bits should be reusable, and strategies simple to write.

 

Cheers 

Jason Separovic
15
Jason Separovic 2016.02.07 10:00  

I just tested a REST API too and it works nicely. In the next commit you will be able to run MQL commands from REST. Then I'll add a websockets API for events and onTick RatesInfo. Get some pretty JS frontends happening. 

Jason Separovic
15
Jason Separovic 2016.02.09 05:42  
jseparovic:

I just tested a REST API too and it works nicely. In the next commit you will be able to run MQL commands from REST. Then I'll add a websockets API for events and onTick RatesInfo. Get some pretty JS frontends happening. 

http://screencast.com/t/L99aBY9LiRU
/
To add comments, please log in or register