SameExitFromOneEntryOnce

允许或禁止信号脚本使用一行出场语句,从相同的进场执行多次分批出场。

用法

[SameExitFromOneEntryOnce = LogicalValue]

参数说明: LogicalValue —— true/false值,True = 禁止分批出场;False = 允许分批出场。

注意

如果 SameExitFromOneEntryOnce 的参数在策略运行时改变,则自动交易停止。

范例

sellshort 15 Shares Next Bar At market;

If time = 1000 Then
Buytocover
5 Contracts Next Bar At entryprice - 10 stop;
If time = 1001 Then
Buytocover
5 Contracts Next Bar At entryprice - 10 stop;
If time = 1002 Then
Buytocover
5 Contracts Next Bar At entryprice - 10 stop;

使用SameExitFromOneEntryOnce,只写一个出场语句,减少了代码的冗余,效果相同:

sellshort 15 Shares Next Bar At market;

[SameExitFromOneEntryOnce = false];
If time >= 1000 Then
Buytocover
5 Contracts Next Bar At entryprice - 10 stop;