예스스탁
예스스탁 답변
2025-07-11 10:27:29
안녕하세요
예스스탁입니다.
채우기는 수식안에서 설정이 되지 않습니다.
지표속성창의 차트표시탭에서 채우기 기능이용해 설정하셔야 합니다.
input : outlierThreshold(10),fastMovingAverageLength(50),slowMovingAverageLength(100);
var : priceMovementLiquidity(0),liquidityBoundary(0),i(0);
// Define liquidity based on volume and price movement
priceMovementLiquidity = volume / abs(close - open);
// Calculate the boundary for liquidity to identify outliers
liquidityBoundary = ema(priceMovementLiquidity, outlierThreshold) + std(priceMovementLiquidity, outlierThreshold);
// Initialize an array to store liquidity values when they cross the boundary
Array : liquidityValues[5](0);
var : fastEMA(0),slowEMA(0);
// Check if the liquidity crosses above the boundary and up-date the array
if CrossUp(priceMovementLiquidity, liquidityBoundary) Then
{
For i = 4 DownTo 1
{
liquidityValues[i] = liquidityValues[i-1];
}
liquidityValues[0] = close;
}
// Calculate the Exponential Moving Averages for the close price at the last liquidity crossover
fastEMA = ema(liquidityValues[0], fastMovingAverageLength);
slowEMA = ema(liquidityValues[0], slowMovingAverageLength);
// Plot the EMAs with dynamic coloring based on their crossover status
plot1(fastEMA,"fast", iff(fastEMA > slowEMA , Red,Green));
plot2(slowEMA,"slow", iff(fastEMA > slowEMA , Red,Green));
즐거운 하루되세요
> 고도산 님이 쓴 글입니다.
> 제목 : 지표 수식 부탁드립니다.
> yt에서 배열을 어떻게 하는지 궁금하군요.
// @version=5
indicator("Liquidity Weighted Moving Averages [AlgoAlpha]", overlay = true, timeframe = "", timeframe_gaps = false)
// Define liquidity based on volume and price movement
priceMovementLiquidity = volume / math.abs(close - open)
outlierThreshold = input.int(10, "Outlier Threshold Length")
fastMovingAverageLength = input.int(50, "Fast MA length")
slowMovingAverageLength = input.int(100, "Slow MA length")
// Calculate the boundary for liquidity to identify outliers
liquidityBoundary = ta.ema(priceMovementLiquidity, outlierThreshold) + ta.stdev(priceMovementLiquidity, outlierThreshold)
// Initialize an array to store liquidity values when they cross the boundary
var liquidityValues = array.new_float(5)
// Check if the liquidity crosses above the boundary and up-date the array
if ta.crossover(priceMovementLiquidity, liquidityBoundary)
array.in-sert(liquidityValues, 0, close)
// Calculate the Exponential Moving Averages for the close price at the last liquidity crossover
fastEMA = ta.ema(array.get(liquidityValues, 0), fastMovingAverageLength)
slowEMA = ta.ema(array.get(liquidityValues, 0), slowMovingAverageLength)
// Plot the EMAs with dynamic coloring based on their crossover status
fastPlot = plot(fastEMA, color = fastEMA > slowEMA ? color.new(#ff1100, 50) : color.new(#00ffbb, 50))
slowPlot = plot(slowEMA, color = fastEMA > slowEMA ? color.new(#ff1100, 50) : color.new(#00ffbb, 50))
// Create a fill between the fast and slow EMA plots with appropriate color based on crossover
fill(fastPlot, slowPlot, fastEMA, slowEMA, fastEMA > slowEMA ? color.new(#ff1100, 50) : color.new(#00ffbb, 50), color.new(chart.bg_color, 80))