TradingView
SimpleCryptoLife
27 Okt 2021 pukul 21.44

CandleEvaluation 

Bitcoin / TetherUSBinance

Deskripsi

Library "CandleEvaluation"
Contains functions to evaluate bullish and bearish, engulfing, and outsized candles. They are different from the built-in indicators from TradingView in that these functions don't evaluate classical patterns composed of multiple candles, and they reflect my own understanding of what is "bullish" and bearish", "engulfing", and "outsized".

isBullishBearishCandle()
Determines if the current candle is bullish or bearish according to the length of the wicks and the open and close.
int _barsBack How many bars back is the candle you want to evaluate. By default this is 0, i.e., the current bar.
returns Two values, true or false, for whether it's a bullish or bearish candle respectively.

isTripleBull()
Tells you whether a candle is a "Triple Bull" - that is, one which is bullish in three ways:
  • It closes higher than it opens
  • It closes higher than the body of the previous candle
  • The High is above the High of the previous candle.

int _barsBack How many bars back is the candle you want to evaluate. By default this is 0, i.e., the current bar.
returns True or false.

isTripleBear()
Tells you whether a candle is a "Triple Bear" - that is, one which is bearish in three ways:
  • It closes lower than it opens
  • It closes lower than the body of the previous candle
  • The Low is below the Low of the previous candle.

int _barsBack How many bars back is the candle you want to evaluate. By default this is 0, i.e., the current bar.
returns True or false.

isBigBody()
Tells you if the current candle has a larger than average body size.
int _length - The length of the sma to calculate the average
float _percent - The percentage of the average that the candle body has to be to count as "big". E.g. 100 means it has to be just larger than the average, 200 means it has to be twice as large.
returns True or false

isBullishEngulfing()
Tells you if the current candle is a bullish engulfing candle.
int _barsBack How many bars back is the candle you want to evaluate. By default this is 0, i.e., the current bar.
int _atrFraction The denominator for the ATR fraction, which is the small amount by which the open can be different from the previous close.
returns True or false

isBearishEngulfing()
Tells you if the current candle is a bearish engulfing candle.
int _barsBack How many bars back is the candle you want to evaluate. By default this is 0, i.e., the current bar.
int _atrFraction The denominator for the ATR fraction, which is the small amount by which the open can be different from the previous close.
returns True or false

Catatan Rilis

v2
Added alert conditions. Note that these are demo only, to show how such alerts would be implemented in your own script. As far as I know, you can't set alerts from libraries.

Catatan Rilis

v3

Added:
New function: f_wickSize() - A function to get the average size of upper and lower wicks over time. This can be more useful than the standard ATR in evaluating the spikiness of an asset or in calculating stops.
f_wickSize(_open, _high, _low, _close, _ohlc4, _length, _length2)
  Parameters:
    _open - The Open of the candle. Defaults to the Open on the chart timeframe. Included for HTF compatibility.
    _high - The High of the candle. Defaults to the High on the chart timeframe. Included for HTF compatibility.
    _low - The Low of the candle. Defaults to the Low on the chart timeframe. Included for HTF compatibility.
    _close - The Close of the candle. Defaults to the Close on the chart timeframe. Included for HTF compatibility.
    _ohlc4 - The OHLC4 of the candle. Defaults to the OHLC4 on the chart timeframe. Included for HTF compatibility.
    _length - The length for the RMA of wicks.
    _length2 - The length for the EMA of OHLC4.
Returns - Two floats for the absolute values of the average upper and lower candle wicks.

Catatan Rilis

v4
Fixed bug with history operator
Komentar
ukmpits
@SimpleCryptoLife Sir, how These Script could be convert to indicator? Thanks mate
SimpleCryptoLife
@ukmpits, You would create a new indicator, import the library, and call the function that you want. See tradingview.com/pine-script-docs/en/v5/concepts/Libraries.html
HALDRO
awesome work
SimpleCryptoLife
@HALDRO, Thank you!
JohnnySemedo
Hi @SimpleCryptoLife, thanks for putting together this amazing indicator, it has been really useful for me, although recently I'm having some issues with it
Don't know if it's a TradingView issue or the indicator's code was render ineffective after TV platform updates.
But I have experienced some issues with the Alerts functionality, don't know if it's just myself or every user is having the same issue, but I can't add any new alarms for this specific indicator, I'm able to clone existing ones to receive notifications from previously created alerts but cannot add new ones, can you please check if that's the case for you, and if it is, is there any solution that can be implemented in the code itself or will we have to report this issue to TradingView Resolution center. Thanks for your help and understanding
SimpleCryptoLife
Hi @JohnnySemedo, thanks for your comment. So it's important to note that this isn't an indicator. It's a library. You're supposed to call whichever functions you like from your own indicator script. The library includes demo code for each function just to show you how the calling could be done.
Now, I don't know if you're supposed to be able to set alerts from libraries directly. I tried it and I cannot set any alerts on this library. I doubt that TradingView Support would accept this as a bug though, since for one thing you're supposed to be calling these functions from another script, and for another, there are no alertcondition() functions defined in this library. So, there's really nothing particular to set an alert on.
If you do call a function from this library from another script, and you create an alertcondition in your script, and you can't set alerts on it, that would definitely be a bug. Hope this helps.
JohnnySemedo
Thanks for clarifying @SimpleCryptoLife, I know what you're saying.
Most of the scripts on tradingview don't have built-in alerts. But I still use simplified alerts regardless.

99% of the scripts here allow adding alert for plots, shapes, and that's what I do. Add alerts for these simple events, whenever the object/event shows up I get a notification.

I was able to do just that for this precise script, right now, I still receive notification from a previously added alarm, but that possibility simply vanished for this specific script, don't know why, now I can't add alarms to any other chart. But I'm in contact with TradingView's support to see if we can sort out this issue.

Thanks for clarifying on that alert function, I would do such connection with the script, but I'm not into pine programming. So I'll might just pay someone to customize and combine it with other indicators, so it fit my needs.

Thanks for sharing this valuable script 😀 keep up the good Work 👍
SimpleCryptoLife
@JohnnySemedo, I added specific alert conditions and it still doesn't allow setting of alerts. So it's probably intentional on TradingView's part.
JohnnySemedo
@SimpleCryptoLife, Thanks for the attempt, I've seen your efforts and appreciate it a lot 🙌
I don't fully understand the differences between libraries and indicators, but as far as I can understand, it's possible to use these libraries to create a custom indicator with proper alerts, right?

I am using this indicator as a trend continuation with T+ and T- or trend reversal with engulfing candles, it's very useful on my binary options trading system. I'll might just pay someone to code that custom indicator with alerts. Thanks for caring and sharing 😀👍
JohnnySemedo
@SimpleCryptoLife, Thanks for everything, anyway just found out a great replacement for this library, Volume Pressure Analysis has a similar function, but it's more accurate when it comes to trend continuation because it takes volume into consideration. While the engulfing candles can be replaced by Candlestick Pattern Identifier. Thank you for your efforts 😊
Lebih lanjut