PINE LIBRARY
업데이트됨 AIUnifiedCore

Library "AIUnifiedCore"
Core signal engine for the AI Learning Trader Bot unified system.
This library contains reusable logic only. Inputs, plots, labels, strategy orders,
and alerts belong in the wrapper scripts that import this library.
clampFloat(value, minValue, maxValue)
Clamps a number between a minimum and maximum.
Parameters:
value (float): Number to clamp.
minValue (float): Minimum allowed value.
maxValue (float): Maximum allowed value.
Returns: Clamped value.
trendEngine(source, fastLen, midLen, slowLen)
Calculates the EMA/VWAP trend engine.
Parameters:
source (float): Source price.
fastLen (simple int): Fast EMA length.
midLen (simple int): Middle EMA length.
slowLen (simple int): Slow EMA length.
Returns: Fast EMA, middle EMA, slow EMA, VWAP, bullish trend, bearish trend.
momentumEngine(source, rsiLen)
Calculates RSI/MACD momentum engine.
Parameters:
source (float): Source price.
rsiLen (simple int): RSI length.
Returns: RSI, MACD line, MACD signal, MACD histogram, bullish momentum, bearish momentum.
volumeEngine(volumeLen)
Calculates volume confirmation.
Parameters:
volumeLen (simple int): Volume average length.
Returns: Volume average, high volume, bullish volume, bearish volume.
priceActionEngine(swingLen)
Calculates price action breakout and candle direction.
Parameters:
swingLen (simple int): Swing lookback length.
Returns: Swing high, swing low, bullish break, bearish break, bullish candle, bearish candle.
chopEngine(diLen, adxSmooth, minAdx, atrLen, minAtrPercent, minEmaSpreadPercent, votesNeeded, emaFast, emaSlow)
Calculates the chop/no-trade filter.
Parameters:
diLen (simple int): DMI DI length.
adxSmooth (simple int): ADX smoothing.
minAdx (float): Minimum ADX trend strength.
atrLen (simple int): ATR length.
minAtrPercent (float): Minimum ATR percent.
minEmaSpreadPercent (float): Minimum EMA spread percent.
votesNeeded (simple int): Number of chop votes needed.
emaFast (float): Fast EMA.
emaSlow (float): Slow EMA.
Returns: DI+, DI-, ADX, ATR, ATR percent, EMA spread percent, chop votes, chop market.
probabilityEngine(bullTrend, bearTrend, bullMomentum, bearMomentum, bullVolume, bearVolume, bullBreak, bearBreak, bullCandle, bearCandle, mtfLongOk, mtfShortOk)
Calculates long/short probability scores.
Parameters:
bullTrend (bool): Bullish trend.
bearTrend (bool): Bearish trend.
bullMomentum (bool): Bullish momentum.
bearMomentum (bool): Bearish momentum.
bullVolume (bool): Bullish volume.
bearVolume (bool): Bearish volume.
bullBreak (bool): Bullish breakout.
bearBreak (bool): Bearish breakout.
bullCandle (bool): Bullish candle.
bearCandle (bool): Bearish candle.
mtfLongOk (bool): Higher-timeframe long confirmation.
mtfShortOk (bool): Higher-timeframe short confirmation.
Returns: Long probability and short probability.
superEngine(emaFast, emaMid, rsiValue, macdHist)
Calculates premium super-aggressive pressure scores.
Parameters:
emaFast (float): Fast EMA.
emaMid (float): Middle EMA.
rsiValue (float): RSI value.
macdHist (float): MACD histogram.
Returns: Super long probability, super short probability.
likelyRevEngine(showSignals, aggression, minVotes, realtimeOnly, chopOk, cooldownUpOk, cooldownDownOk, longProbability, shortProbability, superLongProbability, superShortProbability, bullTrend, bearTrend, emaFast, rsiValue, macdHist, superSensitivity, minEntryProbability)
Calculates early likely reversal votes/signals.
Parameters:
showSignals (bool): Master toggle.
aggression (simple string): Aggression text: Balanced, Aggressive, or Hyper.
minVotes (simple int): Minimum votes.
realtimeOnly (bool): Only allow before candle closes.
chopOk (bool): Whether chop filter allows signal.
cooldownUpOk (bool)
cooldownDownOk (bool)
longProbability (float): Long probability.
shortProbability (float): Short probability.
superLongProbability (float): Super long probability.
superShortProbability (float): Super short probability.
bullTrend (bool): Bull trend.
bearTrend (bool): Bear trend.
emaFast (float): Fast EMA.
rsiValue (float): RSI value.
macdHist (float): MACD histogram.
superSensitivity (simple int): Super aggressive threshold.
minEntryProbability (simple int): Minimum entry probability.
Returns: Up votes, down votes, votes needed, likely rev up, likely rev down.
easyQuality(trendOk, momentumOk, mtfOk, volumeOk, breakOk, chopMarket, oppositeLikelyRev, probability)
Calculates Easy Mode trade quality score.
Parameters:
trendOk (bool): Trend agreement.
momentumOk (bool): Momentum agreement.
mtfOk (bool): Higher-timeframe agreement.
volumeOk (bool): Volume agreement.
breakOk (bool): Breakout agreement.
chopMarket (bool): No-trade/chop state.
oppositeLikelyRev (bool): Opposite likely reversal warning.
probability (float): Direction probability.
Returns: Easy Mode quality score.
actionCode(chopMarket, masterLong, masterShort, exitLong, exitShort, flipLong, flipShort, likelyRevUp, likelyRevDown)
Final unified action code.
Parameters:
chopMarket (bool): No-trade market.
masterLong (bool): Master long.
masterShort (bool): Master short.
exitLong (bool): Exit long.
exitShort (bool): Exit short.
flipLong (bool): Flip to long.
flipShort (bool): Flip to short.
likelyRevUp (bool): Likely reversal up.
likelyRevDown (bool): Likely reversal down.
Returns: Integer action code.
actionText(action)
Converts an action code into text.
Parameters:
action (int): Action code.
Returns: Action text.
trendText(bullTrend, bearTrend)
Converts trend states into text.
Parameters:
bullTrend (bool): Bull trend.
bearTrend (bool): Bear trend.
Returns: Trend text.
topStackPrice(highValue, atrValue, gapAtr, slot)
Returns stacked label price above the candle.
Parameters:
highValue (float): Candle high.
atrValue (float): ATR.
gapAtr (float): Gap in ATR multiples.
slot (int): Stack slot, starting at 1.
Returns: Label price.
bottomStackPrice(lowValue, atrValue, gapAtr, slot)
Returns stacked label price below the candle.
Parameters:
lowValue (float): Candle low.
atrValue (float): ATR.
gapAtr (float): Gap in ATR multiples.
slot (int): Stack slot, starting at 1.
Returns: Label price.
Core signal engine for the AI Learning Trader Bot unified system.
This library contains reusable logic only. Inputs, plots, labels, strategy orders,
and alerts belong in the wrapper scripts that import this library.
clampFloat(value, minValue, maxValue)
Clamps a number between a minimum and maximum.
Parameters:
value (float): Number to clamp.
minValue (float): Minimum allowed value.
maxValue (float): Maximum allowed value.
Returns: Clamped value.
trendEngine(source, fastLen, midLen, slowLen)
Calculates the EMA/VWAP trend engine.
Parameters:
source (float): Source price.
fastLen (simple int): Fast EMA length.
midLen (simple int): Middle EMA length.
slowLen (simple int): Slow EMA length.
Returns: Fast EMA, middle EMA, slow EMA, VWAP, bullish trend, bearish trend.
momentumEngine(source, rsiLen)
Calculates RSI/MACD momentum engine.
Parameters:
source (float): Source price.
rsiLen (simple int): RSI length.
Returns: RSI, MACD line, MACD signal, MACD histogram, bullish momentum, bearish momentum.
volumeEngine(volumeLen)
Calculates volume confirmation.
Parameters:
volumeLen (simple int): Volume average length.
Returns: Volume average, high volume, bullish volume, bearish volume.
priceActionEngine(swingLen)
Calculates price action breakout and candle direction.
Parameters:
swingLen (simple int): Swing lookback length.
Returns: Swing high, swing low, bullish break, bearish break, bullish candle, bearish candle.
chopEngine(diLen, adxSmooth, minAdx, atrLen, minAtrPercent, minEmaSpreadPercent, votesNeeded, emaFast, emaSlow)
Calculates the chop/no-trade filter.
Parameters:
diLen (simple int): DMI DI length.
adxSmooth (simple int): ADX smoothing.
minAdx (float): Minimum ADX trend strength.
atrLen (simple int): ATR length.
minAtrPercent (float): Minimum ATR percent.
minEmaSpreadPercent (float): Minimum EMA spread percent.
votesNeeded (simple int): Number of chop votes needed.
emaFast (float): Fast EMA.
emaSlow (float): Slow EMA.
Returns: DI+, DI-, ADX, ATR, ATR percent, EMA spread percent, chop votes, chop market.
probabilityEngine(bullTrend, bearTrend, bullMomentum, bearMomentum, bullVolume, bearVolume, bullBreak, bearBreak, bullCandle, bearCandle, mtfLongOk, mtfShortOk)
Calculates long/short probability scores.
Parameters:
bullTrend (bool): Bullish trend.
bearTrend (bool): Bearish trend.
bullMomentum (bool): Bullish momentum.
bearMomentum (bool): Bearish momentum.
bullVolume (bool): Bullish volume.
bearVolume (bool): Bearish volume.
bullBreak (bool): Bullish breakout.
bearBreak (bool): Bearish breakout.
bullCandle (bool): Bullish candle.
bearCandle (bool): Bearish candle.
mtfLongOk (bool): Higher-timeframe long confirmation.
mtfShortOk (bool): Higher-timeframe short confirmation.
Returns: Long probability and short probability.
superEngine(emaFast, emaMid, rsiValue, macdHist)
Calculates premium super-aggressive pressure scores.
Parameters:
emaFast (float): Fast EMA.
emaMid (float): Middle EMA.
rsiValue (float): RSI value.
macdHist (float): MACD histogram.
Returns: Super long probability, super short probability.
likelyRevEngine(showSignals, aggression, minVotes, realtimeOnly, chopOk, cooldownUpOk, cooldownDownOk, longProbability, shortProbability, superLongProbability, superShortProbability, bullTrend, bearTrend, emaFast, rsiValue, macdHist, superSensitivity, minEntryProbability)
Calculates early likely reversal votes/signals.
Parameters:
showSignals (bool): Master toggle.
aggression (simple string): Aggression text: Balanced, Aggressive, or Hyper.
minVotes (simple int): Minimum votes.
realtimeOnly (bool): Only allow before candle closes.
chopOk (bool): Whether chop filter allows signal.
cooldownUpOk (bool)
cooldownDownOk (bool)
longProbability (float): Long probability.
shortProbability (float): Short probability.
superLongProbability (float): Super long probability.
superShortProbability (float): Super short probability.
bullTrend (bool): Bull trend.
bearTrend (bool): Bear trend.
emaFast (float): Fast EMA.
rsiValue (float): RSI value.
macdHist (float): MACD histogram.
superSensitivity (simple int): Super aggressive threshold.
minEntryProbability (simple int): Minimum entry probability.
Returns: Up votes, down votes, votes needed, likely rev up, likely rev down.
easyQuality(trendOk, momentumOk, mtfOk, volumeOk, breakOk, chopMarket, oppositeLikelyRev, probability)
Calculates Easy Mode trade quality score.
Parameters:
trendOk (bool): Trend agreement.
momentumOk (bool): Momentum agreement.
mtfOk (bool): Higher-timeframe agreement.
volumeOk (bool): Volume agreement.
breakOk (bool): Breakout agreement.
chopMarket (bool): No-trade/chop state.
oppositeLikelyRev (bool): Opposite likely reversal warning.
probability (float): Direction probability.
Returns: Easy Mode quality score.
actionCode(chopMarket, masterLong, masterShort, exitLong, exitShort, flipLong, flipShort, likelyRevUp, likelyRevDown)
Final unified action code.
Parameters:
chopMarket (bool): No-trade market.
masterLong (bool): Master long.
masterShort (bool): Master short.
exitLong (bool): Exit long.
exitShort (bool): Exit short.
flipLong (bool): Flip to long.
flipShort (bool): Flip to short.
likelyRevUp (bool): Likely reversal up.
likelyRevDown (bool): Likely reversal down.
Returns: Integer action code.
actionText(action)
Converts an action code into text.
Parameters:
action (int): Action code.
Returns: Action text.
trendText(bullTrend, bearTrend)
Converts trend states into text.
Parameters:
bullTrend (bool): Bull trend.
bearTrend (bool): Bear trend.
Returns: Trend text.
topStackPrice(highValue, atrValue, gapAtr, slot)
Returns stacked label price above the candle.
Parameters:
highValue (float): Candle high.
atrValue (float): ATR.
gapAtr (float): Gap in ATR multiples.
slot (int): Stack slot, starting at 1.
Returns: Label price.
bottomStackPrice(lowValue, atrValue, gapAtr, slot)
Returns stacked label price below the candle.
Parameters:
lowValue (float): Candle low.
atrValue (float): ATR.
gapAtr (float): Gap in ATR multiples.
slot (int): Stack slot, starting at 1.
Returns: Label price.
릴리즈 노트
strategy("AI Learning Trader Bot Strategy
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.