// 空头开仓 - 使用A函数
If(EntryShortSignal && Not OrderSent_Short)
{
Numeric EntryPriceShort;
If(OrderType == "限价单")
{
EntryPriceShort = Min(Open, DonchianLow) - Slippage * MinMove * PriceScale;
// 发送限价单
A_SendOrder(Enum_Sell, Enum_Entry, Lots, EntryPriceShort);
Commentary("发送空头限价开仓单,价格:" + Text(EntryPriceShort));
}
Else
{
EntryPriceShort = Close - Slippage * MinMove * PriceScale;
// 发送市价单
A_SendOrder(Enum_Sell, Enum_Entry, Lots, Close - Slippage * MinMove * PriceScale);
Commentary("发送空头市价开仓单");
}
MP_count = 1;
PriceA = EntryPriceShort;
EntryPrice = PriceA;
MaxProfit = 0;
stopLossPrice = PriceA + StopLossMulti * ATR0;
OrderSent_Short = True;
OrderSent_Long = False;
OrderBarCount = 0;
Commentary("空头开仓信号,手数:" + Text(Lots) +
",当前周期OTT方向:" + Text(dir0[1]) +
",RSI:" + Text(RSIVale[1]));
}
}
// 订单超时管理
OrderBarCount = OrderBarCount + 1;
If(OrderBarCount > 3)
{
If(OrderSent_Long)
{
OrderSent_Long = False;
Commentary("多头订单超时未成交,取消");
}
有回放功能可以测试
还没用过,我找找