종가가 superTrend보다 위에 있는 종목 검색 되도록 수식 부탁 드립니다.
input : factor(3), AtrPeriod(10);
var : src(0), AtrV(0),upperBand(0),lowerBand(0),upperBand2(0),lowerBand2(0), prevLowerBand(0), prevUpperBand(0);
var : prevSuperTrend(0), superTrend(0), direction(0),alpha(0),source(0);
if CurrentBar > 1 Then {
src = (H+L)/2;
alpha = 1 / AtrPeriod ;
source = max(high - low, abs(high - close[1]), abs(low - close[1]));
ATrV = alpha * source + (1 - alpha) * ATrV[1];
upperBand = src + factor * AtrV;
lowerBand = src - factor * AtrV;
prevLowerBand = lowerBand[1];
prevUpperBand = upperBand[1];
if lowerBand > prevLowerBand or close[1] < prevLowerBand Then
lowerBand = lowerBand;
Else
lowerBand = prevLowerBand;
if upperBand < prevUpperBand or close[1] > prevUpperBand Then
upperBand = upperBand;
Else
upperBand = prevUpperBand;
prevSuperTrend = superTrend[1];
if prevSuperTrend == prevUpperBand Then {
if close > upperBand Then
direction = -1;
Else
direction = 1;
}
Else {
if close < lowerBand Then
direction = 1;
Else
direction = -1;
}
if direction == -1 Then
superTrend = lowerBand;
Else
superTrend = upperBand;
}
value1 = superTrend;
답변 1
예스스탁
예스스탁 답변
2025-02-21 13:10:22
안녕하세요
예스스탁입니다.
input : factor(3), AtrPeriod(10);
var : src(0), AtrV(0),upperBand(0),lowerBand(0),upperBand2(0),lowerBand2(0), prevLowerBand(0), prevUpperBand(0);
var : prevSuperTrend(0), superTrend(0), direction(0),alpha(0),source(0);
if CurrentBar > 1 Then {
src = (H+L)/2;
alpha = 1 / AtrPeriod ;
source = max(high - low, abs(high - close[1]), abs(low - close[1]));
ATrV = alpha * source + (1 - alpha) * ATrV[1];
upperBand = src + factor * AtrV;
lowerBand = src - factor * AtrV;
prevLowerBand = lowerBand[1];
prevUpperBand = upperBand[1];
if lowerBand > prevLowerBand or close[1] < prevLowerBand Then
lowerBand = lowerBand;
Else
lowerBand = prevLowerBand;
if upperBand < prevUpperBand or close[1] > prevUpperBand Then
upperBand = upperBand;
Else
upperBand = prevUpperBand;
prevSuperTrend = superTrend[1];
if prevSuperTrend == prevUpperBand Then {
if close > upperBand Then
direction = -1;
Else
direction = 1;
}
Else {
if close < lowerBand Then
direction = 1;
Else
direction = -1;
}
if direction == -1 Then
superTrend = lowerBand;
Else
superTrend = upperBand;
if c > supertrend Then
Find(1);
}
즐거운 하루되세요
> 뎅이요 님이 쓴 글입니다.
> 제목 : 검색식 부탁 드립니다
>
종가가 superTrend보다 위에 있는 종목 검색 되도록 수식 부탁 드립니다.
input : factor(3), AtrPeriod(10);
var : src(0), AtrV(0),upperBand(0),lowerBand(0),upperBand2(0),lowerBand2(0), prevLowerBand(0), prevUpperBand(0);
var : prevSuperTrend(0), superTrend(0), direction(0),alpha(0),source(0);
if CurrentBar > 1 Then {
src = (H+L)/2;
alpha = 1 / AtrPeriod ;
source = max(high - low, abs(high - close[1]), abs(low - close[1]));
ATrV = alpha * source + (1 - alpha) * ATrV[1];
upperBand = src + factor * AtrV;
lowerBand = src - factor * AtrV;
prevLowerBand = lowerBand[1];
prevUpperBand = upperBand[1];
if lowerBand > prevLowerBand or close[1] < prevLowerBand Then
lowerBand = lowerBand;
Else
lowerBand = prevLowerBand;
if upperBand < prevUpperBand or close[1] > prevUpperBand Then
upperBand = upperBand;
Else
upperBand = prevUpperBand;
prevSuperTrend = superTrend[1];
if prevSuperTrend == prevUpperBand Then {
if close > upperBand Then
direction = -1;
Else
direction = 1;
}
Else {
if close < lowerBand Then
direction = 1;
Else
direction = -1;
}
if direction == -1 Then
superTrend = lowerBand;
Else
superTrend = upperBand;
}
value1 = superTrend;