miyako.pro

Broker Spread Overlay v2.1a

This is for displaying a price line showing the spread difference of brokers such as 1broker.com or trading212.com where price is different than actual price. It may also be used as an ask line or to provide an additional alternate chart.

Version 2.1:
- JPY pip correction
- Price Line
- Area
- Kagi, Does not work on Forex pairs!
- Western Bar
- Candlesticks
- Heikenashi
- Renko, ATR and Traditional
- Line Break

Version 2.1a
- Fixed Heikenashi Colors.

If you like this indicator and/or it has helped you to earn profits, please donate.
- PayPal: ma.spencer@gmx.com
- Bitcoin: 1foxypuyuoNp5n1LNCCCCmjZ4RAXntQ8X

Mã nguồn mở

Với tinh thần của TradingView, tác giả đã xuất bản tập lệnh theo mã nguồn mở, vì thế trader có thể dễ dàng hiểu và tùy chỉnh được. Bạn có thể sử dụng miễn phí, hoặc tùy chỉnh lại mã đã được cấp phép bởi Quy tắc Chung. Bạn có thể sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?
// Coded by: Matthew Spencer
// If you like this indicator and/or it has helped you to earn money, please donate.
// Paypal: ma.spencer@gmx.com
// Bitcoin: 1foxypuyuoNp5n1LNCCCCmjZ4RAXntQ8X
// "If I die in the land of the dead, will I be sent to the land of the dead again?"
study("Broker Spread Overlay v2.1", overlay=true)

// Settings
separator = input(defval="Spread", title="---", type=string)
oneSpread = input(defval=0.0002, type="float", title="Pips")
jpyToggle = input(type=bool, defval=false, title="JPY Pips")
separator1 = input(defval="Chart", title="---", type=string)
lineToggle = input(type=bool, defval=true, title="Show Price Line")
areaToggle = input(type=bool, defval=false, title="Area")
barToggle = input(type=bool, defval=false, title="Bar")
candleToggle = input(type=bool, defval=false, title="Candlesticks")
heikenashiToggle = input(type=bool, defval=false, title="Heikinashi")
renkoToggle = input(type=bool, defval=false, title="Renko")
renkoSize = input(defval=10, type="integer", title="Renko Size")
renkoType = input(type=bool, defval=false, title="Traditional Renko")
lbToggle = input(type=bool, defval=false, title="Line Break")
lbSize = input(defval=3, type="integer", title="Line Break Lines")
kagiToggle = input(type=bool, defval=false, title="Kagi")
kagiAmount = input(defval=1, type="integer", title="Kagi Reversal Amount")

// OHCL
oneOpen = open + (jpyToggle ? oneSpread * 100 : oneSpread)
oneHigh = high + (jpyToggle ? oneSpread * 100 : oneSpread)
oneLow = low + (jpyToggle ? oneSpread * 100 : oneSpread)
oneClose = close + (jpyToggle ? oneSpread * 100 : oneSpread)

// Heikenashi
heikenashiOpen = security(heikenashi(tickerid), period, open) + oneSpread
heikenashiHigh = security(heikenashi(tickerid), period, high) + oneSpread
heikenashiLow = security(heikenashi(tickerid), period, low) + oneSpread
heikenashiClose = security(heikenashi(tickerid), period, close) + oneSpread

// Renko
renkoOpen = security(renko(tickerid, "close", renkoType ? "Traditional" : "ATR", renkoSize), period, open)
renkoHigh = security(renko(tickerid, "close", renkoType ? "Traditional" : "ATR", renkoSize), period, high)
renkoLow = security(renko(tickerid, "close", renkoType ? "Traditional" : "ATR", renkoSize), period, low)
renkoClose = security(renko(tickerid, "close", renkoType ? "Traditional" : "ATR", renkoSize), period, close)

// Line Break
lbOpen = security(linebreak(tickerid, "close", lbSize), period, open)
lbHigh = security(linebreak(tickerid, "close", lbSize), period, high)
lbLow = security(linebreak(tickerid, "close", lbSize), period, low)
lbClose = security(linebreak(tickerid, "close", lbSize), period, close)

// Kagi (Note: Doesn't work with Forex pairs)
kagiClose = security(kagi(tickerid, "close", kagiAmount), period, close)

// Colors
linecolor = open < close ? green : red
linecolor2 = heikenashiOpen < heikenashiClose ? blue : maroon
renkocolor = renkoOpen < renkoClose ? teal : orange
lbcolor = lbOpen < lbClose ? teal : orange
pfcolor = lbOpen < lbClose ? black : red

// Plot Charts
plot(areaToggle ? oneClose:na, title="Area", color=teal, style=areabr, linewidth=2, trackprice=false, transp=75, editable=true)
plot(kagiToggle ? kagiClose:na, title="Kagi", color=black)
plotcandle(renkoToggle ? renkoOpen:na, renkoToggle ? renkoHigh:na, renkoToggle ? renkoLow:na, renkoToggle ? renkoClose:na , title='Renko', color = renkocolor, wickcolor=black)
plotcandle(lbToggle ? lbOpen:na, lbToggle ? lbHigh:na, lbToggle ? lbLow:na, lbToggle ? lbClose:na , title='Line Break', color = lbcolor, wickcolor=black)
plotbar(barToggle ? oneOpen:na, barToggle ? oneHigh:na, barToggle ? oneLow:na, barToggle ? oneClose:na , title='Bar', color = linecolor)
plotcandle(candleToggle ? oneOpen:na, candleToggle ? oneHigh:na, candleToggle ? oneLow:na, candleToggle ? oneClose:na , title='Candles', color = linecolor, wickcolor=black)
plotcandle(heikenashiToggle ? heikenashiOpen:na, heikenashiToggle ? heikenashiHigh:na, heikenashiToggle ? heikenashiLow:na, heikenashiToggle ? heikenashiClose:na , title='Heikenashi Candles', color = linecolor2, wickcolor=black)
plot(lineToggle ? oneClose:na, title="Price Line", color=linecolor, style=areabr, linewidth=2, trackprice=true, transp=100, editable=false)

Bình luận

Hi, seems that it won't compile any more. Also curious, do you get the spread for tarding212.com?
Phản hồi
miyako.pro Arthur_USD
@Arthur_USD, Likely Pine Script is too different now. I have school finals this week, once done I'm thinking of taking the time to relearn Pine and update my scripts. Trading212 was a 2 pip spread if I recall, like 1Broker. I haven't touched my demo from them since last year to say accurately any more.
Phản hồi
Arthur_USD miyako.pro
@miyako.pro, Not 100% sure but I think they adjust spreads based on news/volatility.
Phản hồi