回测交易类开发:点差计算及止盈止损点差应用疑问
回测交易类开发:点差运作逻辑与止盈止损计算疑问
点差核心逻辑疑问
- 当买入价为1.06649时,点差如何发挥作用?
- 同一笔交易中,设置止盈离场时会在哪个价位平仓?
- 点差在止损操作中的作用机制是什么?
当前止盈止损计算代码
我目前使用以下Python代码计算止盈止损,但不确定点差的处理是否正确:
def calculate_take_profit_buy(self, current_price, point_value, take_profit_points, spread): return current_price + (take_profit_points * point_value) def calculate_stop_loss_buy(self, current_price, point_value, stop_loss_points, spread): return current_price - (stop_loss_points * point_value) def calculate_take_profit_sell(self, current_price, point_value, take_profit_points, spread): return current_price - (take_profit_points * point_value) def calculate_stop_loss_sell(self, current_price, point_value, stop_loss_points, spread): return current_price + (stop_loss_points * point_value)
额外疑问与数据处理需求
- 曾在2006年的论坛看到说法:买入入场时需加点差,卖出离场时需加点差,但不确定该规则当前是否仍然适用。
- 我的CSV文件中每行仅包含单个点差数据,请问该如何计算入场和离场时的点差相关数据?
内容的提问来源于stack exchange,提问作者fcnealvillangca
相关产品推荐
相关产品推荐

