Sterling simple API question

Discussion in 'Trading Software' started by WhiteOut56, Jan 1, 2011.

  1. On a time and sales window for sterling it's red for a downtick, and green for an uptick.

    Where do you get this info in the API?


    Thanks
     
  2. Did you read the technical documentation?

    Why not record two ticks in sequence? If the print at 9:30.000 was $10.00 and the tick/print at 9:30.100 is $10.01 then you know it is an uptick.

    = Current Tick - Last Tick

    Use IF statements:

    IF difference = positive then uptick
    IF difference = negative then downtick
     

  3. looking at the structSTIQuoteUpdate and I don't see what I need.

    Actually I wrote that wrong, I need to know if a print occured at the bid or the ask vs if it is an uptick or downtick.

    I was thinking this could be "TradeCondition" but this field always shows up at a zero

    Thanks
     
  4. here is how to do this in tradelink (which will work with sterling or any tradelink broker) :

    Code:
    using TradeLink.API;
    using TradeLink.Common;
    
    public class MyResponse : ResponseTemplate
    {
        TickTracker kt = new TickTracker();
        public override void GotTick(Tick k)
        {
              // track ticks
              kt.newTick(k);
              // wait until we have two trades
              if (!k.isTrade || kt[k.symbol].isTrade) return;
              // check for uptick/downtick
              if (k.trade > kt[k.symbol].trade)
                   senddebug("uptick at "+k.time);
              else if (k.trade < kt[k.symbol].trade)
                   senddebug("downtick at "+k.time);
        }
    }
    
    
    TradeLink is 100% free and open source and works with 12+ brokers.

    http://tradelink.googlecode.com
     
  5. but what if .10 is hit on the bid and the spread moves up then .11 is hit on the bid. This will show up as an uptick, but what I'm concerned about it what is hit on the bid what is hit on the ask
     
  6. here is the same thing incorporating bid and ask upticks/downticks :

    Code:
    using TradeLink.API;
    using TradeLink.Common;
    
    public class MyResponse : ResponseTemplate
    {
        TickTracker kt = new TickTracker();
        public override void GotTick(Tick k)
        {
              // track ticks
              kt.newTick(k);
              // wait until we have required data
              if (!k.isTrade || !kt.HasAll(k.symbol)) return;
              // check for bid uptick/downtick
              if ((k.trade==kt[k.symbol].bid) && (k.trade > kt[k.symbol].trade))
                   senddebug("hit bid uptick at "+k.time);
              else if ((k.trade==kt[k.symbol].bid) && (k.trade < kt[k.symbol].trade))
                   senddebug("hit bid downtick at "+k.time);
              else if ((k.trade==kt[k.symbol].ask) && (k.trade < kt[k.symbol].trade))
                   senddebug("takes offer downtick at "+k.time);
              else if ((k.trade==kt[k.symbol].ask) && (k.trade > kt[k.symbol].trade))
                   senddebug("takes offer uptick at "+k.time);
    
        }
    }
    
    
    http://tradelink.googlecode.com