Question about Sterling Auto stop

Discussion in 'Automated Trading' started by stockboy201, May 8, 2011.

  1. Is it possible in sterling to say create an auto stop based on the amount you got filled at? Say you short symbol ABC at $10 and want it to create a stop at 1% above the fill price. Can this only be done using excel and vb, or is there a much simpler solution? Thanks
     
  2. here is how to do this in tradelink...

    tradelink is 100% free and open source.

    works with sterling and 15+ other brokers and feeds.

    Code:
    
    public class MyResponse : ResponseTemplate
    {
       OffsetTracker ot = new OffsetTracker();
    
       void GotTick(Tick k)
       {
            ot.newTick(k);
        }
      void Reset()
       {
            // read in symbols
            Basket b = BasketImpl.FromFile("MYSYMBOLS.txt");
            // at startup disable profits and set stops to 1%
            foreach (Security sec in b)
               ot[sec.Symbol] = new OffsetInfo(0,BarListImpl.DayFromAny(symbol).RecentBar.Close*.01m,0,1,false,1);
            // subscribe to symbols
            sendbasket(b);
       }
    
       public MyResponse()
       {
             ot.SendOrderEvent+=new OrderDelegate(sendorder);
             ot.SendCancelEvent+=new LongDelegate(sendcancel);
       }
       void GotPosition(Position p)  
       {
           ot.Adjust(p);
       }
       void GotFill(Trade t)
       {
            ot.Adjust(t);
       }
    }
    
    google 'tradelink project' or tradelink.org
     
  3. thanks a bunch