Strategy.exit:在这种情况下,"points" 是什么? V5
Strategy.exit: What are "points" in this context? V5
手册中的示例:
strategy.exit("exit", "long", profit = 10, loss = 5) // generate full exit bracket (profit 10 points, loss 5 points per contract) from entry with name "long"
这些分数是百分比吗?因此,如果这个头寸价值 100 美元(开仓时),那么 profit = 10
点是 10% = 10 美元,所以我们以 110 美元的价格卖出头寸?
那些是pips。
A pip is the smallest price move that an exchange rate can make based
on forex market convention.
如果您想执行基于百分比的退出,您应该使用 limit
和 stop
参数。
in_long_tp_per = input.float(2.0, "Take profit %") * 0.01
in_long_sl_per = input.float(1.0, "Stop loss %") * 0.01
long_tp_price = strategy.position_avg_price * (1 + in_long_tp_per)
long_sl_price = strategy.position_avg_price * (1 - in_long_sl_per)
if (strategy.position_size > 0)
strategy.exit("exit", "long", limit = long_tp_price, stop = long_sl_price)
手册中的示例:
strategy.exit("exit", "long", profit = 10, loss = 5) // generate full exit bracket (profit 10 points, loss 5 points per contract) from entry with name "long"
这些分数是百分比吗?因此,如果这个头寸价值 100 美元(开仓时),那么 profit = 10
点是 10% = 10 美元,所以我们以 110 美元的价格卖出头寸?
那些是pips。
A pip is the smallest price move that an exchange rate can make based on forex market convention.
如果您想执行基于百分比的退出,您应该使用 limit
和 stop
参数。
in_long_tp_per = input.float(2.0, "Take profit %") * 0.01
in_long_sl_per = input.float(1.0, "Stop loss %") * 0.01
long_tp_price = strategy.position_avg_price * (1 + in_long_tp_per)
long_sl_price = strategy.position_avg_price * (1 - in_long_sl_per)
if (strategy.position_size > 0)
strategy.exit("exit", "long", limit = long_tp_price, stop = long_sl_price)