예스스탁
예스스탁 답변
2022-11-30 14:25:03
> 고성 님이 쓴 글입니다.
> 제목 : 슈퍼트렌드 쌍바닥 쌍봉
> input : Factor(7),Pd(10),highPd(1),lowPd(5);
input : 쌍봉상(1),쌍봉하(2),쌍바닥상(2),쌍바닥하(1);
var : sp(0),th(0),ll(0),myh(0),myl(0),up(0),dn(0),ii(0),Trendup(0),trenddown(0),Trend(0);
var : Tsl(0),linecolor(0),tx(0),tl(0),tx1(0),tx2(0);
sp = (H+L+c)/3;
th = high;
for ii = 1 to Pd*highPd
{
if th < high[ii] Then
th = high[ii];
}
ll = low;
for ii=1 to Pd*lowPd
{
if ll > low[ii] Then
ll = low[ii];
}
myh = ma(high,Pd)*0.4+th*0.6;
myl = (ma(sp,Pd)*0.5+ll*0.5);
Up = myl-(Factor*atr(Pd)*0.8 );
Dn = (myh+(Factor*atr(Pd) ));
TrendUp = iff(sp[1]>TrendUp[1], max(Up,TrendUp[1]) , Up);
TrendDown = iff(sp[1]<TrendDown[1], min(Dn,TrendDown[1]) , Dn);
Trend = iff(sp > TrendDown[1] , 1, iff(sp< TrendUp[1] , -1, Trend[1]));
Tsl = IFF(Trend==1, TrendUp, TrendDown);
linecolor = IFF(Trend == 1 , Red , Blue);
plot1(Tsl,"SuperTrend",linecolor);
if Trend != Trend[1] Then
{
if Trend == 1 Then
{
var1 = Tsl[1];
var2 = var1[1];
tx = Text_New(sDate,sTime, Tsl-PriceScale*2,"●");
Text_SetColor(tx,Green);
Text_SetSize(tx,15);
Text_SetStyle(tx,2,2);
TL = TL_New(sDate,sTime,0,sDate,sTime,99999999);
TL_SetColor(TL,Pink);
TL_SetSize(TL,0.5);
if Var2 > 0 and var1 <= Var2+PriceScale*쌍바닥상 and var1 >= Var2-PriceScale*쌍바닥하 Then
{
tx1 = Text_New(sDate,sTime, Tsl-PriceScale*2,"●");
Text_SetColor(tx1,Blue);
Text_SetSize(tx1,25);
Text_SetStyle(tx1,2,0);
}
}
Else
{
Var3 = Tsl[1];
Var4 = Var3[1];
tx = Text_New(sDate,sTime, Tsl+PriceScale*0,"●");
Text_SetColor(tx,Magenta);
Text_SetSize(tx,15);
Text_SetStyle(tx,2,2);
TL = TL_New(sDate,sTime,0,sDate,sTime,99999999);
TL_SetColor(TL,Lime);
TL_SetSize(TL,0.5);
if Var4 > 0 and var3 <= Var4+PriceScale*쌍봉상 and var3 >= Var4-PriceScale*쌍봉하 Then
{
tx2 = Text_New(sDate,sTime, Tsl+PriceScale*2,"●");
Text_SetColor(tx2,Red);
Text_SetSize(tx2,25);
Text_SetStyle(tx2,2,1);
}
}
}
1.지표식: 현재 변수로 외바닥 외봉은 정상인데, 쌍바닥 쌍봉은 첨부한 그림같이 오류.
참고: 번호 78186 에서 중간선 쌍바닥을, var를 (abs) value로 바꿔 해결해 주심.
2.시스템:쌍바닥 매수,다음 봉에 매수청산. 쌍봉에 매도,다음봉에 매도청산. 감사합니다.