簡體   English   中英

Plot 圖表止損止盈,pinescript

[英]Plot stop loss and take profit on chart, pinescript

我已經定義了價格水平有辦法以該價格關閉交易,但我想直觀地顯示水平,只是為了直觀地驗證它們。 我是新手,找不到有關如何操作的幫助。 在其他來源上執行此操作。

如果您已經計算了價格,那么只需 plot。

這是strategy("", overlay=true)

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)

plot(long_tp_price , "TP", color.green, 2, plot.style_circles)
plot(long_sl_price , "SL", color.red, 2, plot.style_circles)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM