Short Percent
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © barnabygraham
//@version=5
indicator("Short Percent")
setting=input.string('Percent of float held short',title='Choice',options=['Percent of float held short','Percent of volume short'])
shs_out = request.financial(syminfo.tickerid, 'TOTAL_SHARES_OUTSTANDING', 'FQ')
quandl_ticker = 'QUANDL:FINRA/FNSQ_' + str.replace_all(syminfo.ticker, '.', '_')
shortFloat = (request.security(quandl_ticker, 'D', close))*10
shortFloatPercent=(shortFloat/(shs_out/100))
shortVol = request.security(str.tostring(syminfo.ticker) + "_SHORT_VOLUME", 'D', close)
dailyVol = request.security(syminfo.tickerid, 'D', volume)
shortVolumePercent=((shortVol/(dailyVol/100)))
Final=setting=='Percent of float held short'?math.round(shortFloatPercent,2):math.round(shortVolumePercent,2)
if barstate.isrealtime
    Final:=Final[1]
plot(Final)