简体   繁体   中英

Pinescript: Paint the price of crossover candle

I plan to take a long entry for a Crossover and wanted to find out

  1. how to paint the closing price of the crossover on the chart?

  2. Find out what would be the highest price of the last 10 candles when the crossover occurs?

Below function gives me the entry.

src = input(close, title="Source")
offset = input(title="Offset", type=input.integer, defval=0, minval=-500, maxval=500)
out1 = ema(src, len1)
out2 = ema(src, len2)
out3 = ema(src, len3)
Long_TP1 = crossover(out1,out3)
//@version=4
study(title="Help (Price Cross)", overlay=true)
len1 = input(defval=5,    title="Length 1")
len2 = input(defval=13,   title="Length 2")
len3 = input(defval=19,   title="Length 3")
src = input(close, title="Source")
offset = input(title="Offset", type=input.integer, defval=0, minval=-500, maxval=500)

out1 = ema(src, len1)
out2 = ema(src, len2)
out3 = ema(src, len3)
Long_TP1 = crossover(out1, out3)

var price_cr =0.0
var high10 = 0.0
hitemp = highest(high, 10)

if Long_TP1
    price_cr := close
    high10 := hitemp

plot(price_cr, color=color.blue)  
plot(high10, color=color.red) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM