Download MetaTrader 5

Visualization of trades

To add comments, please log in or register
Daniela Bluemel
744
Daniela Bluemel  
Is there a function for this dashed line between opening and closing arrow of one trade?
honest_knave
Moderator
2318
honest_knave  

The dashed line is just a trendline, which can be created programatically using ObjectCreate() and OBJ_TREND.

What are you wanting to do?

If you drag a trade from the Account History tab onto the chart, it will draw it.

If you hold CTRL while you drag a trade from the Account History tab onto the chart, it will add all the trades onto the chart.

Daniela Bluemel
744
Daniela Bluemel  

I want to code this into my EA so that last trades are visible.

Thank you. Thought there is maybe a function so that it hasn't to be placed manually 

honest_knave
Moderator
2318
honest_knave  

You definitely can code it in to your EA.

Your approach will be slightly different depending on whether

1. Your EA closes your orders, or

2 Your orders are closed manually and/or through TP / SL

Amir Yacoby
1183
Amir Yacoby  

basically should be something like
1. select order from history

OrderSelect(ticket);


2. set line_name as the name of the line displayed (should be unique)    

string line_name="order line"+OrderTicket();



3. Create the line

if(!ObjectCreate(ChartId(),line_name,OBJ_TREND,0,open_time,open_price,close_time,close_price)
  return(false);
To add comments, please log in or register