커뮤니티
문의드립니다.
2016-02-22 12:38:56
113
글번호 95640
정교한 수식 작성에 항상 감사드립니다.
아래의 수식에 트레일링 스탑을 설정하고자 합니다.
현재의 수식은 value2의 값을 crossup 한 경우 전량 매도로 설정 되어 있습니다.
value2의 값을 crossup 한 이후 -1%하락 시 전량 매도의 트레일링 스탑 수식이 필요합니다.
감사합니다.
-아래-
input : N(1);
var : AA(0),BB(0),CC(0);
var : TF(0),VV(0),VH(0),VH1(0);
var : cnt(0),count(0);
count = 0;
for cnt = 0 to 20{
if sdate ==EntryDate(cnt) Then
count = count+1;
}
AA = (highest(H,5760)+lowest(L,5760))/2;
BB = Highest(H,1800);
var1 = NthHighestBar(1,H,1800);
CC = lowest(L,var1);
value1 = (((BB-AA)/5)*1.8)+AA;
value2 = (((BB-AA)/5)*1.7)+CC;
Value5 = (((BB-AA)/5)*0)+AA;
TF = dayindex%15;
if date != date[1] then{
VV = 0;
VH = 0;
VH1 = VH[1];
}
if (TF < TF[1] and date == date[1]) Then
VV = 0;
VV = VV +V;
if VV > VH Then
VH = VV;
if stime < 091500 Then
value3 = VH;
value4 = (((BB-AA)/5)*0.8)+AA;
if (stime >= 091000 and value3 <= VH1/2) or (stime >= 123000) then{
if MarketPosition == 0 and CrossDown(c,value1) and count < 3 Then
buy("b1");
if MarketPosition == 1 and MaxEntries == 1 and count < 3 Then
buy("b2",atlimit,value4);
}
if crossup(c,value2) Then
ExitLong();
if CrossDown(c,Value5) Then
exitlong();
답변 1
예스스탁 예스스탁 답변
2016-02-22 15:06:44
안녕하세요
예스스탁입니다.
input : N(1);
var : AA(0),BB(0),CC(0);
var : TF(0),VV(0),VH(0),VH1(0),upv(0);
var : cnt(0),count(0);
count = 0;
for cnt = 0 to 20{
if sdate ==EntryDate(cnt) Then
count = count+1;
}
AA = (highest(H,5760)+lowest(L,5760))/2;
BB = Highest(H,1800);
var1 = NthHighestBar(1,H,1800);
CC = lowest(L,var1);
value1 = (((BB-AA)/5)*1.8)+AA;
value2 = (((BB-AA)/5)*1.7)+CC;
Value5 = (((BB-AA)/5)*0)+AA;
TF = dayindex%15;
if date != date[1] then{
VV = 0;
VH = 0;
VH1 = VH[1];
}
if (TF < TF[1] and date == date[1]) Then
VV = 0;
VV = VV +V;
if VV > VH Then
VH = VV;
if stime < 091500 Then
value3 = VH;
value4 = (((BB-AA)/5)*0.8)+AA;
if (stime >= 091000 and value3 <= VH1/2) or (stime >= 123000) then{
if MarketPosition == 0 and CrossDown(c,value1) and count < 3 Then
buy("b1");
if MarketPosition == 1 and MaxEntries == 1 and count < 3 Then
buy("b2",atlimit,value4);
}
if MarketPosition == 1 Then{
#종가가 value2를 상향돌파하면
#Condition1에 true 저장
#upv에 종가를 저장
if CrossUp(C,value2) Then{
Condition1 = true;
upv = C;
}
#Condition1이 true이고
#upv-1% 가격이하로 하락하면 즉시 청산
if Condition1 == true Then
ExitLong("bx1",AtStop,upv*0.99);
if CrossDown(c,Value5) Then
ExitLong();
}
Else
Condition1 = false;
즐거운 하루되세요
> 사과쥬스 님이 쓴 글입니다.
> 제목 : 문의드립니다.
>
정교한 수식 작성에 항상 감사드립니다.
아래의 수식에 트레일링 스탑을 설정하고자 합니다.
현재의 수식은 value2의 값을 crossup 한 경우 전량 매도로 설정 되어 있습니다.
value2의 값을 crossup 한 이후 -1%하락 시 전량 매도의 트레일링 스탑 수식이 필요합니다.
감사합니다.
-아래-
input : N(1);
var : AA(0),BB(0),CC(0);
var : TF(0),VV(0),VH(0),VH1(0);
var : cnt(0),count(0);
count = 0;
for cnt = 0 to 20{
if sdate ==EntryDate(cnt) Then
count = count+1;
}
AA = (highest(H,5760)+lowest(L,5760))/2;
BB = Highest(H,1800);
var1 = NthHighestBar(1,H,1800);
CC = lowest(L,var1);
value1 = (((BB-AA)/5)*1.8)+AA;
value2 = (((BB-AA)/5)*1.7)+CC;
Value5 = (((BB-AA)/5)*0)+AA;
TF = dayindex%15;
if date != date[1] then{
VV = 0;
VH = 0;
VH1 = VH[1];
}
if (TF < TF[1] and date == date[1]) Then
VV = 0;
VV = VV +V;
if VV > VH Then
VH = VV;
if stime < 091500 Then
value3 = VH;
value4 = (((BB-AA)/5)*0.8)+AA;
if (stime >= 091000 and value3 <= VH1/2) or (stime >= 123000) then{
if MarketPosition == 0 and CrossDown(c,value1) and count < 3 Then
buy("b1");
if MarketPosition == 1 and MaxEntries == 1 and count < 3 Then
buy("b2",atlimit,value4);
}
if crossup(c,value2) Then
ExitLong();
if CrossDown(c,Value5) Then
exitlong();