예스스탁
예스스탁 답변
2022-07-06 17:59:33
안녕하세요
예스스탁입니다.
Input : short(12), long(26), signal(9),P(20);
Var : MACDv(0), MACDs(0),macdo(0),T(0),HH(0),LL(0);
var : d1(0),t1(0),tl1(0),tl2(0),mav(0),entry(0);
MACDv = MACD(short, long);
MACDs = ema(MACDv,signal);
macdo = MACDv-MACDs;
mav = ma(C,P);
if Bdate != Bdate[1] Then
{
d1 = sDate;
t1 = sTime;
HH = macdo;
LL = macdo;
Condition1 = False;
entry = 0;
T = 0;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if d1 > 0 Then
{
if macdo > hh Then
hh = macdo;
if macdo < ll Then
ll = macdo;
if Condition1 == False and hh >= ll+0.5 Then
{
Condition1 = true;
var1 = DayHigh;
Var2 = DayLow;
TL1 = TL_New(d1,t1,var1,NextBarSdate,NextBarStime,var1);
TL2 = TL_New(d1,t1,var2,NextBarSdate,NextBarStime,var2);
}
if Condition1 == true Then
{
TL_SetEnd(TL1,sDate,sTime,var1);
TL_SetEnd(TL2,sDate,sTime,var2);
if CrossUp(C,var1) Then
T = 1;
if CrossDown(C,Var2) Then
T = -1;
if Bdate == Bdate[3] Then
{
if T == 1 and CountIf(C > var1 and C > O and C > C[1],3) == 3 Then
{
if entry < 1 Then
Buy("b1");
Else
ExitShort();
}
if T == -1 and CountIf(C < Var2 and C > O and C > C[1],3) == 3 Then
{
if entry < 1 Then
Buy("b2");
Else
ExitShort();
}
if T == 1 and CountIf(C > var1 and C < O and C < C[1],3) == 3 Then
{
if entry < 1 Then
Sell("s1");
Else
ExitLong();
}
if T == -1 and CountIf(C < Var2 and C < O and C < C[1],3) == 3 Then
{
if entry < 1 Then
Sell("s2");
Else
ExitLong();
}
}
}
}
즐거운 하루되세요
> 흰둥이아빠 님이 쓴 글입니다.
> 제목 : 함수요청
> 안녕하세요?
아래 함수의 고점과 저점을 적용하여 글번호 77957번의 전략을 작성하고 싶습니다.
스크립트 수정 부탁드립니다.
#HHLL
Input : short(12), long(26), signal(9),P(20);
Var : MACDv(0), MACDs(0),macdo(0),T(0),HH(0),LL(0);
var : d1(0),t1(0),tl1(0),tl2(0),mav(0),entry(0);
MACDv = MACD(short, long);
MACDs = ema(MACDv,signal);
macdo = MACDv-MACDs;
mav = ma(C,P);
if Bdate != Bdate[1] Then
{
d1 = sDate;
t1 = sTime;
HH = macdo;
LL = macdo;
Condition1 = False;
entry = 0;
T = 1;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if d1 > 0 Then
{
if macdo > hh Then
hh = macdo;
if macdo < ll Then
ll = macdo;
if Condition1 == False and hh >= ll+0.5 Then
{
Condition1 = true;
var1 = DayHigh;
Var2 = DayLow;
TL1 = TL_New(d1,t1,var1,NextBarSdate,NextBarStime,var1);
TL2 = TL_New(d1,t1,var2,NextBarSdate,NextBarStime,var2);
}
if Condition1 == true Then
{
TL_SetEnd(TL1,sDate,sTime,var1);
TL_SetEnd(TL2,sDate,sTime,var2);
# 77957번 전략
input : HH(360),LL(350);
var : entry(0),T(0);
if Bdate != Bdate[1] then
{
entry = 0;
T = 1;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) Or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if CrossUp(C,HH) Then
T = 1;
if CrossDown(C,LL) Then
T = -1;
if Bdate == Bdate[3] Then
{
if T == 1 and CountIf(C > HH and C > O and C > C[1],3) == 3 Then
{
if entry < 1 Then
Buy("b1");
Else
ExitShort();
}
if T == -1 and CountIf(C < LL and C > O and C > C[1],3) == 3 Then
{
if entry < 1 Then
Buy("b2");
Else
ExitShort();
}
if T == 1 and CountIf(C > HH and C < O and C < C[1],3) == 3 Then
{
if entry < 1 Then
Sell("s1");
Else
ExitLong();
}
if T == -1 and CountIf(C < LL and C < O and C < C[1],3) == 3 Then
{
if entry < 1 Then
Sell("s2");
Else
ExitLong();
}
}
###스크립트 -> 이렇게 작성하면 원하는 신호가 아닙니다
Input : short(12), long(26), signal(9),P(20);
Var : MACDv(0), MACDs(0),macdo(0),T(0),HH(0),LL(0);
var : d1(0),t1(0),tl1(0),tl2(0),mav(0),entry(0);
MACDv = MACD(short, long);
MACDs = ema(MACDv,signal);
macdo = MACDv-MACDs;
mav = ma(C,P);
if Bdate != Bdate[1] Then
{
d1 = sDate;
t1 = sTime;
HH = macdo;
LL = macdo;
Condition1 = False;
entry = 0;
T = 1;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if d1 > 0 Then
{
if macdo > hh Then
hh = macdo;
if macdo < ll Then
ll = macdo;
if Condition1 == False and hh >= ll+0.5 Then
{
Condition1 = true;
var1 = DayHigh;
Var2 = DayLow;
TL1 = TL_New(d1,t1,var1,NextBarSdate,NextBarStime,var1);
TL2 = TL_New(d1,t1,var2,NextBarSdate,NextBarStime,var2);
}
if Condition1 == true Then
{
TL_SetEnd(TL1,sDate,sTime,var1);
TL_SetEnd(TL2,sDate,sTime,var2);
if Bdate != Bdate[1] then
{
entry = 0;
T = 1;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) Or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if CrossUp(C,HH) Then
T = 1;
if CrossDown(C,LL) Then
T = -1;
if Bdate == Bdate[3] Then
{
if T == 1 and CountIf(C > HH and C > O and C > C[1],3) == 3 Then
{
if entry < 1 Then
Buy("b1");
Else
ExitShort();
}
if T == -1 and CountIf(C < LL and C > O and C > C[1],3) == 3 Then
{
if entry < 1 Then
Buy("b2");
Else
ExitShort();
}
if T == 1 and CountIf(C > HH and C < O and C < C[1],3) == 3 Then
{
if entry < 1 Then
Sell("s1");
Else
ExitLong();
}
if T == -1 and CountIf(C < LL and C < O and C < C[1],3) == 3 Then
{
if entry < 1 Then
Sell("s2");
Else
ExitLong();
}
}
}
}
SetStopEndofday(151500);