예스스탁
예스스탁 답변
2025-06-12 12:52:53
안녕하세요
예스스탁입니다.
1
input : short(12),long(26),sig(9);
var : macdv(0),macds(0);
var : 기준선(0), 전환선(0);
var : T1(0),T2(0),T3(0);
전환선 = (Highest(High, 9) + Lowest(Low, 9)) / 2;
기준선 = (Highest(High, 26) + Lowest(Low, 26)) / 2;
macdv = macd(short,long);
macds = ema(macdv,sig);
if 전환선 > 전환선[1] Then
T1 = 1;
if 전환선 < 전환선[1] Then
T1 = -1;
if 기준선 > 기준선[1] Then
T2= 1;
if 기준선 < 기준선[1] Then
T2 = -1;
if macds > macds[1] Then
T3 = 1;
if macds < macds[1] Then
T3 = -1;
Condition1 = T1 == 1 and T2 == 1 and T3 == 1;
Condition2 = T1 == -1 and T2 == -1 and T3 == -1;
if MarketPosition <= 0 and Condition1 == true and Condition1[1] == False Then
Buy();
if MarketPosition == 1 and Condition1 == False Then
ExitLong();
if MarketPosition >= 0 and Condition2 == true and Condition2[1] == False Then
Sell();
if MarketPosition == -1 and Condition2 == False Then
ExitShort();
2
input : short(12),long(26),sig(9);
var : macdv(0),macds(0);
var : 기준선(0), 전환선(0);
var : T1(0),T2(0),T3(0);
var : box1(0),box2(0);
전환선 = (Highest(High, 9) + Lowest(Low, 9)) / 2;
기준선 = (Highest(High, 26) + Lowest(Low, 26)) / 2;
macdv = macd(short,long);
macds = ema(macdv,sig);
if 전환선 > 전환선[1] Then
T1 = 1;
if 전환선 < 전환선[1] Then
T1 = -1;
if 기준선 > 기준선[1] Then
T2= 1;
if 기준선 < 기준선[1] Then
T2 = -1;
if macds > macds[1] Then
T3 = 1;
if macds < macds[1] Then
T3 = -1;
Condition1 = T1 == 1 and T2 == 1 and T3 == 1;
Condition2 = T1 == -1 and T2 == -1 and T3 == -1;
if Condition1 == true Then
{
if Condition1[1] == False Then
{
box1 = Box_New(sDate,sTime,H,NextBarSdate,NextBarStime,L);
Box_SetColor(box1,Red);
Box_SetFill(box1,true);
Box_SetextFill(box1,true);
}
Else
Box_SetEnd(box1,NextBarSdate,NextBarStime,L);
}
if Condition2 == true Then
{
if Condition2[1] == False Then
{
box2 = Box_New(sDate,sTime,H,NextBarSdate,NextBarStime,L);
Box_SetColor(box2,Blue);
Box_SetFill(box2,true);
Box_SetextFill(box2,true);
}
Else
Box_SetEnd(box2,NextBarSdate,NextBarStime,L);
}
즐거운 하루되세요
> 나도부자1 님이 쓴 글입니다.
> 제목 : 수식문의
> 수고많으십니다.
1. 매진입 조건
일목균형표의 기준선과 전환선 그리고 MACD sig선 3가지의 지표가 동시에 상승
2.매수청산
위의 3가지 중 어느 하나라도 하락 전환 시 청산
3. 매도 진입과 매도 청산은 위 조건의 반대일 경우 청산
4. 그리고 예시처럼 위의 구간에 색상(강세/약세)을 넣을 수 는 없는지요?
ex) MACD 기준선 색상
input : shortPeriod(12),longPeriod(26),Period(9);
var : macdv(0),macds(0),box(0),TL(0);
macdv = macd(shortPeriod,longPeriod);
macds = Ema(macdv,Period);
if CrossUp(MACDV,0) Then
{
box = Box_New(sDate,sTime,0,NextBarSdate,NextBarStime,99999999);
Box_SetColor(box,Red);
Box_SetFill(box,true);
TL = TL_New(sDate,sTime,0,sDate,sTime,99999999);
TL_SetColor(TL,Black);
TL_SetSize(TL,0);
}
Else if CrossDown(MACDV,0) Then
{
box = Box_New(sDate,sTime,0,NextBarSdate,NextBarStime,99999999);
Box_SetColor(box,Blue);
Box_SetFill(box,true);
TL = TL_New(sDate,sTime,0,sDate,sTime,99999999);
TL_SetColor(TL,Black);
TL_SetSize(TL,0);
}
Else
Box_SetEnd(box,NextBarSdate,NextBarStime,99999999);
Plot1(macdv,"macd");
//Plot2(macds,"signal");
PlotBaseLine1(0);
미리 감사 드립니다.