Download MetaTrader 5
To add comments, please log in or register
Use MQL5 Cloud Network. Test robots at a super speed!
mar
1143
mar 2014.10.30 09:53 

Hi forum,

I want to do a script which places a trade according to moneymanagement rules. It should place three lines in the chart. Entry, SL and TP. Of course in different colors/styles to distinguish them. Then I want to drag them to the correct places. That's easy until now. But then I need an idea. The lines are placed and the order should now be sended. But I have to idea how to confirm that the lines are now in the right place. Now I need something like an OK-button to confirm that the order should now be placed according to the lines.

Is that possible with a script? Does anyone have an idea how to do it?

I only have the idea to make two scripts. One places the lines in different colors and with names like "Entry", "SL", "TP". And then I could start a new script which sends the order by using the values of the lines placed by the first script. But maybe there is a possibility to do it with one script?

Carl Schreiber
5957
Carl Schreiber 2014.10.30 10:28  
Either you pay or you read the book and docs and you look in the code base for examples to change acc. to your plans.
mar
1143
mar 2014.10.30 10:45  

Either you have a good idea or you please ignore my posting. I only asked for an idea, not for help in programming.

Keith Watford
Moderator
7979
Keith Watford 2014.10.30 11:10  

The easiest way is probably to place a label on the chart and use ChartEvent and ObjectClick. Maybe open a message box to confirm in case of accidently clicking the label.I've not had much experience with using buttons, but I did post some code a little while back that uses buttons. You may find it if you search my posts.

mar
1143
mar 2014.10.30 11:20  
Hey Keith, thank you! I will search for it!
mar
1143
mar 2014.10.30 12:07  
Unfortunately OnChartEvent with CHARTEVENT_OBJECT_CLICK can only be used in indicators or experts but not in scripts. Therefore I think I have to use two scripts. One to plot the lines and the other to read the data from the lines, calculate the lotsize and send the order. But thank you anyway. I learned a lot about ChartEvents today!
/
To add comments, please log in or register