Hi, Below listed is the logic where I am creating market order based on a signal but I am not sure how to get the market order reference id. Any help on this regard is much appreciated. Thx.
public void onSignal(OrderContext ctx, Object signal)
{
....
if (position <= 0 && signal == Signals.CROSS_ABOVE)
{
ctx.buy(qty); //Open Long Position
ctx.createLimitOrder(market_order_referenceid, Enums.OrderAction.BUY, Enums.TIF.GTC, position, qty, getTakeProfitPrice());
System.out.println("Position Size ********"+position);
}
}
public void onSignal(OrderContext ctx, Object signal)
{
....
if (position <= 0 && signal == Signals.CROSS_ABOVE)
{
ctx.buy(qty); //Open Long Position
ctx.createLimitOrder(market_order_referenceid, Enums.OrderAction.BUY, Enums.TIF.GTC, position, qty, getTakeProfitPrice());
System.out.println("Position Size ********"+position);
}
}