How i get OpenPrice of Deal from history data

 

Dear,

In MT5, i want get a OpenPrice of a close trade from History, I write a close but it is not working, can anyone help me. 


if(HistorySelect(start_date,TimeCurrent()))
      {
         for (int i=HistoryDealsTotal()-1; i>=0; i--) {
            if((tic=HistoryDealGetTicket(i))>0)
            {
           
               if ( HistoryDealGetString(tic,DEAL_SYMBOL) == _symbol && ( HistoryDealGetInteger(tic,DEAL_TYPE)==DEAL_TYPE_SELL || HistoryDealGetInteger(tic,DEAL_TYPE)==DEAL_TYPE_BUY ) && HistoryDealGetInteger(tic,DEAL_MAGIC) == Magic){  

                 if( HistoryDealGetInteger(tic,DEAL_ENTRY)== DEAL_ENTRY_OUT)
                 {
                     prices = prices + (HistoryDealGetDouble(tic,DEAL_PRICE));
                     
                 } 

               }  
            }
         }
      }
        


In the code HistoryDealGetDouble(tic,DEAL_PRICE)   return CLOSE PRICE but i want what was the OpenPrice() of this deal 


Please anyone help me ... 

 

Hi

maybe get Position ID then use HistorySelectByPosition to get list of deal

 
Already discussed a dozen of times on this forum.
 
Alain Verleyen:
Already discussed a dozen of times on this forum.

Hello,


This may be a stupid question to ask, but is there a search bar somewhere to search for key words in the forum? E.g. deal_price, HistoryDealGetTicket(), backtest and so on?

I feel like I'm missing something.

Thanks

Reason: