为什么空头策略回报不是多头策略回报的倒数

时间:2021-04-07 05:02:43

标签: pine-script

所以我根据特定的 MACD 信号编写了一个代码,我将策略做多时给出 -31.92%,当做空时给出 -13%。 做多或做空的策略不应该给出 + 或 - 相同的回报吗? 例如,做多时 -13%,做空时 +13%。

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © georgysoyboy

//@version=4
strategy(title="and again", overlay=true, default_qty_type= strategy.percent_of_equity, default_qty_value= 100)

ema12= ema(close,12)
ema26= ema(close,26)
mac= ema12 - ema26
sig= ema(mac, 9)
his= mac-sig 

plot(sig, color=color.orange)
plot(mac, color=color.blue)
plot(his, color=color.green)

if (crossover(his,0) and mac<0 and sig<0)
    strategy.entry("-", strategy.short)
if (mac>0)
    strategy.close("-")

0 个答案:

没有答案