Script that catchs two clicks on chart

 

Hi there

I need to build a script that start catching two mouse click on chart and corresponding price levels. I used ChartPriceOnDropped successfully for just one price level but now I need two.

How can I do?

Thanks

Nicola

 
NicolaGrippaldi:

Hi there

I need to build a script that start catching two mouse click on chart and corresponding price levels. I used ChartPriceOnDropped successfully for just one price level but now I need two.

How can I do?

Thanks

Nicola

What is the problem ?
 

which function have I to use? could I ask you an example?

I need to catch the values for a pending order and relative stop loss, then open the order window set with evaluated type and volume, not directly open position

 
NicolaGrippaldi:

which function have I to use? could I ask you an example?

I need to catch the values for a pending order and relative stop loss, then open the order window set with evaluated type and volume, not directly open position

You can't open the standard order window by code.

Do you know you can already open an order and place the stoploss with some mouse clicks ? (standard MT4/MT5 features).

 

Yes, I know

I wish to automate my risk based algorithm to evaluate volume

So I can only open a position by code, OK, and can I anyway catch two clicks?

 
NicolaGrippaldi:

Yes, I know

I wish to automate my risk based algorithm to evaluate volume

So I can only open a position by code, OK, and can I anyway catch two clicks?

Yes why not ? What's your problem to catch 2 clicks ?

Please show your code if you need help.

 
Which function have I to use, can ChartPriceOnDropped wait for a new click?
 
Alain Verleyen:

Yes why not ? What's your problem to catch 2 clicks ?

Please show your code if you need help.

Can we do that?

How??

I just had some idea of a script (creating objects for a range, but I don't know how to catch the second click)

Is it possible to catch the third click still? 

 

You have to implement OnChartEvent() event handler.

For examples look in the help and search forum and code base. 

 
Drazen Penic:

You have to implement OnChartEvent() event handler.

For examples look in the help and search forum and code base. 

Didn't know I can create OnChartEvent() in a script

 Thank you for the pointer! 

 
Drazen Penic:

You have to implement OnChartEvent() event handler.

For examples look in the help and search forum and code base. 

I've looked into docs, forum, and codebase.

Kind of sparsed information (from my point of view)

I guess I need a little help to understand what exactly I have to do.

My guess now is I have to deny OnStart() to end, use sleep() maybe?

Then implement OnChartEvent() as in indicators?

I will meddle in code, try to see what happens,

but if you or someone else know what to do exactly, or have a link to read, I will greatly appreciate it 

 

If i have success, I will post the right solution to this 

Reason: