PINE LIBRARY
업데이트됨 TA

Library "TA"
General technical analysis functions
div_bull(pS, iS, cp_length_after, cp_length_before, pivot_length, lookback, no_broken, pW, iW, hidW, regW)
Test for bullish divergence
Parameters:
pS: Price series (float)
iS: Indicator series (float)
cp_length_after: Bars after current (divergent) pivot low to be considered a valid pivot (optional int)
cp_length_before: Bars before current (divergent) pivot low to be considered a valid pivot (optional int)
pivot_length: Bars before and after prior pivot low to be considered valid pivot (optional int)
lookback: Bars back to search for prior pivot low (optional int)
no_broken: Flag to only consider divergence valid if the pivot-to-pivot trendline is unbroken (optional bool)
pW: Weight of change in price, used in degree of divergence calculation (optional float)
iW: Weight of change in indicator, used in degree of divergence calculation (optional float)
hidW: Weight of hidden divergence, used in degree of divergence calculation (optional float)
regW: Weight of regular divergence, used in degree of divergence calculation (optional float)
Returns: [flag,degree,type,lx1,ly1,lx2,ly2]
flag = true if divergence exists (bool)
degree = degree (strength) of divergence (float)
type = 1 = regular, 2 = hidden (int)
lx1 = x coordinate 1 (int)
ly1 = y coordinate 1 (float)
lx2 = x coordinate 2 (int)
ly2 = y coordinate 2 (float)
div_bear(pS, iS, cp_length_after, cp_length_before, pivot_length, lookback, no_broken, pW, iW, hidW, regW)
Test for bearish divergence
Parameters:
pS: Price series (float)
iS: Indicator series (float)
cp_length_after: Bars after current (divergent) pivot high to be considered a valid pivot (optional int)
cp_length_before: Bars before current (divergent) pivot highto be considered a valid pivot (optional int)
pivot_length: Bars before and after prior pivot high to be considered valid pivot (optional int)
lookback: Bars back to search for prior pivot high (optional int)
no_broken: Flag to only consider divergence valid if the pivot-to-pivot trendline is unbroken (optional bool)
pW: Weight of change in price, used in degree of divergence calculation (optional float)
iW: Weight of change in indicator, used in degree of divergence calculation (optional float)
hidW: Weight of hidden divergence, used in degree of divergence calculation (optional float)
regW: Weight of regular divergence, used in degree of divergence calculation (optional float)
Returns: [flag,degree,type,lx1,ly1,lx2,ly2]
flag = true if divergence exists (bool)
degree = degree (strength) of divergence (float)
type = 1 = regular, 2 = hidden (int)
lx1 = x coordinate 1 (int)
ly1 = y coordinate 1 (float)
lx2 = x coordinate 2 (int)
ly2 = y coordinate 2 (float)
General technical analysis functions
div_bull(pS, iS, cp_length_after, cp_length_before, pivot_length, lookback, no_broken, pW, iW, hidW, regW)
Test for bullish divergence
Parameters:
pS: Price series (float)
iS: Indicator series (float)
cp_length_after: Bars after current (divergent) pivot low to be considered a valid pivot (optional int)
cp_length_before: Bars before current (divergent) pivot low to be considered a valid pivot (optional int)
pivot_length: Bars before and after prior pivot low to be considered valid pivot (optional int)
lookback: Bars back to search for prior pivot low (optional int)
no_broken: Flag to only consider divergence valid if the pivot-to-pivot trendline is unbroken (optional bool)
pW: Weight of change in price, used in degree of divergence calculation (optional float)
iW: Weight of change in indicator, used in degree of divergence calculation (optional float)
hidW: Weight of hidden divergence, used in degree of divergence calculation (optional float)
regW: Weight of regular divergence, used in degree of divergence calculation (optional float)
Returns: [flag,degree,type,lx1,ly1,lx2,ly2]
flag = true if divergence exists (bool)
degree = degree (strength) of divergence (float)
type = 1 = regular, 2 = hidden (int)
lx1 = x coordinate 1 (int)
ly1 = y coordinate 1 (float)
lx2 = x coordinate 2 (int)
ly2 = y coordinate 2 (float)
div_bear(pS, iS, cp_length_after, cp_length_before, pivot_length, lookback, no_broken, pW, iW, hidW, regW)
Test for bearish divergence
Parameters:
pS: Price series (float)
iS: Indicator series (float)
cp_length_after: Bars after current (divergent) pivot high to be considered a valid pivot (optional int)
cp_length_before: Bars before current (divergent) pivot highto be considered a valid pivot (optional int)
pivot_length: Bars before and after prior pivot high to be considered valid pivot (optional int)
lookback: Bars back to search for prior pivot high (optional int)
no_broken: Flag to only consider divergence valid if the pivot-to-pivot trendline is unbroken (optional bool)
pW: Weight of change in price, used in degree of divergence calculation (optional float)
iW: Weight of change in indicator, used in degree of divergence calculation (optional float)
hidW: Weight of hidden divergence, used in degree of divergence calculation (optional float)
regW: Weight of regular divergence, used in degree of divergence calculation (optional float)
Returns: [flag,degree,type,lx1,ly1,lx2,ly2]
flag = true if divergence exists (bool)
degree = degree (strength) of divergence (float)
type = 1 = regular, 2 = hidden (int)
lx1 = x coordinate 1 (int)
ly1 = y coordinate 1 (float)
lx2 = x coordinate 2 (int)
ly2 = y coordinate 2 (float)
릴리즈 노트
v2Return absolute value of degree to handle series with negative values.
릴리즈 노트
v3- Added support for lookback # of pivots for div_bull() and div_bear()
- Fixed divergence degree calculation when indicator series has negative values
- Changed default pivot lengths for div_bull() and div_bear()
Updated:
div_bull(pS, iS, cp_length_after, cp_length_before, pivot_length, lookback, lookback_pivs, no_broken, pW, iW, hidW, regW)
Test for bullish divergence
Parameters:
pS: Price series (float)
iS: Indicator series (float)
cp_length_after: Bars after current (divergent) pivot low to be considered a valid pivot (optional int)
cp_length_before: Bars before current (divergent) pivot low to be considered a valid pivot (optional int)
pivot_length: Bars before and after prior pivot low to be considered valid pivot (optional int)
lookback: Bars back to search for prior pivot low (optional int)
lookback_pivs: Pivots back to search for prior pivot low (optional int)
no_broken: Flag to only consider divergence valid if the pivot-to-pivot trendline is unbroken (optional bool)
pW: Weight of change in price, used in degree of divergence calculation (optional float)
iW: Weight of change in indicator, used in degree of divergence calculation (optional float)
hidW: Weight of hidden divergence, used in degree of divergence calculation (optional float)
regW: Weight of regular divergence, used in degree of divergence calculation (optional float)
Returns: [flag,degree,type,lx1,ly1,lx2,ly2]
flag = true if divergence exists (bool)
degree = degree (strength) of divergence (float)
type = 1 = regular, 2 = hidden (int)
lx1 = x coordinate 1 (int)
ly1 = y coordinate 1 (float)
lx2 = x coordinate 2 (int)
ly2 = y coordinate 2 (float)
div_bear(pS, iS, cp_length_after, cp_length_before, pivot_length, lookback, lookback_pivs, no_broken, pW, iW, hidW, regW)
Test for bearish divergence
Parameters:
pS: Price series (float)
iS: Indicator series (float)
cp_length_after: Bars after current (divergent) pivot high to be considered a valid pivot (optional int)
cp_length_before: Bars before current (divergent) pivot highto be considered a valid pivot (optional int)
pivot_length: Bars before and after prior pivot high to be considered valid pivot (optional int)
lookback: Bars back to search for prior pivot high (optional int)
lookback_pivs: Pivots back to search for prior pivot high (optional int)
no_broken: Flag to only consider divergence valid if the pivot-to-pivot trendline is unbroken (optional bool)
pW: Weight of change in price, used in degree of divergence calculation (optional float)
iW: Weight of change in indicator, used in degree of divergence calculation (optional float)
hidW: Weight of hidden divergence, used in degree of divergence calculation (optional float)
regW: Weight of regular divergence, used in degree of divergence calculation (optional float)
Returns: [flag,degree,type,lx1,ly1,lx2,ly2]
flag = true if divergence exists (bool)
degree = degree (strength) of divergence (float)
type = 1 = regular, 2 = hidden (int)
lx1 = x coordinate 1 (int)
ly1 = y coordinate 1 (float)
lx2 = x coordinate 2 (int)
ly2 = y coordinate 2 (float)
릴리즈 노트
v4Changed divergence strength/degree calculation to use the angle of the divergence line divided by 90 degrees (as opposed to the % change in the indicator value). This will keep the unweighted strength value between 0 and 1 for the indicator portion of the calculation, which is desirable because different indicator series can have wildly different ranges.
릴리즈 노트
v5Added chk_prev_bar flag as an argument to the divergence checks, which will check for divergence using the indicator value from the prior bar. This is necessary in some cases where the indicator is using a different price source than the one passed into the divergence function.
Updated:
div_bull(pS, iS, chk_prev_bar, cp_length_after, cp_length_before, pivot_length, lookback, lookback_pivs, no_broken, pW, iW, hidW, regW)
Test for bullish divergence
Parameters:
pS: Price series (float)
iS: Indicator series (float)
chk_prev_bar: Flag to check for divergence using the indicator value from the prior bar. This is necessary in some cases where the indicator is using a different price source than the one passed in pS.
cp_length_after: Bars after current (divergent) pivot low to be considered a valid pivot (optional int)
cp_length_before: Bars before current (divergent) pivot low to be considered a valid pivot (optional int)
pivot_length: Bars before and after prior pivot low to be considered valid pivot (optional int)
lookback: Bars back to search for prior pivot low (optional int)
lookback_pivs: Pivots back to search for prior pivot low (optional int)
no_broken: Flag to only consider divergence valid if the pivot-to-pivot trendline is unbroken (optional bool)
pW: Weight of change in price, used in degree of divergence calculation (optional float)
iW: Weight of change in indicator, used in degree of divergence calculation (optional float)
hidW: Weight of hidden divergence, used in degree of divergence calculation (optional float)
regW: Weight of regular divergence, used in degree of divergence calculation (optional float)
Returns: [flag,degree,type,lx1,ly1,lx2,ly2]
flag = true if divergence exists (bool)
degree = degree (strength) of divergence (float)
type = 1 = regular, 2 = hidden (int)
lx1 = x coordinate 1 (int)
ly1 = y coordinate 1 (float)
lx2 = x coordinate 2 (int)
ly2 = y coordinate 2 (float)
div_bear(pS, iS, chk_prev_bar, cp_length_after, cp_length_before, pivot_length, lookback, lookback_pivs, no_broken, pW, iW, hidW, regW)
Test for bearish divergence
Parameters:
pS: Price series (float)
iS: Indicator series (float)
chk_prev_bar: Flag to check for divergence using the indicator value from the prior bar. This is necessary in some cases where the indicator is using a different price source than the one passed in pS.
cp_length_after: Bars after current (divergent) pivot high to be considered a valid pivot (optional int)
cp_length_before: Bars before current (divergent) pivot highto be considered a valid pivot (optional int)
pivot_length: Bars before and after prior pivot high to be considered valid pivot (optional int)
lookback: Bars back to search for prior pivot high (optional int)
lookback_pivs: Pivots back to search for prior pivot high (optional int)
no_broken: Flag to only consider divergence valid if the pivot-to-pivot trendline is unbroken (optional bool)
pW: Weight of change in price, used in degree of divergence calculation (optional float)
iW: Weight of change in indicator, used in degree of divergence calculation (optional float)
hidW: Weight of hidden divergence, used in degree of divergence calculation (optional float)
regW: Weight of regular divergence, used in degree of divergence calculation (optional float)
Returns: [flag,degree,type,lx1,ly1,lx2,ly2]
flag = true if divergence exists (bool)
degree = degree (strength) of divergence (float)
type = 1 = regular, 2 = hidden (int)
lx1 = x coordinate 1 (int)
ly1 = y coordinate 1 (float)
lx2 = x coordinate 2 (int)
ly2 = y coordinate 2 (float)
릴리즈 노트
v6When calculating the divergence strength on an indicator, Scale the X coordinates to a range similar to the Y scale (X and Y scales should be on the same order of magnitude for the angle value to be meaningful. e.g. if ΔY is 10,000,000 and ΔX is 12, the angle will always be very nearly 90 degrees, which makes for a meaningless value)
릴리즈 노트
v7Adjusted multiplier in iDelta() to use the average Y value rather than the difference of the two Y values.
릴리즈 노트
v8Now calculating divergence strength in terms of the standard deviation.
= Δ price/StDev + Δ indicator/stDev (multiplied by specified weights)
릴리즈 노트
v9릴리즈 노트
v10Changes to check more thoroughly for pivots on indicator series.
Updated:
div_bull(pS, iS, cp_length_after, cp_length_before, pivot_length, lookback, lookback_pivs, no_broken, pW, iW, hidW, regW)
Test for bullish divergence
Parameters:
pS: Price series (float)
iS: Indicator series (float)
cp_length_after: Bars after current (divergent) pivot low to be considered a valid pivot (optional int)
cp_length_before: Bars before current (divergent) pivot low to be considered a valid pivot (optional int)
pivot_length: Bars before and after prior pivot low to be considered valid pivot (optional int)
lookback: Bars back to search for prior pivot low (optional int)
lookback_pivs: Pivots back to search for prior pivot low (optional int)
no_broken: Flag to only consider divergence valid if the pivot-to-pivot trendline is unbroken (optional bool)
pW: Weight of change in price, used in degree of divergence calculation (optional float)
iW: Weight of change in indicator, used in degree of divergence calculation (optional float)
hidW: Weight of hidden divergence, used in degree of divergence calculation (optional float)
regW: Weight of regular divergence, used in degree of divergence calculation (optional float)
Returns: [flag,degree,type,lx1,ly1,lx2,ly2]
flag = true if divergence exists (bool)
degree = degree (strength) of divergence (float)
type = 1 = regular, 2 = hidden (int)
lx1 = x coordinate 1 (int)
ly1 = y coordinate 1 (float)
lx2 = x coordinate 2 (int)
ly2 = y coordinate 2 (float)
div_bear(pS, iS, cp_length_after, cp_length_before, pivot_length, lookback, lookback_pivs, no_broken, pW, iW, hidW, regW)
Test for bearish divergence
Parameters:
pS: Price series (float)
iS: Indicator series (float)
cp_length_after: Bars after current (divergent) pivot high to be considered a valid pivot (optional int)
cp_length_before: Bars before current (divergent) pivot highto be considered a valid pivot (optional int)
pivot_length: Bars before and after prior pivot high to be considered valid pivot (optional int)
lookback: Bars back to search for prior pivot high (optional int)
lookback_pivs: Pivots back to search for prior pivot high (optional int)
no_broken: Flag to only consider divergence valid if the pivot-to-pivot trendline is unbroken (optional bool)
pW: Weight of change in price, used in degree of divergence calculation (optional float)
iW: Weight of change in indicator, used in degree of divergence calculation (optional float)
hidW: Weight of hidden divergence, used in degree of divergence calculation (optional float)
regW: Weight of regular divergence, used in degree of divergence calculation (optional float)
Returns: [flag,degree,type,lx1,ly1,lx2,ly2]
flag = true if divergence exists (bool)
degree = degree (strength) of divergence (float)
type = 1 = regular, 2 = hidden (int)
lx1 = x coordinate 1 (int)
ly1 = y coordinate 1 (float)
lx2 = x coordinate 2 (int)
ly2 = y coordinate 2 (float)
릴리즈 노트
v11div_bull() and div_bear() - adjusted indicator pivot checking to be more inclusive.
릴리즈 노트
v12Added function for validating harmonic XABCD patterns: harmonic_validate_xabcd()
Added:
harmonic_validate_xabcd(xX, xY, aX, aY, bX, bY, cX, cY, dX, dY, pErr, pAsym, pivot_length, gart, bat, bfly, crab)
Validate harmonic XABCD pattern
Parameters:
xX: X coordinate of point X (int)
xY: Y coordinate of point X (float)
aX: X coordinate of point A (int)
aY: Y coordinate of point A (float)
bX: X coordinate of point B (int)
bY: Y coordinate of point B (float)
cX: X coordinate of point C (int)
cY: Y coordinate of point C (float)
dX: X coordinate of point D (int)
dY: Y coordinate of point D (float)
pErr: Acceptable percent error of leg ratios (does not apply to legs defined within a range) (float)
pAsym: Acceptable percent asymmetry of leg ΔX (each leg tested against average ΔX of prior legs) (float)
pivot_length: Bars before and after prior pivot high to be considered valid pivot (optional int)
gart: Flag to validate Gartley pattern (bool)
bat: Flag to validate Bat pattern (bool)
bfly: Flag to validate Butterfly pattern (bool)
crab: Flag to validate Crab pattern (bool)
Returns: [flag,t1,t2,t3,t4]
flag = true if valid harmonic
t1 = true if valid gartley
t2 = true if valid bat
t3 = true if valid butterfly
t4 = true if valid crab
릴리즈 노트
v13Added pattern_xabcd() - determine if an XABCD pattern has just completed.
Added:
pattern_xabcd(x_is_low, pivot_length, source)
Determine if an XABCD pattern has just completed (i.e. point D is on the previous bar)
Parameters:
x_is_low: Flag to determine if point X is a low pivot, i.e. bullish pattern (bool, dft = true)
pivot_length: Number of bars before and after a valid pivot (int, dft = 5)
source: Source series (float, dft = na, will use high and low series)
Returns: [flag,xx,xy,ax,ay,bx,by,cx,cy,dx,dy]
flag = true if valid XABCD pattern completed on previous bar
xx = X coordinate of point X (int)
xy = Y coordinate of point X (float)
ax = X coordinate of point A (int)
ay = Y coordinate of point A (float)
bx = X coordinate of point B (int)
by = Y coordinate of point B (float)
cx = X coordinate of point C (int)
cy = Y coordinate of point C (float)
dx = X coordinate of point D (int)
dy = Y coordinate of point D (float)
릴리즈 노트
v14Added:
pat_xabcd(x_is_low, pivot_length, source)
Determine if an XABCD pattern has just completed (i.e. point D is on the previous bar)
Parameters:
x_is_low: Flag to determine if point X is a low pivot, i.e. bullish pattern (bool, dft = true)
pivot_length: Number of bars before and after a valid pivot (int, dft = 5)
source: Source series (float, dft = na, will use high and low series)
Returns: [flag,xx,xy,ax,ay,bx,by,cx,cy,dx,dy]
flag = true if valid XABCD pattern completed on previous bar
xx = X coordinate of point X (int)
xy = Y coordinate of point X (float)
ax = X coordinate of point A (int)
ay = Y coordinate of point A (float)
bx = X coordinate of point B (int)
by = Y coordinate of point B (float)
cx = X coordinate of point C (int)
cy = Y coordinate of point C (float)
dx = X coordinate of point D (int)
dy = Y coordinate of point D (float)
Removed:
pattern_xabcd(x_is_low, pivot_length, source)
Determine if an XABCD pattern has just completed (i.e. point D is on the previous bar)
릴리즈 노트
v15Fixed point D validation for harmonic XABCD pattern
릴리즈 노트
v16Fixed harmonic XABCD ΔX symmetry validation
릴리즈 노트
v17Added:
harmonic_xabcd_validate(xX, xY, aX, aY, bX, bY, cX, cY, dX, dY, pErr, pAsym, pivot_length, gart, bat, bfly, crab)
Validate harmonic XABCD pattern
Parameters:
xX: X coordinate of point X (int)
xY: Y coordinate of point X (float)
aX: X coordinate of point A (int)
aY: Y coordinate of point A (float)
bX: X coordinate of point B (int)
bY: Y coordinate of point B (float)
cX: X coordinate of point C (int)
cY: Y coordinate of point C (float)
dX: X coordinate of point D (int)
dY: Y coordinate of point D (float)
pErr: Acceptable percent error of leg ratios (does not apply to legs defined within a range) (float)
pAsym: Acceptable percent asymmetry of leg ΔX (each leg tested against average ΔX of prior legs) (float)
pivot_length: Bars before and after prior pivot high to be considered valid pivot (optional int)
gart: Flag to validate Gartley pattern (bool)
bat: Flag to validate Bat pattern (bool)
bfly: Flag to validate Butterfly pattern (bool)
crab: Flag to validate Crab pattern (bool)
Returns: [flag,t1,t2,t3,t4]
flag = true if valid harmonic
t1 = true if valid gartley
t2 = true if valid bat
t3 = true if valid butterfly
t4 = true if valid crab
harmonic_xabcd_prz(type, xY, aY, bY, cY)
Get the potential reversal zone (PRZ) levels of a harmonic XABCD pattern
Parameters:
type: Harmonic pattern type (int - 1 = Gartley, 2 = Bat, 3 = Butterfly, 4 = Crab)
xY: Y coordinate of point X (float)
aY: Y coordinate of point A (float)
bY: Y coordinate of point B (float)
cY: Y coordinate of point C (float)
Returns: [bc_u, bc_l, xa_u, xa_l]
bc_u = nearest BC retracement/extension level (nearest to point C)
bc_l = farthest BC retracement/extension level (nearest to point C)
xa_u = nearest XA retracement/extension level (or the only XA level, if applicable)
xa_l = farthest XA retracement/extension level (or na if not applicable)
Removed:
harmonic_validate_xabcd(xX, xY, aX, aY, bX, bY, cX, cY, dX, dY, pErr, pAsym, pivot_length, gart, bat, bfly, crab)
Validate harmonic XABCD pattern
릴리즈 노트
v18Fixed harmonic retracement validation
릴리즈 노트
v19Added:
harmonic_xabcd_validateIncomplete(xX, xY, aX, aY, bX, bY, cX, cY, pErr, pAsym, pivot_length, gart, bat, bfly, crab)
Validate the first 3 legs of a harmonic XABCD pattern
Parameters:
xX: X coordinate of point X (int)
xY: Y coordinate of point X (float)
aX: X coordinate of point A (int)
aY: Y coordinate of point A (float)
bX: X coordinate of point B (int)
bY: Y coordinate of point B (float)
cX: X coordinate of point C (int)
cY: Y coordinate of point C (float)
pErr: Acceptable percent error of leg ratios (does not apply to legs defined within a range) (float)
pAsym: Acceptable percent asymmetry of leg ΔX (each leg tested against average ΔX of prior legs) (float)
pivot_length: Bars before and after prior pivot high to be considered valid pivot (optional int)
gart: Flag to validate Gartley pattern (bool)
bat: Flag to validate Bat pattern (bool)
bfly: Flag to validate Butterfly pattern (bool)
crab: Flag to validate Crab pattern (bool)
Returns: [flag,t1,t2,t3,t4]
flag = true if valid harmonic
t1 = true if valid gartley
t2 = true if valid bat
t3 = true if valid butterfly
t4 = true if valid crab
릴리즈 노트
v20Fixed bug with pat_axbcd() algorithm, checking wrong pivot looking for point C in bearish patterns.
릴리즈 노트
v21Fixed bug in pat_xabcd() where intermediate low wasn't being detected between points C and D
릴리즈 노트
v22Added:
harmonic_xabcd_przClosest(l1, l2, l3, l4)
Get the confluent PRZ levels (i.e. the two closest PRZ levels)
Order of arguments does not matter
Parameters:
l1: level 1 (float)
l2: level 2 (float)
l3: level 3 (float)
l4: level 4 (optional, float)
Returns: [lL,lH]
lL = lower confluent PRZ level
lH = higher confluent PRZ level
릴리즈 노트
v23Added:
success(entry, stop, t1, t2)
Determine if trade is successful
Parameters:
entry: Entry bar index (int)
stop: Stop level (float)
t1: Target 1 level (float)
t2: Target 2 level (float)
Returns: [t1Hit,t2Hit,t1x,t1y,t2x,t2y]
릴리즈 노트
v24Added:
harmonic_xabcd_rAndE(type, l, l1, l2)
Get the ratio of two pattern legs, and the percent error from the theoretical harmonic ratio
Order of arguments does not matter
Parameters:
type: Harmonic pattern type (int - 1 = Gartley, 2 = Bat, 3 = Butterfly, 4 = Crab)
l: Leg ID ("xab", "abc", "bcd", or "xad") (string)
l1: Line 1 height (float)
l2: Line 2 height (float)
Returns: [r,e]
릴리즈 노트
v25Added:
harmonic_xabcd_przRange()
Get upper and lower PRZ levels
harmonic_xabcd_eD()
Measure closeness of D to either of the two closest PRZ levels, relative to height of the XA leg
przScore()
Measure the closeness of the two closest PRZ levels, relative to the height of the XA leg
harmonic_xabcd_eAvg()
Get the avg retracement ratio % error
harmonic_xabcd_targets()
Get target level
pat_xabcd_asym()
Get the avg asymmetry %
릴리즈 노트
v26Added:
harmonic_xabcd_przScore()
Measure the closeness of the two closest PRZ levels, relative to the height of the XA leg
Removed:
przScore()
Measure the closeness of the two closest PRZ levels, relative to the height of the XA leg
릴리즈 노트
v27Updated:
pat_xabcd(x_is_low, pivot_length, source, conf_length)
Determine if an XABCD pattern has just completed (i.e. point D is on the previous bar)
Parameters:
x_is_low: Flag to determine if point X is a low pivot, i.e. bullish pattern (bool, dft = true)
pivot_length: Number of bars before and after a valid pivot (int, dft = 5)
source: Source series (float, dft = na, will use high and low series)
conf_length: Number of trailing bars after pivot point D to confirm a valid pattern (int, dft = 1)
Returns: [flag,xx,xy,ax,ay,bx,by,cx,cy,dx,dy]
flag = true if valid XABCD pattern completed on previous bar
xx = X coordinate of point X (int)
xy = Y coordinate of point X (float)
ax = X coordinate of point A (int)
ay = Y coordinate of point A (float)
bx = X coordinate of point B (int)
by = Y coordinate of point B (float)
cx = X coordinate of point C (int)
cy = Y coordinate of point C (float)
dx = X coordinate of point D (int)
dy = Y coordinate of point D (float)
릴리즈 노트
v28릴리즈 노트
v29릴리즈 노트
v30Added:
harmonic_xabcd_score()
Get score values for a pattern
릴리즈 노트
v31Added Shark and Cypher XABCD patterns
Updated:
harmonic_xabcd_validate(xX, xY, aX, aY, bX, bY, cX, cY, dX, dY, pErr, pAsym, pivot_length, gart, bat, bfly, crab, shark, cyph)
Validate harmonic XABCD pattern
Parameters:
xX: X coordinate of point X (int)
xY: Y coordinate of point X (float)
aX: X coordinate of point A (int)
aY: Y coordinate of point A (float)
bX: X coordinate of point B (int)
bY: Y coordinate of point B (float)
cX: X coordinate of point C (int)
cY: Y coordinate of point C (float)
dX: X coordinate of point D (int)
dY: Y coordinate of point D (float)
pErr: Acceptable percent error of leg ratios (does not apply to legs defined within a range) (float)
pAsym: Acceptable percent asymmetry of leg ΔX (each leg tested against average ΔX of prior legs) (float)
pivot_length: Bars before and after prior pivot high to be considered valid pivot (optional int)
gart: Flag to validate Gartley pattern (bool)
bat: Flag to validate Bat pattern (bool)
bfly: Flag to validate Butterfly pattern (bool)
crab: Flag to validate Crab pattern (bool)
shark: Flag to validate Shark pattern (bool)
cyph: Flag to validate Cypher pattern (bool)
Returns: [flag,t1,t2,t3,t4,t5,t6]
flag = true if valid harmonic
t1 = true if valid gartley
t2 = true if valid bat
t3 = true if valid butterfly
t4 = true if valid crab
t5 = true if valid shark
t6 = true if valid cypher
harmonic_xabcd_validateIncomplete(xX, xY, aX, aY, bX, bY, cX, cY, pErr, pAsym, pivot_length, gart, bat, bfly, crab, shark, cyph)
Validate the first 3 legs of a harmonic XABCD pattern
Parameters:
xX: X coordinate of point X (int)
xY: Y coordinate of point X (float)
aX: X coordinate of point A (int)
aY: Y coordinate of point A (float)
bX: X coordinate of point B (int)
bY: Y coordinate of point B (float)
cX: X coordinate of point C (int)
cY: Y coordinate of point C (float)
pErr: Acceptable percent error of leg ratios (does not apply to legs defined within a range) (float)
pAsym: Acceptable percent asymmetry of leg ΔX (each leg tested against average ΔX of prior legs) (float)
pivot_length: Bars before and after prior pivot high to be considered valid pivot (optional int)
gart: Flag to validate Gartley pattern (bool)
bat: Flag to validate Bat pattern (bool)
bfly: Flag to validate Butterfly pattern (bool)
crab: Flag to validate Crab pattern (bool)
shark: Flag to validate Shark pattern (bool)
cyph: Flag to validate Cypher pattern (bool)
Returns: [flag,t1,t2,t3,t4]
flag = true if valid harmonic
t1 = true if valid gartley
t2 = true if valid bat
t3 = true if valid butterfly
t4 = true if valid crab
t5 = true if valid shark
t6 = true if valid cypher
릴리즈 노트
v32Updated:
harmonic_xabcd_przScore()
Measure the closeness of the two closest PRZ levels, relative to the height of the XA leg
릴리즈 노트
v33Added:
harmonic_xabcd_fibDispTxt()
Get fib ratio display text
릴리즈 노트
v34Added:
harmonic_xabcd_symbol()
Get pattern symbol
릴리즈 노트
v35Added:
harmonic_xabcd_scoreTot()
Get total weighted score value for a pattern
릴리즈 노트
v36Removed:
harmonic_xabcd_scoreTot()
Get total weighted score value for a pattern
harmonic_xabcd_fibDispTxt()
Get fib ratio display text
harmonic_xabcd_symbol()
Get pattern symbol
릴리즈 노트
v37Added:
harmonic_xabcd_scoreTot()
Get pattern's total weighted score
릴리즈 노트
v38Added:
harmonic_xabcd_fibDispTxt()
Get fib ratio display text
harmonic_xabcd_symbol()
Get pattern symbol
릴리즈 노트
v39릴리즈 노트
v40릴리즈 노트
v41릴리즈 노트
v42Added:
harmonic_xabcd_stop()
Get stop level
릴리즈 노트
v43Fixed bug with cypher validation of point D (retracement of XC, not XA)
릴리즈 노트
v44릴리즈 노트
v45Removed redundant "==true" comparisons
릴리즈 노트
v46Fixed bug with cypher PRZ level
릴리즈 노트
v47Added:
pat_xabcd_avgDev()
Get the average % deviation of an XABCD pattern
릴리즈 노트
v48릴리즈 노트
v49Testing
릴리즈 노트
v50Testing
릴리즈 노트
v51Added:
pat_xabcd_validate(xX, xY, aX, aY, bX, bY, cX, cY, dX, dY, pErr, pAsym)
Validate custom XABCD pattern
Parameters:
xX: X coordinate of point X (int)
xY: Y coordinate of point X (float)
aX: X coordinate of point A (int)
aY: Y coordinate of point A (float)
bX: X coordinate of point B (int)
bY: Y coordinate of point B (float)
cX: X coordinate of point C (int)
cY: Y coordinate of point C (float)
dX: X coordinate of point D (int)
dY: Y coordinate of point D (float)
pErr: Acceptable percent error of leg ratios (does not apply to legs defined within a range) (float)
pAsym: Acceptable percent asymmetry of leg ΔX (each leg tested against average ΔX of prior legs) (float)
Returns: TRUE if pattern is valid
pat_xabcd_validateIncomplete(xX, xY, aX, aY, bX, bY, cX, cY, pErr, pAsym)
Validate the first 3 legs of a custom XABCD pattern
Parameters:
xX: X coordinate of point X (int)
xY: Y coordinate of point X (float)
aX: X coordinate of point A (int)
aY: Y coordinate of point A (float)
bX: X coordinate of point B (int)
bY: Y coordinate of point B (float)
cX: X coordinate of point C (int)
cY: Y coordinate of point C (float)
pErr: Acceptable percent error of leg ratios (does not apply to legs defined within a range) (float)
pAsym: Acceptable percent asymmetry of leg ΔX (each leg tested against average ΔX of prior legs) (float)
Returns: TRUE if first 3 legs are valid
pat_xabcd_prz(xY, aY, bY, cY)
Get the potential reversal zone (PRZ) levels of a custom XABCD pattern
Parameters:
xY: Y coordinate of point X (float)
aY: Y coordinate of point A (float)
bY: Y coordinate of point B (float)
cY: Y coordinate of point C (float)
Returns: [xad_lvl,bcd_lvl,xcd_lvl]
릴리즈 노트
v52Updated:
harmonic_xabcd_eAvg()
Get the avg retracement ratio % error
릴리즈 노트
v53Fixed bug with success(), extra checks on entry bar
릴리즈 노트
v54Added:
tradeClosed()
Determine if Target or Stop was hit on the current bar
릴리즈 노트
v55Bug fix for closed trade check
릴리즈 노트
v56Bug fix for closed trade check
릴리즈 노트
v57Updated:
pat_xabcd(x_is_low, pivot_length, source, conf_length, incomplete)
Determine if an XABCD pattern has just completed (i.e. point D is on the previous bar)
Parameters:
x_is_low: Flag to determine if point X is a low pivot, i.e. bullish pattern (bool, dft = true)
pivot_length: Number of bars before and after a valid pivot (int, dft = 5)
source: Source series (float, dft = na, will use high and low series)
conf_length: Number of trailing bars after pivot point D to confirm a valid pattern (int, dft = 1)
incomplete: Flag to return an incomplete XABC pattern (bool, dft = false)
Returns: [flag,xx,xy,ax,ay,bx,by,cx,cy,dx,dy]
flag = true if valid XABCD pattern completed on previous bar
xx = X coordinate of point X (int)
xy = Y coordinate of point X (float)
ax = X coordinate of point A (int)
ay = Y coordinate of point A (float)
bx = X coordinate of point B (int)
by = Y coordinate of point B (float)
cx = X coordinate of point C (int)
cy = Y coordinate of point C (float)
dx = X coordinate of point D (int)
dy = Y coordinate of point D (float)
릴리즈 노트
v58Short circuit incomplete XABCD pattern search
릴리즈 노트
v59Updated:
harmonic_xabcd_przRange()
Get upper and lower PRZ levels
릴리즈 노트
v60Added:
harmonic_xabcd_entry()
릴리즈 노트
v61Added:
xabcd_entryHit()
Determine if entry level was reached. Assumes pattern is active/not timed out.
릴리즈 노트
v62Updated przClosest check to exclude values of 0 (only used when actual retracement value < 0)
릴리즈 노트
v63backed out last change
릴리즈 노트
v64test
릴리즈 노트
v65dont allow entry value < 0
릴리즈 노트
v66Updated to use latest version of Fib script (improved efficiency for precise fibs)
릴리즈 노트
v67test
Updated:
pat_xabcd(x_is_low, pivot_length, source, conf_length, incomplete)
Determine if an XABCD pattern has just completed (i.e. point D is on the previous bar)
Parameters:
x_is_low: Flag to determine if point X is a low pivot, i.e. bullish pattern (bool, dft = true)
pivot_length: Number of bars before and after a valid pivot (int, dft = 5)
source: Source series (float, dft = na, will use high and low series)
conf_length: Number of trailing bars after pivot point D to confirm a valid pattern (int, dft = 1)
incomplete: Flag to return an incomplete XABC pattern (bool, dft = false)
Returns: [flag,xx,xy,ax,ay,bx,by,cx,cy,dx,dy]
flag = true if valid XABCD pattern completed on previous bar
xx = X coordinate of point X (int)
xy = Y coordinate of point X (float)
ax = X coordinate of point A (int)
ay = Y coordinate of point A (float)
bx = X coordinate of point B (int)
by = Y coordinate of point B (float)
cx = X coordinate of point C (int)
cy = Y coordinate of point C (float)
dx = X coordinate of point D (int)
dy = Y coordinate of point D (float)
릴리즈 노트
v68Reverted test changes
Updated:
pat_xabcd(x_is_low, pivot_length, source, conf_length, incomplete)
Determine if an XABCD pattern has just completed (i.e. point D is on the previous bar)
Parameters:
x_is_low: Flag to determine if point X is a low pivot, i.e. bullish pattern (bool, dft = true)
pivot_length: Number of bars before and after a valid pivot (int, dft = 5)
source: Source series (float, dft = na, will use high and low series)
conf_length: Number of trailing bars after pivot point D to confirm a valid pattern (int, dft = 1)
incomplete: Flag to return an incomplete XABC pattern (bool, dft = false)
Returns: [flag,xx,xy,ax,ay,bx,by,cx,cy,dx,dy]
flag = true if valid XABCD pattern completed on previous bar
xx = X coordinate of point X (int)
xy = Y coordinate of point X (float)
ax = X coordinate of point A (int)
ay = Y coordinate of point A (float)
bx = X coordinate of point B (int)
by = Y coordinate of point B (float)
cx = X coordinate of point C (int)
cy = Y coordinate of point C (float)
dx = X coordinate of point D (int)
dy = Y coordinate of point D (float)
릴리즈 노트
v69Test allowing divergence checks with pivot length of 0
릴리즈 노트
v70Updated:
pat_xabcd(x_is_low, pivot_length, source, conf_length, incomplete, inc_skipC)
Determine if an XABCD pattern has just completed (i.e. point D is on the previous bar)
Parameters:
x_is_low: Flag to determine if point X is a low pivot, i.e. bullish pattern (bool, dft = true)
pivot_length: Number of bars before and after a valid pivot (int, dft = 5)
source: Source series (float, dft = na, will use high and low series)
conf_length: Number of trailing bars after pivot point D to confirm a valid pattern (int, dft = 1)
incomplete: Flag to return an incomplete XABC pattern (bool, dft = false)
inc_skipC: skip incomplete patterns whose point C is at or before this bar index (to avoid returning the same pattern on consecutive bars)
Returns: [flag,xx,xy,ax,ay,bx,by,cx,cy,dx,dy]
flag = true if valid XABCD pattern completed on previous bar
xx = X coordinate of point X (int)
xy = Y coordinate of point X (float)
ax = X coordinate of point A (int)
ay = Y coordinate of point A (float)
bx = X coordinate of point B (int)
by = Y coordinate of point B (float)
cx = X coordinate of point C (int)
cy = Y coordinate of point C (float)
dx = X coordinate of point D (int)
dy = Y coordinate of point D (float)
릴리즈 노트
v71릴리즈 노트
v72Updated:
pat_xabcd(x_is_low, pivot_length, source, conf_length, incomplete, inc_skipC)
Determine if an XABCD pattern has just completed (i.e. point D is on the previous bar)
Parameters:
x_is_low: Flag to determine if point X is a low pivot, i.e. bullish pattern (bool, dft = true)
pivot_length: Number of bars before and after a valid pivot (int, dft = 5)
source: Source series (float, dft = na, will use high and low series)
conf_length: Number of trailing bars after pivot point D to confirm a valid pattern (int, dft = 1)
incomplete: Flag to return an incomplete XABC pattern (bool, dft = false)
inc_skipC: skip incomplete patterns whose point C is at this bar index (to avoid returning the same pattern on consecutive bars)
Returns: [flag,xx,xy,ax,ay,bx,by,cx,cy,dx,dy]
flag = true if valid XABCD pattern completed on previous bar
xx = X coordinate of point X (int)
xy = Y coordinate of point X (float)
ax = X coordinate of point A (int)
ay = Y coordinate of point A (float)
bx = X coordinate of point B (int)
by = Y coordinate of point B (float)
cx = X coordinate of point C (int)
cy = Y coordinate of point C (float)
dx = X coordinate of point D (int)
dy = Y coordinate of point D (float)
릴리즈 노트
v73릴리즈 노트
v74릴리즈 노트
v75Updated:
pat_xabcd(x_is_low, pivot_length, source, conf_length, incomplete)
Determine if an XABCD pattern has just completed (i.e. point D is on the previous bar)
Parameters:
x_is_low: Flag to determine if point X is a low pivot, i.e. bullish pattern (bool, dft = true)
pivot_length: Number of bars before and after a valid pivot (int, dft = 5)
source: Source series (float, dft = na, will use high and low series)
conf_length: Number of trailing bars after pivot point D to confirm a valid pattern (int, dft = 1)
incomplete: Flag to return an incomplete XABC pattern (bool, dft = false)
Returns: [flag,xx,xy,ax,ay,bx,by,cx,cy,dx,dy]
flag = true if valid XABCD pattern completed on previous bar
xx = X coordinate of point X (int)
xy = Y coordinate of point X (float)
ax = X coordinate of point A (int)
ay = Y coordinate of point A (float)
bx = X coordinate of point B (int)
by = Y coordinate of point B (float)
cx = X coordinate of point C (int)
cy = Y coordinate of point C (float)
dx = X coordinate of point D (int)
dy = Y coordinate of point D (float)
릴리즈 노트
v76Updated:
tradeClosed(eX, eY, stop, t1h, t2h, t1, t2)
Determine if Target or Stop was hit on the current bar
Parameters:
eX
eY
stop
t1h
t2h
t1
t2
릴리즈 노트
v77Updated:
pat_xabcd(x_is_low, pivot_length, source, conf_length, incomplete)
Determine if an XABCD pattern has just completed (i.e. point D is on the previous bar)
Parameters:
x_is_low: Flag to determine if point X is a low pivot, i.e. bullish pattern (bool, dft = true)
pivot_length: Number of bars before and after a valid pivot (int, dft = 5)
source: Source series (float, dft = na, will use high and low series)
conf_length: Number of trailing bars after pivot point D to confirm a valid pattern (int, dft = 1)
incomplete: Flag to return an incomplete XABC pattern (bool, dft = false)
Returns: [flag, x, a, b, c, d]
flag = true if valid XABCD pattern completed on previous bar
x = point X
a = point A
b = point B
c = point C
d = point D
릴리즈 노트
v78test revert d.y to 0.0
릴리즈 노트
v79Reverted changes using point object for pat_xabcd()
Updated:
pat_xabcd(x_is_low, pivot_length, source, conf_length, incomplete)
Determine if an XABCD pattern has just completed (i.e. point D is on the previous bar)
Parameters:
x_is_low: Flag to determine if point X is a low pivot, i.e. bullish pattern (bool, dft = true)
pivot_length: Number of bars before and after a valid pivot (int, dft = 5)
source: Source series (float, dft = na, will use high and low series)
conf_length: Number of trailing bars after pivot point D to confirm a valid pattern (int, dft = 1)
incomplete: Flag to return an incomplete XABC pattern (bool, dft = false)
Returns: [flag,xx,xy,ax,ay,bx,by,cx,cy,dx,dy]
flag = true if valid XABCD pattern completed on previous bar
xx = X coordinate of point X (int)
xy = Y coordinate of point X (float)
ax = X coordinate of point A (int)
ay = Y coordinate of point A (float)
bx = X coordinate of point B (int)
by = Y coordinate of point B (float)
cx = X coordinate of point C (int)
cy = Y coordinate of point C (float)
dx = X coordinate of point D (int)
dy = Y coordinate of point D (float)
릴리즈 노트
v80Add stop flag to tradeClosed()
릴리즈 노트
v81Added:
test_cd(cd, bc, xa, xc, ad, pErr, p_types)
Validate CD leg of XABCD
Parameters:
cd
bc
xa
xc
ad
pErr
p_types
릴리즈 노트
v82Added:
pat_xabcdIncomplete(x_is_low, pivot_length, source, conf_length)
Determine if an XABCD pattern is in progress (point C was just confirmed)
Parameters:
x_is_low: Flag to determine if point X is a low pivot, i.e. bullish M pattern (bool, dft = true)
pivot_length: Number of bars before and after a valid pivot (int, dft = 5)
source: Source series (float, dft = na, will use high and low series)
conf_length: Number of trailing bars after pivot point D to confirm a valid pattern (int, dft = 1)
Returns: [flag,xx,xy,ax,ay,bx,by,cx,cy]
flag = true if valid XABC pattern completed on bar_index[conf_length]
xx = X coordinate of point X (int)
xy = Y coordinate of point X (float)
ax = X coordinate of point A (int)
ay = Y coordinate of point A (float)
bx = X coordinate of point B (int)
by = Y coordinate of point B (float)
cx = X coordinate of point C (int)
cy = Y coordinate of point C (float)
dx = X coordinate of point D (int)
dy = Y coordinate of point D (float)
릴리즈 노트
v83Added:
pat_xabcd_testSym(xax, abx, bcx, cdx, pAsym)
Validate ΔX symmetry of XABCD pattern
Parameters:
xax
abx
bcx
cdx
pAsym
릴리즈 노트
v84updated pat_xabcdIncomplete()
릴리즈 노트
v85pat_xabcdIncomplete() bug fix
파인 라이브러리
진정한 트레이딩뷰 정신에 따라 작성자는 이 파인 코드를 오픈 소스 라이브러리로 공개하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 건배! 이 라이브러리는 개인적으로 또는 다른 오픈 소스 출판물에서 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰의 적용을 받습니다.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
파인 라이브러리
진정한 트레이딩뷰 정신에 따라 작성자는 이 파인 코드를 오픈 소스 라이브러리로 공개하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 건배! 이 라이브러리는 개인적으로 또는 다른 오픈 소스 출판물에서 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰의 적용을 받습니다.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.