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);
}
}