Wishes for MQL5 - page 59

 
diakin >> :

What kind of events, for example?

For example, from practice, the closing of a position. I had such a task - to know when a position was closed in order to modify other orders taking into account the released funds. I had to monitor the account state all the time. I tried to track orders from the history but it was impossible to test them, everything takes a very long time.

The only event that can be processed now is a tick.

 
Gupm писал(а) >>

For example, from practice, closing a position. I had such a task - to know when a position was closed in order to modify other orders taking into account the released funds. I had to monitor the account status all the time. I tried to track orders from the history but it was impossible to test them, everything takes a very long time.

The only event that can be handled now is a tick.

But anyway, start() is launched at every tick. You can do any check there, whether some event has occurred or not.

 
diakin писал(а) >>

So, anyway, start() is run on every tick. You can do any kind of check there, whether some event happened or not.

Yes, it is, I'm doing it now, but how wonderful it will be when the order is an object, which will have, for example, a closing event, to which you bind your handler and all, this part of the code is absolutely separate, debugged, etc.

 
Gupm писал(а) >>

Yes, it does, that's what I'm doing now, but how wonderful it will be when the order is an object that will have, for example, a closing event, to which you bind your handler and that's it, this part of the code is completely separate, debugged, etc.

I think it may be easy to do in MQL5.

;)

int OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, 
int magic=0, datetime expiration=0, color arrow_color=CLR_NONE, 
func OnClose) 

The last parameter is the function name to be called when closing the order. The compiler will recognize the functions in the text anyway, and it will recognize them in the parameters.

And the events are handled internally, since the message about the order closing (or error) is being printed to the log.

But we can expect more events, which would also have to be described in parameters, at least with empty values, like OnCloseEmpty, OnOpenEmpty , etc.

In general, it would be good to add a list of templates for frequently called functions, when you select from which the function template with all the required parameters would be inserted into the text.

Now we have to go into the help, copy the description of the function and edit the parameters.

 

I would like to make a request for MQL5.

Sorry, if I repeat it, I haven't read all previous posts...

I wish the loops in new mql would be marked somehow, for example, like this:

 
Duke3D писал(а) >>

...

I wish the loops in the new mql would be highlighted somehow, e.g. like this:

At least make a text formatting button with automatic indentation for curly brackets.

Now if a bracket is missed, it's very hard to find where it happened.

And also add line numbering. It's not a common thing in C. It is more convenient than looking for the line number on the statusbar.

 
diakin >> :

I think it's easy to do in MQL5.

int OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, 
int magic=0, datetime expiration=0, color arrow_color=CLR_NONE, 
func OnClose) 

;)

The last parameter is the function name to be called when closing the order. The compiler recognizes the functions in the text anyway, and it will recognize them in the parameters.

And the events are handled internally, since the message about the order closing (or error) is being printed to the log.

But we can expect more events, which would also have to be described in parameters, at least with empty values, like OnCloseEmpty, OnOpenEmpty , etc.

In general, it would be good to add a list of templates for frequently called functions, when you select from which the function template with all the required parameters would be inserted into the text.

Now I have to go into the help, copy the function description and edit the parameters.

Why only onClose? What about onModify, onOpen?

Maybe if this is an object, it should be something like this:


TOrder order = new  TOrder(symbol, cmd,  volume, price, slippage, stoploss, takeprofit, comment);
order.addEventListener( "open", myOpenHandler);
order.addEventListener( "close", myCloseHandler);
order.addEventListener( "modify", myModifyHandler);
order.send();

Ы?

 
TedBeer писал(а) >>

Why only onClose? What about onModify, onOpen?

Maybe if order is an object, there should be something like this:

Ы?

It's hard to say.

int ticket=OrderSend(parameters); // the usual function from MQL4

order(ticket).addEvent ("open", myOpenHandler);

Or more compact

Order(ticket).OnOpen=myOpenHandler;

where Order(handle) is something standard, an object or structure through which you can get to the properties of the given object handle.

double MyVolume=Order(ticket).Volume;


One hell of a lot of custom events can't be bolted on. Or can we?

Order(ticket).addEvent ("MyCustomEvent", MyCustomEventHandler);

Where is "MyCustomEvent" described in this case? (if it's NOT a combination of standard events and preconditions).

Although as I understand MQL5 has already been written, so it's a wish for the future ;)))

 
diakin >> :

It's hard to say.

int ticket=OrderSend(parameters); // usual function from MQL4

Order(ticket).addEvent ("open", myOpenHandler);

Or more compact

Order(ticket).OnOpen=myOpenHandler;

where Order(handle) is something standard, an object or structure through which you can get to the properties of the given object handle.

double MyVolume=Order(ticket).Volume;


One hell of a lot of custom events can't be bolted on. Or can we?

Order(ticket).addEvent ("MyCustomEvent", MyCustomEventHandler);

Where is "MyCustomEvent" described in this case? (if it's NOT a combination of standard events and preconditions).

Although, as I understand MQL5 has already been written, so it's a wish for the future ;)))

Well, you have a mishmash of functional approach and OOP. Ideologically, it should be one or the other. Even if the usual functions are preserved for backward compatibility, the OOP should also be implemented, otherwise what is the point of such a profound modernization called MQL5?

Unfortunately all of our discussions are akin to the reading of tea leaves. They are of no use, since we don't see any willingness from methaquotes, not only to give the beta version, but also to publish the specifications of the language that they have implemented. Then you could reasonably ask to do something with the language before releasing it as a product.