Visualization of trades

 
Is there a function for this dashed line between opening and closing arrow of one trade?
 

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.

 

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 

 

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

 

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);
Reason: