所以我对松树很陌生,并试图绕着它转
我不知道如何获取我设置的多头订单的入场价格,所以我尝试了这个,但我得到了不正确的结果,我假设因为平均头寸价格在 longcond 为真时不断变化
strategy("wtf", overlay = true, initial_capital = 100)
ema50 = ema(close, 50)
ema200 = ema(close, 200)
plot(ema50)
plot(ema200)
TP = 0.0
SL = 0.0
longCond = (ema50 > ema200)
if (longCond)
strategy.entry("long", strategy.long)
TP := strategy.position_avg_price * 1.2
SL := strategy.position_avg_price * 0.8
strategy.exit("close", "long", limit = TP, stop = SL)```
how can I set an order and take the entry price to then set a limit and stop order for TP and SL