AusBitBank

@ausbitbank 's experimSteemUSD + SBDUSD multi-exchange indicator

107 visningar
8
107 0
Please see source code for basic instruction on usage
Send your appreciation / feedback to https://steemit.com/@ausbitbank
Ta bort från favoritskript Lägg till som favoritskript
//@version=2
// SteemUSD + SBDUSD multi-exchange experimental indicator
// https://steemit.com/@ausbitbank
// Work in progress - Please send any feedback you have :)
study(title = "SteemUSD + SBDUSD multi-exchange indicator", shorttitle = "SteemUSD + SBDUSD multi-exchange indicator", overlay = false)

// Get user input on display preferences
displaysbd=input(title="Display SBD",type=bool,defval=true)
displaysteem=input(title="Display SteemUSD",type=bool,defval=true)
displayweeksteemavg=input(title="Display 1 week SteemUSD avg",type=bool,defval=true)
displayhalfweeksteemavg=input(title="Display half week SteemUSD avg",type=bool,defval=true)
displayexperimental=input(title="Display polosdbpeg*weeklyavgsteemusd [experiment]",type=bool,defval=true)

// Define all the BTC exchanges that matter
bitfinexbtcusd = security("BITFINEX:BTCUSD",period, close)
okcoinfutures3mbtcusd = security("OKCOIN:BTCUSD3M",period,high)
okcoinfutures1wbtcusd = security("OKCOIN:BTCUSD1W",period,close)
okcoinfutures2wbtcusd = security("OKCOIN:BTCUSD2W",period,close)
bitstampbtcusd = security("BITSTAMP:BTCUSD",period,close)
okcoincnyconvertedtobtcusd = security("OKCOIN:BTCCNY*CNYUSD",period,close)
btcebtcusd = security("BTCE:BTCUSD",period,low)

// Work out the average btc price
btctmptotal = bitfinexbtcusd+okcoinfutures3mbtcusd+okcoinfutures2wbtcusd+okcoinfutures1wbtcusd+bitstampbtcusd+okcoincnyconvertedtobtcusd+btcebtcusd
avgbtcusd = btctmptotal/7


// Define all the poloniex steem/sbd instruments - Tradingview needs to add bittrex..
polosteembtc = security("POLONIEX:STEEMBTC",period,close)
polosbdbtc = security("POLONIEX:SBDBTC",period, close)
polosbdpeg = (polosbdbtc*avgbtcusd)
// Not currently used but maybe handy for someone
//poloethbtc = security("POLONIEX:ETHBTC",period,close)
//poloethusd = (poloethbtc*avgbtcusd)
//poloetcbtc = security("POLONIEX:ETCBTC",period,close)
//poloetcusd = (poloetcbtc*avgbtcusd)

// Calculate the various possible SteemUSD rates
steemusdavg = (polosteembtc*avgbtcusd)
steemusd1 = (polosteembtc*bitfinexbtcusd)
steemusd2 = (polosteembtc*okcoinfutures3mbtcusd)
steemusd3 = (polosteembtc*okcoinfutures1wbtcusd)
steemusd4 = (polosteembtc*okcoinfutures2wbtcusd)
steemusd5 = (polosteembtc*bitstampbtcusd)
steemusd6 = (polosteembtc*okcoincnyconvertedtobtcusd)
steemusd7 = (polosteembtc*btcebtcusd)

//Color SteemUSD price + SBD average based on SBD's current usd value.
plotcolor = if polosbdpeg<1
    if polosbdpeg<0.9
        if polosbdpeg<0.8
            red
        else
            orange
    else
        yellow
else
    green

// Get user input on how many periods = 1 week   - Need to work this out automatically if possible
//1weekhowmanyperiods=input(title="How many of the current period does it take to make 1 week - Default period is 1hr so 168 hrs is 1 week",type=integer,defval=168,minval=1,maxval=1000)

