Questions from Beginners MQL5 MT5 MetaTrader 5 - page 793

 
Vladimir Karputov:

п. 5. :)


  • You don't need alerts - just do Print().
  • You need to sift events by:
    • lparam
    • dparam
    • and sparam

I can sift it out. But my question is about something else.
I'm trying to understand (my head isn't just for wearing a hat, right?) if this function works correctly. Is it supposed to be like this, or is there something wrong?

 
User_mt5:

Trying to get an OnChartEvent call on a mouse click on an object.

...


Here is what is passed for"CHARTEVENT_OBJECT_CLICK"

Event

id parameter value

lparam parameter value

dparam parameter value

Parameter value sparam

The event of a mouse click on a graphical object

CHARTEVENT_OBJECT_CLICK

X coordinate

Y coordinate

Name of the graphical object where the event occurred


That is, you need to catch id==CHARTEVENT_OBJECT_CLICK and sparam==name of your object.
 
Vladimir Karputov:

Here is what is passed for"CHARTEVENT_OBJECT_CLICK"

Event

Parameter value id

lparam parameter value

dparam parameter value

Parameter value sparam

The event of a mouse click on a graphical object

CHARTEVENT_OBJECT_CLICK

X coordinate

Y coordinate

Name of the graphical object where the event occurred


That is, you need to catch id==CHARTEVENT_OBJECT_CLICK and sparam==name of your object.

That's what I thought at first too. But string gives name of object, which was clicked. So it seems to be an output parameter.
Or am I wrong?

 
User_mt5:

That's what I thought at first too. But the string outputs the name of the object that was clicked. So, apparently, it's an output parameter after all.
Or am I wrong?


Do you need to catch a click on an object? I gave you a hint on how above.

Forum on trading, automated trading systems & strategy testing

Questions from Beginners MQL5 MT5 MetaTrader 5

Vladimir Karputov, 2017.11.07 13:38


Here is what is passed for"CHARTEVENT_OBJECT_CLICK"

Event

Parameter value id

Parameter value lparam

dparam parameter value

Parameter value sparam

The event of a mouse click on a graphical object

CHARTEVENT_OBJECT_CLICK

X coordinate

Y coordinate

Name of the graphical object where the event occurred


That is, you need to catch id==CHARTEVENT_OBJECT_CLICK and sparam==name of your object.

 

Yeah, yeah, I think I've got it.
The function itself is called by any event (both mouse and keyboard), and you need to filter the right event inside.
Thanks.

 
User_mt5:

Yeah, yeah, I think I've got it.
The function is called on any event (both mouse and keyboard), and inside you need to filter out the right event.
Thanks.


There are several events(types of events): click, create, change properties ... So first you have to sift out events by ID, then by sparam.


 
Vladimir Karputov:

There are several events(types of events): click, create, change properties ... So first you have to sift out events by ID, then by sparam.


Yes, thank you. For some reason, I thought, that it's possible to sift at a level of function call. And I wanted to sift out everything by id, so I put id in the function call.
"Well, crazy, what can you take!"))
And on the inside, of course, it's easy. Thanks again.

 

I don't want to create a new topic for a small question, maybe newcomers will also find it useful to know, like me.

At what time is it possible to submit new applications for freelance work?

If I already used all 10 yesterday.

 

Can anyone tell me which way to go? Excel has new functions "Forecasting Functions", etc. - e.g. "PREPARTS.ETS", "PREPARTS.ETS.DOVINTERVAL".

Is there anything similar in MQL5? I.e. input data array - output predicted array.

To be able to build a new line as in the screenshot, white line in the bottom indicator.

 

Friends, help a dummy. The idea is as follows: When the "Ind" variable reaches a given level, we switch to waiting for "Value" to change direction while waiting for "Ind" not to be checked again.


   if(Ind[0]<=-0.7)
     {
      while(Value[3]>Value[2]<Value[1])
        {
         if(CopyBuffer(InpInd2_Handle,1,SignalBar,3,Value)<=0)
           {
            Recount=true;
            return;
           }
        }
      if(BuyPosOpen) BUY_Open=true;
     }


What is the right way to do it???

Reason: