예스스탁
예스스탁 답변
2022-05-03 11:13:21
안녕하세요
예스스탁입니다.
속성에서 점그래프로 설정하고 적용하셔야 합니다.
Input : ATRperiod(100),amplitude(2),channelDeviation(2),값A(1);
var : trend(0),nextTrend(0),maxLowPrice(0),minHighPrice(0);
var : up(0),down(0),atrHigh(0),atrLow(0),arrowUp(0),arrowDown(0);
var : atr2(0),dev(0),highPrice(0),lowPrice(0),highma(0),lowma(0),ht(0);
atr2 = atr(ATRperiod) / 2 ;
dev = atr2 * channelDeviation ;
highPrice = Highest(H,amplitude);
lowPrice = Lowest(L,amplitude);
highma = ma(high, amplitude);
lowma = ma(low, amplitude);
if nextTrend == 1 Then
{
maxLowPrice = max(lowPrice, maxLowPrice);
if highma < maxLowPrice and close < iff(isnan(low[1])==true,low,Low[1]) Then
{
trend = 1;
nextTrend = 0;
minHighPrice = highPrice;
}
}
else
{
minHighPrice = min(highPrice, minHighPrice);
if lowma > minHighPrice and close > iff(isnan(high[1])==true,high,high[1]) Then
{
trend = 0;
nextTrend = 1;
maxLowPrice = lowPrice;
}
}
if trend == 0 Then
{
if IsNaN(trend[1]) == False and trend[1] != 0 Then
{
up = iff(IsNaN(down[1]) == true,down,down[1]);
arrowUp = up - atr2;
}
else
{
up = iff(IsNan(up[1]) == true, maxLowPrice , max(maxLowPrice, up[1]));
}
atrHigh = up + dev;
atrLow = up - dev;
}
else
{
if isnan(trend[1]) == False and trend[1] != 1 Then
{
down = iff(IsNan(up[1]) == true, up , up[1]);
arrowDown = down + atr2;
}
else
{
down = iff(IsNan(down[1]) == true, minHighPrice ,min(minHighPrice, down[1]));
}
atrHigh = down + dev;
atrLow = down - dev;
}
ht = iff(trend == 0 , up , down);
plot1(ht, "HalfTrend",iff(trend == 0 , BLUE, RED));
plot2(atrHigh,"ATR High",RED);
plot3(atrLow, "ATR Low", BLUE);
if trend != trend[1] Then
{
if trend == 0 Then
plot4(ht-값A, "점",Blue);
Else
plot4(ht+값A, "점",Red);
}
즐거운 하루되세요
> 오이도인 님이 쓴 글입니다.
> 제목 : 수식 부탁드립니다
> 수고하십니다.
아래 지표식에서 ht의 색이 바뀌는 부분의 위/아래에 점을 표시하고 싶습니다.
즉,
상승추세로 바뀌면 ht-값A 위치에
하락추세로 바뀌면 ht+값A 위치에 점표시를 하고 싶습니다.
수고하세요.
////////////////
Input : ATRperiod(100),amplitude(2),channelDeviation(2);
var : trend(0),nextTrend(0),maxLowPrice(0),minHighPrice(0);
var : up(0),down(0),atrHigh(0),atrLow(0),arrowUp(0),arrowDown(0);
var : atr2(0),dev(0),highPrice(0),lowPrice(0),highma(0),lowma(0),ht(0);
atr2 = atr(ATRperiod) / 2 ;
dev = atr2 * channelDeviation ;
highPrice = Highest(H,amplitude);
lowPrice = Lowest(L,amplitude);
highma = ma(high, amplitude);
lowma = ma(low, amplitude);
if nextTrend == 1 Then
{
maxLowPrice = max(lowPrice, maxLowPrice);
if highma < maxLowPrice and close < iff(isnan(low[1])==true,low,Low[1]) Then
{
trend = 1;
nextTrend = 0;
minHighPrice = highPrice;
}
}
else
{
minHighPrice = min(highPrice, minHighPrice);
if lowma > minHighPrice and close > iff(isnan(high[1])==true,high,high[1]) Then
{
trend = 0;
nextTrend = 1;
maxLowPrice = lowPrice;
}
}
if trend == 0 Then
{
if IsNaN(trend[1]) == False and trend[1] != 0 Then
{
up = iff(IsNaN(down[1]) == true,down,down[1]);
arrowUp = up - atr2;
}
else
{
up = iff(IsNan(up[1]) == true, maxLowPrice , max(maxLowPrice, up[1]));
}
atrHigh = up + dev;
atrLow = up - dev;
}
else
{
if isnan(trend[1]) == False and trend[1] != 1 Then
{
down = iff(IsNan(up[1]) == true, up , up[1]);
arrowDown = down + atr2;
}
else
{
down = iff(IsNan(down[1]) == true, minHighPrice ,min(minHighPrice, down[1]));
}
atrHigh = down + dev;
atrLow = down - dev;
}
ht = iff(trend == 0 , up , down);
plot1(ht, "HalfTrend",iff(trend == 0 , BLUE, RED));
plot2(atrHigh,"ATR High",RED);
plot3(atrLow, "ATR Low", BLUE);