If(BuySignal )
{
If(MarketPosition == -1 )
{
BuyToCover(1, Open);
}
If(MarketPosition == 0 )
{
Buy(1, Open);
EntryPrice = Open;
StopLossPrice = EntryPrice * (1 - StopLossPercent);
TakeProfitPrice = EntryPrice * (1 + TakeProfitPercent);
Commentary("止损:"+Text(StopLossPrice));
Commentary("止盈 " +Text(TakeProfitPrice));
Commentary("Open " +Text(Open));
}
}
//做空执行
If(SellSignal)
{
If(MarketPosition == 1 )
{
Sell(1, Open);
}
If(MarketPosition == 0 )
{
SellShort(1, Open);
EntryPrice = Open;
StopLossPrice = EntryPrice * (1 + StopLossPercent);
TakeProfitPrice = EntryPrice * (1 - TakeProfitPercent);
Commentary("卖出!评分: " + Text(FinalScore, 2) + " ML置信度: " + Text(ML_Confidence, 2));
}
}
图标出信号了,但交易延后了5分钟发单,代码也是写了在没有持仓的情况才开仓,但也出现了二次开仓的情况,是不是用A函数下单就能解决这个问题,还是别的

