#define DAY (24 * 60 * 60) void OnStart() { if (HistorySelect(0, TimeTradeServer() + DAY) && (HistoryDealsTotal() > 0)) Print("LastDealPrice = " + (string)HistoryDealGetDouble(HistoryDealGetTicket(HistoryDealsTotal() - 1), DEAL_PRICE)); }
I did not understand the part about.
#define DAY (24 * 60 * 60) ?
Could I just use something like this:
double OPLAST; if (HistorySelect(0, TimeTradeServer()) && (HistoryDealsTotal() > 0)) OPLAST = HistoryDealGetDouble(HistoryDealGetTicket(HistoryDealsTotal() - 1), DEAL_PRICE));
I did not understand the part about.
#define DAY (24 * 60 * 60) ?
There can be a deal after TimeTradeServer.
Thank's man!
Its working!!
There can be a deal after TimeTradeServer.
Why using TimeTradeServer() at all ? Use TimeCurrent().
Your code could gives unexpected result is more than 1 symbol is traded.
Why using TimeTradeServer() at all ? Use TimeCurrent().
Your code could gives unexpected result is more than 1 symbol is traded.
Yeah, I think you right
How should I have to do using TimeCurrent() ? Just need to substitute TimeTradeServer ?
Could be like:
double OPLAST=0; //Price of the Last Order executed ( if (HistorySelect(0, TimeCurrent()) && (HistoryDealsTotal() > 0)) OPLAST = HistoryDealGetDouble(HistoryDealGetTicket(HistoryDealsTotal() - 1), DEAL_PRICE));
????
Yeah, I think you right
How should I have to do using TimeCurrent() ? Just need to substitute TimeTradeServer ?
Could be like:
????
Read the documentation, please.
Your code could gives unexpected result is more than 1 symbol is traded.
Read the documentation, please.
Which is not what the OP is asking. He is asking the price of last deal on a related position (symbol).
Forum on trading, automated trading systems and testing trading strategies
Get Price of Last Deal (Order Executed)
Guilherme Mendonca, 2017.05.19 14:51
If I have multiples orders executed in the same trade (same direction) to do averaging price and I would like to get the price of the last order executed, not the final price (average).
lol...documentation about what ?
TimeTradeServer() >= TimeCurrent(); // true
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
If I have multiples orders executed in the same trade (same direction) to do averaging price and I would like to get the price of the last order executed, not the final price (average).
How can I get this value?
I tryed to use the function bellow, but this function give me the price of the result of all orders.
PositionGetDouble(POSITION_PRICE_OPEN)
Please, could anyone help me??