LoopParticipant
Senior
Dear All,
I found this indicator (Shinoara Ratio) for Tradingview and I was wondering if you could transform it in prt code:
https://www.tradingview.com/script/WqDQjQmB/
Thanks a lot in advance
Loop
// @version=2
study("Shinohara Ratio")
len = input(title="Length", type=integer, defval=14)
line1 = input(title="Line 1", type=integer, defval=50)
line2 = input(title="Line 2", type=integer, defval=100)
line3 = input(title="Line 3", type=integer, defval=150)
line4 = input(title="Line 4", type=integer, defval=80)
line5 = input(title="Line 5", type=integer, defval=120)
A_bull = sum(high, len) - sum(open, len)
A_bear = sum(open, len) - sum(low, len)
B_bull = sum(high, len) - sum(close[1], len)
B_bear = sum(close[1], len) - sum(low, len)
A_ratio = 100 * A_bull/A_bear
B_ratio = 100 * B_bull/B_bear
plot(A_ratio, color=blue, title="A Ratio")
plot(B_ratio, color=red, title="B Ratio")
hline(line1, color=red, linestyle=solid)
hline(line2, color=black, linestyle=solid)
hline(line3, color=blue, linestyle=solid)
hline(line4, color=green, linestyle=solid)
hline(line5, color=green, linestyle=solid)
4th times you asked for a code conversion and you still don’t follow the rules to ask for it. Please add a description and provide some screenshots.
LoopParticipant
Senior
Dear Nicolas,
sorry for messing up the rules of the forum, which is always excellent thanks to your hard work.
I try to remedy here. This indicator description from google is the following: “Shinohara Intensity Ratio indicator can be used to analyze between the strength of the stock of strong ratio and popularity of weak ratio. The strong ratio means that Strong Energy Level Ratio and weak ratio means that Strong Energy Level, Weak Popularity Ratio. However, this is a lesser-known study and should be used only with a combination of other technical indicators.” To be honest I don’t finf this explanation very meaningful.
I found this indicator interesting because it reminds me something already published on prorealcode website which I used with some success:
Trend Force
I attached also a screenshot of the indicator from Yahoo Finance website, in which the indicator was set on 50 periods.
Apologies again
Best regards
Loop
Here is the code translated with the formula you posted, but it doesn’t seem to be the same being used in the screenshot you provided.
len = 50 //length
Abull = summation[len](high) - summation[len](open)
Abear = summation[len](open) - summation[len](low)
Bbull = summation[len](high) - summation[len](close[1])
Bbear = summation[len](close[1]) - summation[len](low)
Aratio = 100 * Abull/Abear
Bratio = 100 * Bbull/Bbear
return Aratio coloured(0,0,255), Bratio coloured(255,0,0)
LoopParticipant
Senior
Thank you Nicolas for your prompt reply.
Indeed it looks very different from the outcome of the attached picture.
Even doing some Google search I can’t find the code. I think it’s a bit strange since this indicator is among the pre-defined indicators of Yahoo Finance therefore it shouldn’t be too exotic.
Never mind, if anyone in the community has ever heard about it please feel free to add some comments.
Thanks again
Cheers
Loop