'Pinescript - Getting a value from an indicator and plotting it accordingly to a condition
folks! How are you all doing?
I'm trying to write my first indicator in pinescript indicator. I'm not a programmer (just a curious guy) trying to write something to share with community.
I had this idea to write a indicator that checks if RSI is above 50 on different time frames and plot an arrow up for each time frame: If on D chart it is above 50, plot an arrow up, allong with if 4H timeframe above 50, another arrow up and if 1H timeframe aboe 50, one more.
The same idea for EMAs: if price above 10 EMA on D time frame, an arrow, if price above 10 EMA on 4H chart another and if price above 10 EMA on 1H chart, one more.
The same if RSI is <50 and price bellow 10 EMA at these timeframes.
But i've got stuck.
This is what i'm able to write so far (after some time consulting the documentation):
indicator('Tendency And RSI Confluences', 'TRSIC', overlay=true)
len_rsi = input.int(defval=14, minval=1, title='Length')
src_rsi = input(defval=close, title='Source')
res_H = input.timeframe(title='High Time Frame', defval='D')
res_M = input.timeframe(title='Medium Time Frame', defval='4H')
res_S= input.timeframe(title='Short Time Frame', defval='1H')
Long_RSI_Value = request.security(syminfo.tickerid, res_H, ta.rsi(src_rsi, len_rsi))
Med_RSI_Value = request.security(syminfo.tickerid, res_M, ta.rsi(src_rsi, len_rsi))
Short_RSI_Value = request.security(syminfo.tickerid, res_S, ta.rsi(src_rsi, len_rsi))
if Long_RSI_Value > 50
And now i don't know what to do next :(
Is it possible to access the value from as a return of a indicator?
How can i plot this value plus an arrow with it?
I'm thinking in plot on chart some kind of table like:
| Timeframe | RSI Confluence | EMA Confluence |
|---|---|---|
| D | Arrow (UP green /DOWN red) - value | Arrow (UP green /DOWN red) - value |
| 4H | Arrow (UP green /DOWN red) - value | Arrow (UP green /DOWN red) - value |
| 1H | Arrow (UP green /DOWN red) - value | Arrow (UP green /DOWN red) - value |
I'm triyng to do it because with a simple look at the indicator, the "user" will know if is a good point to enter or not based on different parameters.
PS: i will NOT sell the indicator, it will be free :)
Please, can someone help? An thanks in advance!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
