vdemydiuk / mtapi

MetaTrader API (terminal bridge)
http://mtapi4.net/
MIT License
522 stars 281 forks source link

Method to get Times & Trades #101

Open marcopipino opened 6 years ago

marcopipino commented 6 years ago

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

timesandtradesjpg

vdemydiuk commented 6 years ago

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?

KptKuck commented 6 years ago

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

marcopipino commented 6 years ago

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 commented 6 years ago

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.