![](/img/trans.png)
[英]How do I combine 2 indicators into one set of 'buy' & 'sell' signals in Pine Editor on TradingView? (DeMark9 & MACD for example)
[英]How to plot arrows to show my buy and sell data points on TradingView using Pine Editor
我有一個從 python 生成的數據點列表(紀元時間,執行的交易價格),例如buy_orders = [[1626377856, 31004.32], [1626394565, 33041.95], [1626575616, 32218.59]]
,我想在交易中顯示這些數據查看為綠色的小箭頭。 有沒有辦法做到這一點? 使用 Pine Editor 我似乎找不到輸入自定義數據點的方法。
您可以將所有時間戳和價格保存在一個數組中。 然后,您可以將每個柱的時間與數組時間戳進行比較,並且可以在其中繪制介於兩者之間的時間。 下面的例子
//@version=5
indicator(title="Plot Trades",overlay=true)
var timestamps=array.new<int>()
var prices=array.new<float>()
array.push(timestamps,1626377856)
array.push(prices,31004.32)
array.push(timestamps,1626394565)
array.push(prices,33041.95)
array.push(timestamps,1626575616)
array.push(prices,32218.59)
plotIndex=-1
var prvtime=0
for i=0 to array.size(timestamps)-1
if time/1000>array.get(timestamps,i) and prvtime<array.get(timestamps,i)
plotIndex:=i
prvtime:=time/1000
plotshape(plotIndex>-1?array.get(prices,plotIndex):na,location=location.absolute,style=shape.xcross,size=size.normal)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.