[HALF/SOLVED] TICK_FLAG_BUY / TICK_FLAG_SELL - CopyTicks() and SymbolInfoTick() difference

To add comments, please log in or register
Flavio Jarabeck
6707
Flavio Jarabeck  

While CopyTicks() give me the TICK_FLAG_BUY / TICK_FLAG_SELL flags, SymbolInfoTick() does not.

Market: Brazil / B3 exchange / Futures / Broker: Modal

With SymbolInfoTick() I only get BID/ASK/LAST flags... and an "unknown" flag (0=zero).

Is this behavior correct?

And, is this Zero flag expected from SymbolInfoTick()? what is it?


Thanks for any light!

;)

Testing Code:

//+------------------------------------------------------------------+
//| ON CALCULATE
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[]) {

    // gets just executed tick for the Symbol...
    if (!SymbolInfoTick( _Symbol, curTick ))  { Print("Tick NOT received!"); return 0; }

    //DEBUG:
    string o = TimeToString(curTick.time) + "    bid: " + (string)curTick.bid + "   ask:" + (string)curTick.ask + "   last: " + (string)curTick.last + "    vol:" + (string)curTick.volume_real;
    if      ((curTick.flags &TICK_FLAG_BID)==TICK_FLAG_BID)       { o += "    -BID- " + (string)curTick.flags; }
    else if ((curTick.flags &TICK_FLAG_ASK)==TICK_FLAG_ASK)       { o += "    -ASK- " + (string)curTick.flags; }
    else if ((curTick.flags &TICK_FLAG_LAST)==TICK_FLAG_LAST)     { o += "    -LAST- " + (string)curTick.flags; }
    else if ((curTick.flags &TICK_FLAG_BUY)==TICK_FLAG_BUY)       { o += "    -BUY- " + (string)curTick.flags; }
    else if ((curTick.flags &TICK_FLAG_SELL)==TICK_FLAG_SELL)     { o += "    -SELL- " + (string)curTick.flags; }
    else if ((curTick.flags &TICK_FLAG_VOLUME)==TICK_FLAG_VOLUME) { o += "    -VOLUME- " + (string)curTick.flags; }
    else                                                          { o += "    -UNKNOWN- " + (string)curTick.flags; } 
    Print( o );

    // adds up the BUY/SELL volume...
    if      ((curTick.flags &TICK_FLAG_BUY)==TICK_FLAG_BUY)    { bufferBUY[0]  += curTick.volume_real; }
    else if ((curTick.flags &TICK_FLAG_SELL)==TICK_FLAG_SELL)  { bufferSELL[0] -= curTick.volume_real; }

    return rates_total;
}
Flavio Jarabeck
6707
Flavio Jarabeck  

As bizarre as it is...

I found a way to identify, at least for the brazilian B3 exchange, the BUY and SELL ticks from SymbolInfoTick()...

I will leave the code here to help others...

Cheers!

OnCalculate() code:


    // gets just executed tick for the Symbol...
    if (!SymbolInfoTick( _Symbol, curTick ))  { Print("Tick NOT received!"); return 0; }
    /*
    //DEBUG: TICK_FLAG_BID | TICK_FLAG_ASK = 6  // TICK_FLAG_LAST | TICK_FLAG_VOLUME = 24 //  BUY=56 / SELL=88 -->TICK_FLAG_LAST+TICK_FLAG_VOLUME+TICK_FLAG_BUY,idem
        string o = TimeToString(curTick.time) + "    bid: " + (string)curTick.bid + "   ask:" + (string)curTick.ask + "   last: " + (string)curTick.last + "    vol:" + (string)curTick.volume_real;
        if      ((curTick.flags &TICK_FLAG_BID)==TICK_FLAG_BID)       { o += "    -BID- " + (string)curTick.flags; }
        else if ((curTick.flags &TICK_FLAG_ASK)==TICK_FLAG_ASK)       { o += "    -ASK- " + (string)curTick.flags; }
        else if ((curTick.flags &TICK_FLAG_LAST)==TICK_FLAG_LAST)     { o += "    -LAST- " + (string)curTick.flags; }
        else if ((curTick.flags &TICK_FLAG_BUY)==TICK_FLAG_BUY)       { o += "    -BUY- " + (string)curTick.flags; }
        else if ((curTick.flags &TICK_FLAG_SELL)==TICK_FLAG_SELL)     { o += "    -SELL- " + (string)curTick.flags; }
        else if ((curTick.flags &TICK_FLAG_VOLUME)==TICK_FLAG_VOLUME) { o += "    -VOLUME- " + (string)curTick.flags; }
        else                                                          { o += "    -UNKNOWN- " + (string)curTick.flags; } 
        Print( o );
    */
   
    if      (curTick.flags == TICK_FLAG_LAST+TICK_FLAG_VOLUME+TICK_FLAG_BUY)  { bufferBUY[0] +=curTick.volume_real;  }
    else if (curTick.flags == TICK_FLAG_LAST+TICK_FLAG_VOLUME+TICK_FLAG_SELL) { bufferSELL[0] -=curTick.volume_real; }
Flavio Jarabeck
6707
Flavio Jarabeck  

I'm still trying to find why on earth I'm receving a ZERO flag (with real volume and price) as a valid tick...

;)

To add comments, please log in or register