// Calculate average USD price of steem for last 7 days (168hrs)
weeklyavgperiods = 168
weeklyavgsteemusd = ema(steemusdavg,weeklyavgperiods)
// Half week EMA for detecting trend change
halfweeklyavgsteemusd = ema(steemusdavg,(weeklyavgperiods/2))

//Color SteemUSD weekly avg price : green = sell SBD , red = sell Steem (in theory, at the right price)
// If orange, take caution when using the delayed 1 week conversion process - Trend may be changing
plotcolor2 = if weeklyavgsteemusd>=halfweeklyavgsteemusd
    if steemusdavg<=halfweeklyavgsteemusd
        red
    else
        orange
else
    green
    
// Plots SteemUSD with all of the different btc prices + avg
// Usual highest and lowest btc exchanges are marked aqua - other exchanges straying from these borders on higher timeframe could indicate a disturbance in the force 
plot(displaysteem and steemusd1 ? steemusd1 : na,color=plotcolor,linewidth=1,title="SteemUSD based on BitFinex")
p1 = plot(displaysteem and steemusd2 ? steemusd2 : na,color=aqua,linewidth=1,title="SteemUSD based on OKCoin 3 Month futures") // OKCoin 3 month futures would *normally* be highest price
plot(displaysteem and steemusd3 ? steemusd3 : na,color=plotcolor,linewidth=1,title="SteemUSD based on OKCoin 1 Week futures")
plot(displaysteem and steemusd4 ? steemusd4 : na,color=plotcolor,linewidth=1,title="SteemUSD based on OKCOIN 2 Week futures")
plot(displaysteem and steemusd5 ? steemusd5 : na,color=plotcolor,linewidth=1,title="SteemUSD based on Bitstamp")
plot(displaysteem and steemusd6 ? steemusd6 : na,color=plotcolor,linewidth=1,title="SteemUSD based on OKCoin CNY converted to USD")
p2 = plot(displaysteem and steemusd7 ? steemusd7 : na,color=aqua,linewidth=1,title="SteemUSD based on BTCE") // BTCE would *normally* be lowest price
plot(displaysteem and steemusdavg ? steemusdavg : na,color=plotcolor2,linewidth=1,style=cross,title="SteemUSD based on average BTC price")

// Fill in the background between usual highest and usual lowest price range - helps highlight outliers
fill(p1,p2,color=plotcolor)

// Plot SDB price

plot(displaysbd and polosbdpeg ? polosbdpeg : na,color=plotcolor,linewidth=2,title="Poloniex current sbd peg value")

// Markers for various SDB price points
//h1 = hline(1.1)
//h2 = hline(1)
//h3 = hline(0.9)
//h4 = hline(0.8)
//h5 = hline(0.7)
// Highlight background for SDB price points 
//fill(h2,h3,color=yellow)
//fill(h3,h4,color=orange)
//fill(h4,h5,color=red)
//fill(h2,h1,color=green)

//1 SBD is convertable for $1usd worth of steem (based on 7 day avg, 7 days from triggering)
// Plot the weekly average steemusd price
plot(displayweeksteemavg and weeklyavgsteemusd ? weeklyavgsteemusd : na,color=plotcolor2,linewidth=2)
// Plot the half-weekly average steemusd price
plot(displayhalfweeksteemavg and halfweeklyavgsteemusd ? halfweeklyavgsteemusd : na,color=plotcolor2,linewidth=1)

// Experimental
experimental=(polosbdpeg*weeklyavgsteemusd)
plot(displayexperimental and experimental ? experimental : na,color=white,linewidth=1)
Hem Aktie-screener Forex-screener Krypto-screener Ekonomisk kalender Hur det fungerar Diagramfunktioner Priser Ordningsregler Moderatorer Webbsidor och mäklarlösningar Widgets Diagramlösningar Få hjälp Funktionsförfrågan Blogg och nyheter Frågor och svar Wiki Twitter
Profil Profilinställningar Konto och fakturering Få hjälp Publicerade idéer Följare Följer Privata meddelanden Chatt Logga ut