Saylor to Schiff Ratio
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © nickolassteel

//@version=5
indicator("Saylor/Schiff Ratio", overlay=false, max_bars_back=100, timeframe="W")


//Variables
BTC = request.security("BTCUSD", "W", close)
GOLD = request.security("GOLD", "W", close)
roc = ta.roc((BTC/GOLD), 4)
pivot = 0


// Calculation
bullish_cross = ta.crossover(roc, pivot)
bearish_cross = ta.crossunder(roc, pivot)


//Plot
plot(roc,title="Saylor/Schiff Ratio", color=color.gray)
hline(0,linewidth=2)


// Visual Alerts
plotshape(bullish_cross==1? bullish_cross : na, title="Buy Signal",location=location.absolute, color=color.green, size=size.tiny, text="Buy")
plotshape(bearish_cross==1? bearish_cross : na, title="Sell Signal",location=location.absolute, color=color.red, size=size.tiny, text="Sell")


// Condition Alerts
alertcondition(bullish_cross==1 ? bullish_cross : na, title="Buy Alert", message="Buy, {{close}}")
alertcondition(bearish_cross==1 ? bearish_cross :na, title="Sell Alert", message="Sell, {{close}}")

