else if (Trade600B
&& Close[1] > Open[1]
&& High[0] > High[1]
//
&& High[0] > EMA600[0] && Close[0] < EMA600[0]
&& !(Open[1] > Low[1] && Close[0] > Low[1])
&& EMA600[0] > slowEMA[0] + DFor600B * TickSize)
{
entryOrder = SubmitOrderUnmanaged(0, OrderAction.SellShort, OrderType.Market, TradeSize, 0, 0, "", "BT");
return;
}
else if (DW89
&& (Close[1] < Open[1] && High[1] > Open[1])// previous bar bearish
&& (Close[0] < Open[0] && High[0] > Open[0]) // current bar bearish
&& High[1] > High[0] // and low of signal bar is lower then previous bar
&& High[0] > cEMA89[0] && Close[0] < cEMA89[0]
&& High[1] > cEMA89[1] && Close[1] < cEMA89[0]
&& slowEMA[0] < cEMA89[0] - DForDW89 * TickSize) // piercing through 34EMA
{
entryOrder = SubmitOrderUnmanaged(0, OrderAction.SellShort, OrderType.Market, TradeSize, 0, 0, "", "BT");
return;
}
---------- and in my order update I only have BT. How to properly add and tradck another name for lets say 600B to be 600B not BT.
protected override void OnOrderUpdate(Order order, double limitPrice, double stopPrice, int quantity, int filled, double averageFillPrice, OrderState orderState, DateTime time, ErrorCode error, string nativeError)
{
if (orderState == OrderState.Filled && order.Name == "BT" )
{
double ask = GetCurrentAsk();
double bid = GetCurrentBid();
string oco = Guid.NewGuid().ToString();
if (order.IsLong)
{
double tp = Instrument.MasterInstrument.RoundToTickSize(averag eFillPrice + ProfitTarget * TickSize);
if (ProfitTarget > 0 && tp.ApproxCompare(ask) > 0)
{
targetOrder = SubmitOrderUnmanaged(0, OrderAction.Sell, OrderType.Limit, filled, tp, 0, oco, "PT");
}
double sl = Instrument.MasterInstrument.RoundToTickSize(averag eFillPrice - StopLoss * TickSize);
if (StopLoss > 0 && sl.ApproxCompare(bid) < 0)
{
stopOrder = SubmitOrderUnmanaged(0, OrderAction.Sell, OrderType.StopMarket, filled, 0, sl, oco, "SL");
}
}
if (order.IsShort)
{
double tp = Instrument.MasterInstrument.RoundToTickSize(averag eFillPrice - ProfitTarget * TickSize);
if (ProfitTarget > 0 && tp.ApproxCompare(bid) < 0)
{
targetOrder = SubmitOrderUnmanaged(0, OrderAction.BuyToCover, OrderType.Limit, filled, tp, 0, oco, "PT");
}
double sl = Instrument.MasterInstrument.RoundToTickSize(averag eFillPrice + StopLoss * TickSize);
if (StopLoss > 0 && sl.ApproxCompare(ask) > 0)
{
stopOrder = SubmitOrderUnmanaged(0, OrderAction.BuyToCover, OrderType.StopMarket, filled, 0, sl, oco, "SL");
}
}
}
}
Thank you

Comment