如何在 pinescript 中参考之前的入场价格?

how to refer to previous entry price in pinescript?

我想在pine中写一个脚本,其中我的空头入场条件与我之前的多头入场价格相关,我该怎么做?例如,当价格触及时做空入场(1.1*之前的多头入场价格) 到目前为止,我发现我可以通过 "close[]" 参考之前的蜡烛价格,但找不到参考之前的多头入场价格的方法。

在下面的示例中,我不知道用什么代替 ?作为之前多头条件价格的参考。

longCondition = crossover(sma(close, 14), sma(close, 28))
if (longCondition)
    strategy.entry("buy", strategy.long)

shortCondition = close >= 1.1 * ?
if (shortCondition)
    strategy.exit("sell", strategy.short)

strategy.position_avg_price 为您提供多头和空头条目的平均价格

strategy.long / strategy.short 为您提供多头或空头条目的价格