How i get OpenPrice of Deal from history data

To add comments, please log in or register
Mohammad Ali
134003
Mohammad Ali  

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 ... 

Trinh Dat
48669
Trinh Dat  

Hi

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

Alain Verleyen
39535
Alain Verleyen  
Already discussed a dozen of times on this forum.
To add comments, please log in or register