call ordersend from within c++?

Back to topics list To post a new topic, please log in or register
avatar
10
magick93 2016.01.26 09: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 

avatar
11
jseparovic 2016.01.26 09: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 

avatar
10
magick93 2016.01.26 09: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! 

avatar
12984
WHRoeder 2016.01.26 19:03 #
 
Terminal calls start. Mt4 calls the DLL. The DLL returns a command to open an order. Mt4 calls OrderSend. No extra threads required.
avatar
11
jseparovic 2016.01.27 01: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
avatar
11
jseparovic 2016.01.27 01: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.

 

avatar
12984
WHRoeder 2016.01.27 03: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.
avatar
11
jseparovic 2016.01.27 09: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

avatar
11
jseparovic 2016.01.27 09: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 

avatar
11
jseparovic 2016.02.07 11: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. 

avatar
11
jseparovic 2016.02.09 06: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
Back to topics list  

To add comments, please log in or register