Download MetaTrader 5

Event Handling

To add comments, please log in or register
dwoodard
7
dwoodard  

Hello All,

I'm working on a project that would allow me to take all of my clients data and put it to a web server (mySQL). Now Ironically enough, it was easier to figure out sending this to a mysql server than just trying to figure which event to use.

I would have to say thanks for this article (http://mqlmagazine.com/mql-programming/mql5-connecting-to-mysql/)

now If I could just get a hand with finding the right event.

Maybe explaining the scenario would help.

So my client opens up the trader, excepts dlls for the EA, and starts to trade... as soon as a "close trade" happens, I would like to fire off to my DB the info from that trade (date/price in, date/price out, ect...)

I think this would give me a close to "live" update as possible.

So when in the world does that Event happen?

So the closest thing that i found is mql5's OnTrade()

but it fires off a couple of events and I don't know how to filter them

such as:performed pending, order opening, position opening/closing, stops setting, pending order triggering


//----

void OnTrade()

{

bool is_closed = TRUE;

if(is_closed == "THIS IS WHAT I'm after, something that says that this event is closed"){

do_mySQL_function();

}

}

------//


Is OnTrade() even the right direction... is there something else? I really hope that all of this makes sense to someone :) and that this forum will hold the answer, because lets face it...not too many people are into mq5


Thanks,

Dustin

MQL5 : Connecting to MySQL | MQLmagazine.com
  • mqlmagazine.com
This article is dedicated to sending data from MQL5 to a MySQL database. The article is at the same time an example for the functions presented in the article DLL Hell, MQL5 Edition : UNICODE vs ANSI. The main advantages of collecting data in MySQL databases would be : data interrogration, lower space needed for important quantities of data...
okwh
1633
okwh  
Processing of trade events in Expert Advisor using the OnTrade() function
  • 2010.07.22
  • KlimMalgin
  • www.mql5.com
MQL5 gave a mass of innovations, including work with events of various types (timer events, trade events, custom events, etc.). Ability to handle events allows you to create completely new type of programs for automatic and semi-automatic trading. In this article we will consider trade events and write some code for the OnTrade() function, that will process the Trade event.
dwoodard
7
dwoodard  

That was the best link!! Thank you!



To add comments, please log in or register