답변완료
신고가 신저가 수식문의
수고 많으십니다.
종가가 아닌 고가와 저가 기준으로 라인을 만들어 보려 하는데 고가는 그려지는데 저가 라인이 그려지질 않네요.
수정 부탁드립니다.
그리고 기간(26)의 저가와 고가가 동시에 상승하는 구간/저가와 고가가 동시에 하락하는 구간에 RED 와 BLUE로 색을 넣는 식도 부탁드립니다.
input : 기간(26);
if H > highest(H,기간)[1] Then
var1 = H;
if L < Lowest(L,기간)[1] Then
var2 = L;
if var1 > 0 Then
Plot1(var1,"신고가라인",ReD);
if var2 < 0 Then
Plot2(var2,"신저가라인",Blue);
2025-07-11
171
글번호 192429
지표
답변완료
지표 수식 부탁드립니다.
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))
2025-07-11
231
글번호 192424
지표
답변완료
수식수정
더운 날씨에수고많으십니다.
이전에 작성해주신 수식인데 수정부탁드립니다.
이전의 조건은
- 국내선물 120틱 사용
- 장 운용시간: 09:30~15:10 이후 진입금지/ 15:30 강제청산
- 60이평 상승추세 and 20이평 3봉연속 추세유지(하락)후 2봉연속 상승시 매수
/ 2봉연속 하락시 매수청산(60이평 상승추세에서는 매도진입 금지)
- 60이평 하락추세 and 20이평 3봉연속 추세유지(하락)후 2봉연속 하락시 매도
/ 2봉연속 상승시 매도청산(60이평 하락추세에서는 매수진입 금지)
* 이 수식에 추가로 3봉연속 추세유지 와 2봉 연속 상승을 변수로 지정할 수 있게
부탁 드립니다.
input : StartTime(93000),EndTime(151000),P1(20),P2(60);
var : Tcond(false),mav1(0),mav2(0),T(0),S(0);
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = False;
}
mav1 = ma(c,P1);
mav2 = ma(c,P2);
if mav1 > mav1[1] Then
T = 1;
if mav1 < mav1[1] Then
T = -1;
if mav2 > mav2[1] Then
S = 1;
if mav2 < mav2[1] Then
S = -1;
if Tcond == true Then
{
if MarketPosition <= 0 and
S == 1 and
CountIf(T == 1,2) == 2 and
CountIf(T== -1,3)[2] == 3 Then
Buy("b");
if MarketPosition >= 0 and
S == -1 and
CountIf(T == -1,2) == 2 and
CountIf(T== 1,3)[2] == 3 Then
Sell("s");
if MarketPosition == 1 and CountIf(T == -1,2) == 2 Then
ExitLong("bx");
if MarketPosition == -1 and CountIf(T == 1,2) == 2 Then
ExitShort("sx");
}
SetStopEndofday(153000);
감사합니다
2025-07-11
167
글번호 192423
시스템
답변완료
수식 수정을 부탁드립니다
트레이딩뷰의 UT BOT 지표를 시스템용 매수 매도로 전환한 식입니다 검증 결과 이상이 없다고 확인되는데 구동하면 논리값이나 논리표현이 와야 한다는 메세지가 뜹니다
늘 건강하세요.
Input:
Key_Value(1), // Key Vaule. 'This changes the sensitivity'
ATR_Period(10), // ATR Period
UseHeikinAshi(False); // Signals from Heikin Ashi Candles (이 기능은 예스트레이더에서 별도 구현 필요)
Var:
xATR(0), // ATR 값
nLoss(0), // 손실 한도
xATRTrailingStop(0),// 트레일링 스톱 값
pos(0), // 추세 방향 (1:상승, -1:하락, 0:중립)
src(0), // 계산에 사용될 가격 데이터 (종가 또는 Heikin Ashi 종가)
ema(0), // EMA 값
above(False), // 상향 돌파 여부
below(False), // 하향 돌파 여부
BuySignal(False), // 매수 신호 발생 여부
SellSignal(False); // 매도 신호 발생 여부
// 모든 변수를 수식 시작점에서 명확하게 초기화합니다.
// 이렇게 하면 컴파일러가 변수들이 사용되기 전에 항상 초기화되었다고 인식할 수 있습니다.
xATR = 0;
nLoss = 0;
xATRTrailingStop = 0;
pos = 0;
src = Close; // 기본적으로 현재 봉의 종가로 초기화
ema = 0;
above = False;
below = False;
BuySignal = False;
SellSignal = False;
// Heikin Ashi 캔들 사용 여부에 따라 src 값 결정
// 예스트레이더에서 Heikin Ashi 캔들 데이터를 직접 가져오는 기능이 없으므로,
// 이 부분은 일반 종가(Close)를 사용하거나, Heikin Ashi 캔들 계산 로직을 별도로 구현해야 합니다.
If UseHeikinAshi Then Begin
// Heikin Ashi 캔들 데이터 가져오기 (예스트레이더에서 직접 지원하지 않음, 별도 구현 필요)
// 예시: src = HAKENASHI_CLOSE(); 또는 Heikin Ashi 계산 로직 삽입
src = Close; // UseHeikinAshi가 True여도 일단 Close를 사용합니다. (이 부분은 사용자 정의 함수로 대체되어야 합니다.)
End Else Begin
src = Close; // UseHeikinAshi가 False이면 현재 봉의 종가 사용
End;
// ATR 계산
xATR = ATR(ATR_Period);
nLoss = Key_Value * xATR;
// xATRTrailingStop 계산
// 첫 봉에서는 xATRTrailingStop[1] 값이 없으므로 초기값을 설정해야 합니다.
If CurrentBar == 1 Then Begin
xATRTrailingStop = src - nLoss; // 첫 봉 초기값 설정
End Else Begin
If src > xATRTrailingStop[1] And src[1] > xATRTrailingStop[1] Then Begin
xATRTrailingStop = Max(xATRTrailingStop[1], src - nLoss);
End Else If src < xATRTrailingStop[1] And src[1] < xATRTrailingStop[1] Then Begin
xATRTrailingStop = Min(xATRTrailingStop[1], src + nLoss);
End Else If src > xATRTrailingStop[1] Then Begin
xATRTrailingStop = src - nLoss;
End Else Begin
xATRTrailingStop = src + nLoss;
End;
End;
// pos (추세 방향) 계산
If CurrentBar == 1 Then Begin
pos = 0; // 첫 봉 초기값
End Else Begin
If src[1] < xATRTrailingStop[1] And src > xATRTrailingStop[1] Then Begin
pos = 1; // 상승 추세 전환
End Else If src[1] > xATRTrailingStop[1] And src < xATRTrailingStop[1] Then Begin
pos = -1; // 하락 추세 전환
End Else Begin
pos = pos[1]; // 이전 추세 유지
End;
End;
// EMA (period 1은 사실상 src와 동일)
ema = src; // EMA(src, 1)은 src와 동일합니다.
// 교차 신호
// 'Cross' 대신 'CrossUp'과 'CrossDown' 함수를 사용합니다.
// 라인 81: ema가 xATRTrailingStop을 상향 돌파
above = CrossUp(ema, xATRTrailingStop);
// 라인 82: xATRTrailingStop이 ema를 상향 돌파 == ema가 xATRTrailingStop을 하향 돌파
below = CrossDown(ema, xATRTrailingStop);
// 매수/매도 신호 조건
BuySignal = (src > xATRTrailingStop) And above;
SellSignal = (src < xATRTrailingStop) And below;
// 매수/매도 명령
If BuySignal Then Begin
Buy("UT_Buy");
End;
If SellSignal Then Begin
Sell("UT_Sell");
End;
2025-07-11
233
글번호 192422
시스템