Is it possible to define time moments, when EA opened pending order?
It means, I want use this approach for EA testing. I will see visually when order was opened.
So I need indicator to find order openings and amrk it, drawing line, f.e.
Is it possible to define time moments, when EA opened pending order?
It means, I want use this approach for EA testing. I will see visually when order was opened.
So I need indicator to find order openings and amrk it, drawing line, f.e.
Thanks
Can't you keep track of time in an array??
Declare a double type arrays, and every time there is a new order, you can take the time stamp and price, and store it into arrays.
When looping through the arrays, you have all of your open trades times, and prices.
You can also the arrays saved to a CSV file.
Once you have this data, you can easily place a vertical line on your chart to show at what point the trade was opened, or a horizontal line, if you are interested in the price, instead of the time. Or you can graph both, the vertical for time, and horizontal for price. This is a fast approach, instead of creating an indicator, which would seem like much more work.
something like this:
double timeArray[50]; double priceArray[50]; int index=0; void start() { // entry logic goes here // ordersend function goes here timeArray[index]=<current time>; priceArray[index]=OrderOpenPrice(); index++; saveToCSV(); // implement function to save to CSV file graphToChart(); // implement to graph a line on time or price }
bool MySelect(int iWhat, int eSelect, int ePool=MODE_TRADES){ if (!OrderSelect(iWhat, eSelect, ePool) ) return (false); if (OrderMagicNumber() != magic.number ) return (false); if (OrderSymbol() != chart.symbol ) return (false); if (ePool != MODE_HISTORY ) return (true); return(OrderType() <= OP_SELL); // Avoid cr/bal forum.mql4.com/32363#325360 // https://forum.mql4.com/30708 // Never select canceled orders. } ////// for(int iPos = OrdersTotal()-1; iPos >= 0; iPos--) if (MySelect(iPos, SELECT_BY_POS)){ int ticket = OrderTicket(); double OOP = OrderOpenPrice(); double OCP = OrderClosePrice(); datetime OOT = OrderOpenTime(), now = Time[0]; TLine("Order"+ticket, OOT, OOP, now, OCP, Gold); }Tline
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Is it possible to define time moments, when EA opened pending order?
It means, I want use this approach for EA testing. I will see visually when order was opened.
So I need indicator to find order openings and amrk it, drawing line, f.e.
Thanks