예스스탁
예스스탁 답변
2022-05-30 13:09:20
안녕하세요
예스스탁입니다.
HTM1, Trend1 모두 사용자함수로 작성해 드립니다.
사용자함수로 만드신 후에 지표는 아래와 같이 작성해 사용하시면 됩니다.
Input : ATRperiod1(1000),amplitude1(58);
var1 = HTM1(ATRperiod1,amplitude1);
Var2 = trend1(ATRperiod1,amplitude1);
plot11(var1, "HTM1",iff(Var2 == 0 ,RED, BluE));
if Var2 != Var2[1] Then
{ if Var2 == 0 Then plot12(var1-0.1, "HTM1점",red);
Else plot12(var1+0.1, "HTM1점",Blue);
}
1.
사용자함수명 : HTM1
반환값형 : 숫자형
Input : ATRperiod1(Numeric),amplitude1(Numeric);
var : trend1(0),nexttrend1(0),maxlowPrice1(0),minhighPrice1(0);
var : up1(0),down1(0),atrHigh1(0),atrLow1(0),arrowup1(0),arrowdown1(0);
var : atr21(0),dev1(0),highPrice1(0),lowPrice1(0),highma1(0),lowma1(0),midma1(0);
atr21 = atr(ATRperiod1) / 2 ;
dev1 = atr21 * 5.5 ;
highPrice1 = Highest(H,amplitude1*1.5);
lowPrice1 = Lowest(L,amplitude1*1.5);
highma1 = ma(high, amplitude1*1.25);
lowma1 = ma(low, amplitude1*0.75);
midma1 = (highma1+lowma1)/2 ;
if nexttrend1 == 1 Then
{
maxlowPrice1 = max(lowPrice1, maxlowPrice1);
if midma1 < maxlowPrice1 and close < iff(isnan(low[1])==true,low,Low[1]) Then
{
trend1 = 1;
nexttrend1 = 0;
minhighPrice1 = highPrice1;
}
}
else
{
minhighPrice1 = min(highPrice1, minhighPrice1);
if midma1 > minhighPrice1 and close > iff(isnan(high[1])==true,high,high[1]) Then
{
trend1 = 0;
nexttrend1 = 1;
maxlowPrice1 = lowPrice1;
}
}
if trend1 == 0 Then
{
if IsNaN(trend1[1]) == False and trend1[1] != 0 Then
{
up1 = iff(IsNaN(down1[1]) == true,down1,down1[1]);
arrowup1 = up1 - atr21;
}
else
{
up1 = iff(IsNan(up1[1]) == true, maxlowPrice1 , max(maxlowPrice1, up1[1]));
}
atrHigh1 = up1 + dev1;
atrLow1 = up1 - dev1;
}
else
{
if isnan(trend1[1]) == False and trend1[1] != 1 Then
{
down1 = iff(IsNan(up1[1]) == true, up1 , up1[1]);
arrowdown1 = down1 + atr21;
}
else
{
down1 = iff(IsNan(down1[1]) == true, minhighPrice1 ,min(minhighPrice1, down1[1]));
}
atrHigh1 = down1 + dev1;
atrLow1 = down1 - dev1;
}
HTM1 = iff(trend1 == 0 , up1 , down1);
2
사용자함수명 : trend1
반환값형 : 숫장형
Input : ATRperiod1(Numeric),amplitude1(Numeric);
var : nexttrend1(0),maxlowPrice1(0),minhighPrice1(0);
var : up1(0),down1(0),atrHigh1(0),atrLow1(0),arrowup1(0),arrowdown1(0);
var : atr21(0),dev1(0),highPrice1(0),lowPrice1(0),highma1(0),lowma1(0),midma1(0),HTM1(0);
atr21 = atr(ATRperiod1) / 2 ;
dev1 = atr21 * 5.5 ;
highPrice1 = Highest(H,amplitude1*1.5);
lowPrice1 = Lowest(L,amplitude1*1.5);
highma1 = ma(high, amplitude1*1.25);
lowma1 = ma(low, amplitude1*0.75);
midma1 = (highma1+lowma1)/2 ;
if nexttrend1 == 1 Then
{
maxlowPrice1 = max(lowPrice1, maxlowPrice1);
if midma1 < maxlowPrice1 and close < iff(isnan(low[1])==true,low,Low[1]) Then
{
trend1 = 1;
nexttrend1 = 0;
minhighPrice1 = highPrice1;
}
}
else
{
minhighPrice1 = min(highPrice1, minhighPrice1);
if midma1 > minhighPrice1 and close > iff(isnan(high[1])==true,high,high[1]) Then
{
trend1 = 0;
nexttrend1 = 1;
maxlowPrice1 = lowPrice1;
}
}
if trend1 == 0 Then
{
if IsNaN(trend1[1]) == False and trend1[1] != 0 Then
{
up1 = iff(IsNaN(down1[1]) == true,down1,down1[1]);
arrowup1 = up1 - atr21;
}
else
{
up1 = iff(IsNan(up1[1]) == true, maxlowPrice1 , max(maxlowPrice1, up1[1]));
}
atrHigh1 = up1 + dev1;
atrLow1 = up1 - dev1;
}
else
{
if isnan(trend1[1]) == False and trend1[1] != 1 Then
{
down1 = iff(IsNan(up1[1]) == true, up1 , up1[1]);
arrowdown1 = down1 + atr21;
}
else
{
down1 = iff(IsNan(down1[1]) == true, minhighPrice1 ,min(minhighPrice1, down1[1]));
}
atrHigh1 = down1 + dev1;
atrLow1 = down1 - dev1;
}
즐거운 하루되세요
> 오이도인 님이 쓴 글입니다.
> 제목 : 수식 부탁드립니다
> 수고하십니다.
아래 지표식에서 [HTM1]의 사용자 함수식 부탁합니다.
이때 [trend1]이나 다른 변수의 사용자 함수도 필요한지 모르겠네요....?
감사합니다. 수고하세요
################
Input : ATRperiod1(1000),amplitude1(58);
var : trend1(0),nexttrend1(0),maxlowPrice1(0),minhighPrice1(0);
var : up1(0),down1(0),atrHigh1(0),atrLow1(0),arrowup1(0),arrowdown1(0);
var : atr21(0),dev1(0),highPrice1(0),lowPrice1(0),highma1(0),lowma1(0),midma1(0),HTM1(0);
atr21 = atr(ATRperiod1) / 2 ;
dev1 = atr21 * 5.5 ;
highPrice1 = Highest(H,amplitude1*1.5);
lowPrice1 = Lowest(L,amplitude1*1.5);
highma1 = ma(high, amplitude1*1.25);
lowma1 = ma(low, amplitude1*0.75);
midma1 = (highma1+lowma1)/2 ;
if nexttrend1 == 1 Then
{
maxlowPrice1 = max(lowPrice1, maxlowPrice1);
if midma1 < maxlowPrice1 and close < iff(isnan(low[1])==true,low,Low[1]) Then
{
trend1 = 1;
nexttrend1 = 0;
minhighPrice1 = highPrice1;
}
}
else
{
minhighPrice1 = min(highPrice1, minhighPrice1);
if midma1 > minhighPrice1 and close > iff(isnan(high[1])==true,high,high[1]) Then
{
trend1 = 0;
nexttrend1 = 1;
maxlowPrice1 = lowPrice1;
}
}
if trend1 == 0 Then
{
if IsNaN(trend1[1]) == False and trend1[1] != 0 Then
{
up1 = iff(IsNaN(down1[1]) == true,down1,down1[1]);
arrowup1 = up1 - atr21;
}
else
{
up1 = iff(IsNan(up1[1]) == true, maxlowPrice1 , max(maxlowPrice1, up1[1]));
}
atrHigh1 = up1 + dev1;
atrLow1 = up1 - dev1;
}
else
{
if isnan(trend1[1]) == False and trend1[1] != 1 Then
{
down1 = iff(IsNan(up1[1]) == true, up1 , up1[1]);
arrowdown1 = down1 + atr21;
}
else
{
down1 = iff(IsNan(down1[1]) == true, minhighPrice1 ,min(minhighPrice1, down1[1]));
}
atrHigh1 = down1 + dev1;
atrLow1 = down1 - dev1;
}
HTM1 = iff(trend1 == 0 , up1 , down1);
plot11(HTM1, "HTM1",iff(trend1 == 0 ,RED, BluE));
if trend1 != trend1[1] Then
{ if trend1 == 0 Then plot12(HTM1-0.1, "HTM1점",red);
Else plot12(HTM1+0.1, "HTM1점",Blue);
}