mtapi icon indicating copy to clipboard operation
mtapi copied to clipboard

Method to get Times & Trades

Open marcopipino opened this issue 7 years ago • 4 comments

Hi, is there a method to take the times & trade data ? Or its a enhancement ?

timesandtradesjpg

marcopipino avatar Mar 06 '18 23:03 marcopipino

Hello. Can you clarify what mql functions do you want to see in MtApi? Can you give me more information about data you needed or web link?

vdemydiuk avatar Mar 08 '18 13:03 vdemydiuk

I mean that Metaqoutes does not yet provide a function for MQL5 so far.

KptKuck avatar Mar 08 '18 16:03 KptKuck

Hi vdemydiuk,

I think i can use mtApi method = _mtApiClient.CopyTicks(TimeSeriesValues.SymbolValue) . But when execute this method, i get less data than my data in times and Trades windows from mql5 like my print above.

I want to sum trades , when a lasttrade was at the ask or at the bid . In MLQ5 the sample code would be like this .

MqlTick last_tick[];

  int received=CopyTicks(_Symbol,last_tick,COPY_TICKS_TRADE,0,1);
  int AtBuy ;
  int AtSell ;

  int ticks=ArraySize(last_tick);       

  for(int i=0;i<ticks;i++) 

    { 
        bool buy_tick=((last_tick[i].flags&TICK_FLAG_BUY)==TICK_FLAG_BUY);
        bool sell_tick=((last_tick[i].flags&TICK_FLAG_SELL)==TICK_FLAG_SELL);

        if (buy_tick) 
           {  
              AtBuy= AtBuy+ last_tick[i].volume;
           }
        else if (sell_tick)
           {  
              AtSell= AtSell+ last_tick[i].volume;
           }
     }

marcopipino avatar Mar 08 '18 22:03 marcopipino

Hi KptKuck , maybe u r correct , a quick look on mql5 community i see a lot discussion about get times & trades window ... but nothing conclusive . tks.

marcopipino avatar Mar 08 '18 23:03 marcopipino