커뮤니티
함수변경요청(12-1호)
2015-12-04 06:00:59
141
글번호 93067
안녕하세요?
아래의 함수에서는 매도가 먼저 매수가 나중에 쓰여져 있습니다.
이것을 매수가 먼저 매도가 나중에 오도록 식을 수정하고 싶습니다.
즉 현재는 s1,s2,b 이렇게 나와있는데
b,s1,s2 이렇게 바꾸고 싶습니다.
var : entry(0),NP(0),NP1(0),NP2(0);
var : ho(0),OL(0),HL(0);
var : maho(0),maOL(0),maHL(0);
var : cnt(0),sumho(0),sumOL(0),sumHL(0);
var : EntryCnt(0),cond1(false);
var : V1(0),V2(0),V3(0),V4(0),V5(0),V6(0),V7(0),V8(0),V9(0),V10(0);
NP = NetProfit;
if bdate != bdate[1] Then{
entry = 0;
NP1 = NP[1];
NP2 = NP1[1];
Cond1 = true;
if NP1 > NP2 Then
cond1 = false;
}
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
ho = Dayhigh-Dayopen;
OL = DayOpen-DayLow;
HL = DayHigh-DayLow;
sumho = 0;
sumOL = 0;
sumHL = 0;
for cnt = 1 to 10{
sumho = sumho + (dayhigh(cnt)-dayopen(cnt));
sumOL = sumOL + (DayOpen(cnt)-DayLow(cnt));
sumHL = sumHL + (DayHigh(cnt)-DayLow(cnt));
}
maho = sumho/10;
maOL = sumOL/10;
maHL = sumHL/10;
V1 = dayopen(0)+maho;
V2 = DayOpen(0)-maOL;
V3 = DayOpen(0)+maHL;
V4 = DayOpen(0)-maHL;
V5 = NthMaxList(1,V1,V2,V3,V4);
V6 = NthMaxList(2,V1,V2,V3,V4);
V9 = NthMaxList(3,V1,V2,V3,V4);
V10 = NthMaxList(4,V1,V2,V3,V4);
V7 = (V5+V10)/2;
V8 = (V6+V9)/2;
if MarketPosition == 0 and entry == 0 and cond1 == true Then{
if V7 > V8 Then
sell("s1",AtStop,V7-0.02);
if V7 < V8 Then
sell("s2",Atlimit,V8-0.02);
}
if MarketPosition == -1 and IsEntryName("s1") == true Then{
ExitShort("sp1",atlimit,V9-0.03);
ExitShort("sl1",AtStop,V6);
}
if MarketPosition == -1 and IsEntryName("s2") == true Then{
ExitShort("sp2",atlimit,V9-0.03);
ExitShort("sl2",AtStop,V6);
}
var : TF(0);
var : Xtime(0), Etime(false),mav1(0),mav2(0);
var : HV(0),LV(0),HV1(0),LV1(0),HV2(0),LV2(0);
Array : HH[50](0),LL[50](0),CC[50](0);
mav1 = ma(c,5);
mav2 = ma(C,20);
TF = TimeToMinutes(stime)%30;
if Bdate != Bdate[1] Then{
Etime = true;
if stime >= 090000 Then
Xtime = 060000;
Else
Xtime = 060000;
}
if Bdate != Bdate[1] or (TF < TF[1] and stime > stime[1]) or date != date[1] Then{
HH[0] = H;
LL[0] = L;
for cnt = 1 to 49{
HH[cnt] = HH[cnt-1][1];
LL[cnt] = LL[cnt-1][1];
CC[cnt] = CC[cnt-1][1];
}
}
if H > HH[0] Then
HH[0] = H;
if L < LL[0] Then
LL[0] = L;
CC[0] = C;
if HH[25+2] > 0 Then{
HV = HH[0];
LV = LL[0];
HV1 = HH[1];
LV1 = LL[1];
HV2 = HH[2];
LV2 = LL[2];
for cnt = 0 to 25{
if HH[cnt] > HV Then
HV = HH[cnt];
if LL[cnt] < LV Then
LV = LL[cnt];
if HH[cnt+1] > HV Then
HV = HH[cnt+1];
if LL[cnt+1] < LV Then
LV = LL[cnt+1];
if HH[cnt+2] > HV Then
HV = HH[cnt+2];
if LL[cnt+2] < LV Then
LV = LL[cnt+2];
}
var1 = (HV+LV)/2;
var2 = (HV1+LV1)/2;
var3 = (HV2+LV2)/2;
if Etime == true then{
if MarketPosition == 0 and CC[0] > var1 and CC[1] < var2 and CC[2] < var3 and C >= daylow+0.5 Then
buy("b",AtMarket);
if MarketPosition == 1 and c <= highest(H,BarsSinceEntry)-0.5 and CrossDown(mav1,mav2) Then
ExitLong("bx",AtMarket);
}
}
if stime == Xtime or (stime > Xtime and stime[1] < Xtime) Then{
Etime = false;
ExitLong();
}
SetStopLoss(0.8,PercentStop);
SetStopProfittarget(3,PercentStop);
SetStopInactivity(3,23,PercentStop);
답변 3
통큰베팅
2015-12-04 09:56:44
통큰베팅 님에 의해 삭제된 답변입니다.
통큰베팅
2015-12-04 09:59:31
아래와 같이 변경하고 싶습니다.
NP = NetProfit;
if bdate != bdate[1] Then{
entry = 0;
NP1 = NP[1];
NP2 = NP1[1];
Cond1 = true;
if NP1 > NP2 Then
cond1 = false;
}
var : TF(0);
var : Xtime(0), Etime(false),mav1(0),mav2(0);
var : HV(0),LV(0),HV1(0),LV1(0),HV2(0),LV2(0);
Array : HH[50](0),LL[50](0),CC[50](0);
mav1 = ma(c,5);
mav2 = ma(C,20);
TF = TimeToMinutes(stime)%30;
if Bdate != Bdate[1] Then{
Etime = true;
if stime >= 090000 Then
Xtime = 060000;
Else
Xtime = 060000;
}
if Bdate != Bdate[1] or (TF < TF[1] and stime > stime[1]) or date != date[1] Then{
HH[0] = H;
LL[0] = L;
for cnt = 1 to 49{
HH[cnt] = HH[cnt-1][1];
LL[cnt] = LL[cnt-1][1];
CC[cnt] = CC[cnt-1][1];
}
}
if H > HH[0] Then
HH[0] = H;
if L < LL[0] Then
LL[0] = L;
CC[0] = C;
if HH[25+2] > 0 Then{
HV = HH[0];
LV = LL[0];
HV1 = HH[1];
LV1 = LL[1];
HV2 = HH[2];
LV2 = LL[2];
for cnt = 0 to 25{
if HH[cnt] > HV Then
HV = HH[cnt];
if LL[cnt] < LV Then
LV = LL[cnt];
if HH[cnt+1] > HV Then
HV = HH[cnt+1];
if LL[cnt+1] < LV Then
LV = LL[cnt+1];
if HH[cnt+2] > HV Then
HV = HH[cnt+2];
if LL[cnt+2] < LV Then
LV = LL[cnt+2];
}
var1 = (HV+LV)/2;
var2 = (HV1+LV1)/2;
var3 = (HV2+LV2)/2;
if Etime == true then{
if MarketPosition == 0 and CC[0] > var1 and CC[1] < var2 and CC[2] < var3 and C >= daylow+0.5 Then
buy("b",AtMarket);
if MarketPosition == 1 and c <= highest(H,BarsSinceEntry)-0.5 and CrossDown(mav1,mav2) Then
ExitLong("bx",AtMarket);
}
}
if stime == Xtime or (stime > Xtime and stime[1] < Xtime) Then{
Etime = false;
ExitLong();
}
var : entry(0),NP(0),NP1(0),NP2(0);
var : ho(0),OL(0),HL(0);
var : maho(0),maOL(0),maHL(0);
var : cnt(0),sumho(0),sumOL(0),sumHL(0);
var : EntryCnt(0),cond1(false);
var : V1(0),V2(0),V3(0),V4(0),V5(0),V6(0),V7(0),V8(0),V9(0),V10(0);
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
ho = Dayhigh-Dayopen;
OL = DayOpen-DayLow;
HL = DayHigh-DayLow;
sumho = 0;
sumOL = 0;
sumHL = 0;
for cnt = 1 to 10{
sumho = sumho + (dayhigh(cnt)-dayopen(cnt));
sumOL = sumOL + (DayOpen(cnt)-DayLow(cnt));
sumHL = sumHL + (DayHigh(cnt)-DayLow(cnt));
}
maho = sumho/10;
maOL = sumOL/10;
maHL = sumHL/10;
V1 = dayopen(0)+maho;
V2 = DayOpen(0)-maOL;
V3 = DayOpen(0)+maHL;
V4 = DayOpen(0)-maHL;
V5 = NthMaxList(1,V1,V2,V3,V4);
V6 = NthMaxList(2,V1,V2,V3,V4);
V9 = NthMaxList(3,V1,V2,V3,V4);
V10 = NthMaxList(4,V1,V2,V3,V4);
V7 = (V5+V10)/2;
V8 = (V6+V9)/2;
if MarketPosition == 0 and entry == 0 and cond1 == true Then{
if V7 > V8 Then
sell("s1",AtStop,V7-0.02);
if V7 < V8 Then
sell("s2",Atlimit,V8-0.02);
}
if MarketPosition == -1 and IsEntryName("s1") == true Then{
ExitShort("sp1",atlimit,V9-0.03);
ExitShort("sl1",AtStop,V6);
}
if MarketPosition == -1 and IsEntryName("s2") == true Then{
ExitShort("sp2",atlimit,V9-0.03);
ExitShort("sl2",AtStop,V6);
}
SetStopLoss(0.8,PercentStop);
SetStopProfittarget(3,PercentStop);
SetStopInactivity(3,23,PercentStop);
> 통큰베팅 님이 쓴 글입니다.
> 제목 : 함수변경요청(12-1호)
> 안녕하세요?
아래의 함수에서는 매도가 먼저 매수가 나중에 쓰여져 있습니다.
이것을 매수가 먼저 매도가 나중에 오도록 식을 수정하고 싶습니다.
즉 현재는 s1,s2,b 이렇게 나와있는데
b,s1,s2 이렇게 바꾸고 싶습니다.
var : entry(0),NP(0),NP1(0),NP2(0);
var : ho(0),OL(0),HL(0);
var : maho(0),maOL(0),maHL(0);
var : cnt(0),sumho(0),sumOL(0),sumHL(0);
var : EntryCnt(0),cond1(false);
var : V1(0),V2(0),V3(0),V4(0),V5(0),V6(0),V7(0),V8(0),V9(0),V10(0);
NP = NetProfit;
if bdate != bdate[1] Then{
entry = 0;
NP1 = NP[1];
NP2 = NP1[1];
Cond1 = true;
if NP1 > NP2 Then
cond1 = false;
}
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
ho = Dayhigh-Dayopen;
OL = DayOpen-DayLow;
HL = DayHigh-DayLow;
sumho = 0;
sumOL = 0;
sumHL = 0;
for cnt = 1 to 10{
sumho = sumho + (dayhigh(cnt)-dayopen(cnt));
sumOL = sumOL + (DayOpen(cnt)-DayLow(cnt));
sumHL = sumHL + (DayHigh(cnt)-DayLow(cnt));
}
maho = sumho/10;
maOL = sumOL/10;
maHL = sumHL/10;
V1 = dayopen(0)+maho;
V2 = DayOpen(0)-maOL;
V3 = DayOpen(0)+maHL;
V4 = DayOpen(0)-maHL;
V5 = NthMaxList(1,V1,V2,V3,V4);
V6 = NthMaxList(2,V1,V2,V3,V4);
V9 = NthMaxList(3,V1,V2,V3,V4);
V10 = NthMaxList(4,V1,V2,V3,V4);
V7 = (V5+V10)/2;
V8 = (V6+V9)/2;
if MarketPosition == 0 and entry == 0 and cond1 == true Then{
if V7 > V8 Then
sell("s1",AtStop,V7-0.02);
if V7 < V8 Then
sell("s2",Atlimit,V8-0.02);
}
if MarketPosition == -1 and IsEntryName("s1") == true Then{
ExitShort("sp1",atlimit,V9-0.03);
ExitShort("sl1",AtStop,V6);
}
if MarketPosition == -1 and IsEntryName("s2") == true Then{
ExitShort("sp2",atlimit,V9-0.03);
ExitShort("sl2",AtStop,V6);
}
var : TF(0);
var : Xtime(0), Etime(false),mav1(0),mav2(0);
var : HV(0),LV(0),HV1(0),LV1(0),HV2(0),LV2(0);
Array : HH[50](0),LL[50](0),CC[50](0);
mav1 = ma(c,5);
mav2 = ma(C,20);
TF = TimeToMinutes(stime)%30;
if Bdate != Bdate[1] Then{
Etime = true;
if stime >= 090000 Then
Xtime = 060000;
Else
Xtime = 060000;
}
if Bdate != Bdate[1] or (TF < TF[1] and stime > stime[1]) or date != date[1] Then{
HH[0] = H;
LL[0] = L;
for cnt = 1 to 49{
HH[cnt] = HH[cnt-1][1];
LL[cnt] = LL[cnt-1][1];
CC[cnt] = CC[cnt-1][1];
}
}
if H > HH[0] Then
HH[0] = H;
if L < LL[0] Then
LL[0] = L;
CC[0] = C;
if HH[25+2] > 0 Then{
HV = HH[0];
LV = LL[0];
HV1 = HH[1];
LV1 = LL[1];
HV2 = HH[2];
LV2 = LL[2];
for cnt = 0 to 25{
if HH[cnt] > HV Then
HV = HH[cnt];
if LL[cnt] < LV Then
LV = LL[cnt];
if HH[cnt+1] > HV Then
HV = HH[cnt+1];
if LL[cnt+1] < LV Then
LV = LL[cnt+1];
if HH[cnt+2] > HV Then
HV = HH[cnt+2];
if LL[cnt+2] < LV Then
LV = LL[cnt+2];
}
var1 = (HV+LV)/2;
var2 = (HV1+LV1)/2;
var3 = (HV2+LV2)/2;
if Etime == true then{
if MarketPosition == 0 and CC[0] > var1 and CC[1] < var2 and CC[2] < var3 and C >= daylow+0.5 Then
buy("b",AtMarket);
if MarketPosition == 1 and c <= highest(H,BarsSinceEntry)-0.5 and CrossDown(mav1,mav2) Then
ExitLong("bx",AtMarket);
}
}
if stime == Xtime or (stime > Xtime and stime[1] < Xtime) Then{
Etime = false;
ExitLong();
}
SetStopLoss(0.8,PercentStop);
SetStopProfittarget(3,PercentStop);
SetStopInactivity(3,23,PercentStop);
예스스탁 예스스탁 답변
2015-12-04 14:44:10
안녕하세요
예스스탁입니다.
var : cnt(0),TF(0);
var : Xtime(0), Etime(false),mav1(0),mav2(0);
var : HV(0),LV(0),HV1(0),LV1(0),HV2(0),LV2(0);
Array : HH[50](0),LL[50](0),CC[50](0);
mav1 = ma(c,5);
mav2 = ma(C,20);
TF = TimeToMinutes(stime)%30;
if Bdate != Bdate[1] Then{
Etime = true;
if stime >= 090000 Then
Xtime = 060000;
Else
Xtime = 060000;
}
if Bdate != Bdate[1] or (TF < TF[1] and stime > stime[1]) or date != date[1] Then{
HH[0] = H;
LL[0] = L;
for cnt = 1 to 49{
HH[cnt] = HH[cnt-1][1];
LL[cnt] = LL[cnt-1][1];
CC[cnt] = CC[cnt-1][1];
}
}
if H > HH[0] Then
HH[0] = H;
if L < LL[0] Then
LL[0] = L;
CC[0] = C;
if HH[25+2] > 0 Then{
HV = HH[0];
LV = LL[0];
HV1 = HH[1];
LV1 = LL[1];
HV2 = HH[2];
LV2 = LL[2];
for cnt = 0 to 25{
if HH[cnt] > HV Then
HV = HH[cnt];
if LL[cnt] < LV Then
LV = LL[cnt];
if HH[cnt+1] > HV Then
HV = HH[cnt+1];
if LL[cnt+1] < LV Then
LV = LL[cnt+1];
if HH[cnt+2] > HV Then
HV = HH[cnt+2];
if LL[cnt+2] < LV Then
LV = LL[cnt+2];
}
var1 = (HV+LV)/2;
var2 = (HV1+LV1)/2;
var3 = (HV2+LV2)/2;
if Etime == true then{
if MarketPosition == 0 and CC[0] > var1 and CC[1] < var2 and CC[2] < var3 and C >= daylow+0.5 Then
buy("b",AtMarket);
if MarketPosition == 1 and c <= highest(H,BarsSinceEntry)-0.5 and CrossDown(mav1,mav2) Then
ExitLong("bx",AtMarket);
}
}
if stime == Xtime or (stime > Xtime and stime[1] < Xtime) Then{
Etime = false;
ExitLong();
}
var : entry(0),NP(0),NP1(0),NP2(0);
var : ho(0),OL(0),HL(0);
var : maho(0),maOL(0),maHL(0);
var : sumho(0),sumOL(0),sumHL(0);
var : EntryCnt(0),cond1(false);
var : V1(0),V2(0),V3(0),V4(0),V5(0),V6(0),V7(0),V8(0),V9(0),V10(0);
NP = NetProfit;
if bdate != bdate[1] Then{
entry = 0;
NP1 = NP[1];
NP2 = NP1[1];
Cond1 = true;
if NP1 > NP2 Then
cond1 = false;
}
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
ho = Dayhigh-Dayopen;
OL = DayOpen-DayLow;
HL = DayHigh-DayLow;
sumho = 0;
sumOL = 0;
sumHL = 0;
for cnt = 1 to 10{
sumho = sumho + (dayhigh(cnt)-dayopen(cnt));
sumOL = sumOL + (DayOpen(cnt)-DayLow(cnt));
sumHL = sumHL + (DayHigh(cnt)-DayLow(cnt));
}
maho = sumho/10;
maOL = sumOL/10;
maHL = sumHL/10;
V1 = dayopen(0)+maho;
V2 = DayOpen(0)-maOL;
V3 = DayOpen(0)+maHL;
V4 = DayOpen(0)-maHL;
V5 = NthMaxList(1,V1,V2,V3,V4);
V6 = NthMaxList(2,V1,V2,V3,V4);
V9 = NthMaxList(3,V1,V2,V3,V4);
V10 = NthMaxList(4,V1,V2,V3,V4);
V7 = (V5+V10)/2;
V8 = (V6+V9)/2;
if MarketPosition == 0 and entry == 0 and cond1 == true Then{
if V7 > V8 Then
sell("s1",AtStop,V7-0.02);
if V7 < V8 Then
sell("s2",Atlimit,V8-0.02);
}
if MarketPosition == -1 and IsEntryName("s1") == true Then{
ExitShort("sp1",atlimit,V9-0.03);
ExitShort("sl1",AtStop,V6);
}
if MarketPosition == -1 and IsEntryName("s2") == true Then{
ExitShort("sp2",atlimit,V9-0.03);
ExitShort("sl2",AtStop,V6);
}
SetStopLoss(0.8,PercentStop);
SetStopProfittarget(3,PercentStop);
SetStopInactivity(3,23,PercentStop);
즐거운 하루되세요
> 통큰베팅 님이 쓴 글입니다.
> 제목 : Re : 함수변경요청(12-1호)
> 아래와 같이 변경하고 싶습니다.
NP = NetProfit;
if bdate != bdate[1] Then{
entry = 0;
NP1 = NP[1];
NP2 = NP1[1];
Cond1 = true;
if NP1 > NP2 Then
cond1 = false;
}
var : TF(0);
var : Xtime(0), Etime(false),mav1(0),mav2(0);
var : HV(0),LV(0),HV1(0),LV1(0),HV2(0),LV2(0);
Array : HH[50](0),LL[50](0),CC[50](0);
mav1 = ma(c,5);
mav2 = ma(C,20);
TF = TimeToMinutes(stime)%30;
if Bdate != Bdate[1] Then{
Etime = true;
if stime >= 090000 Then
Xtime = 060000;
Else
Xtime = 060000;
}
if Bdate != Bdate[1] or (TF < TF[1] and stime > stime[1]) or date != date[1] Then{
HH[0] = H;
LL[0] = L;
for cnt = 1 to 49{
HH[cnt] = HH[cnt-1][1];
LL[cnt] = LL[cnt-1][1];
CC[cnt] = CC[cnt-1][1];
}
}
if H > HH[0] Then
HH[0] = H;
if L < LL[0] Then
LL[0] = L;
CC[0] = C;
if HH[25+2] > 0 Then{
HV = HH[0];
LV = LL[0];
HV1 = HH[1];
LV1 = LL[1];
HV2 = HH[2];
LV2 = LL[2];
for cnt = 0 to 25{
if HH[cnt] > HV Then
HV = HH[cnt];
if LL[cnt] < LV Then
LV = LL[cnt];
if HH[cnt+1] > HV Then
HV = HH[cnt+1];
if LL[cnt+1] < LV Then
LV = LL[cnt+1];
if HH[cnt+2] > HV Then
HV = HH[cnt+2];
if LL[cnt+2] < LV Then
LV = LL[cnt+2];
}
var1 = (HV+LV)/2;
var2 = (HV1+LV1)/2;
var3 = (HV2+LV2)/2;
if Etime == true then{
if MarketPosition == 0 and CC[0] > var1 and CC[1] < var2 and CC[2] < var3 and C >= daylow+0.5 Then
buy("b",AtMarket);
if MarketPosition == 1 and c <= highest(H,BarsSinceEntry)-0.5 and CrossDown(mav1,mav2) Then
ExitLong("bx",AtMarket);
}
}
if stime == Xtime or (stime > Xtime and stime[1] < Xtime) Then{
Etime = false;
ExitLong();
}
var : entry(0),NP(0),NP1(0),NP2(0);
var : ho(0),OL(0),HL(0);
var : maho(0),maOL(0),maHL(0);
var : cnt(0),sumho(0),sumOL(0),sumHL(0);
var : EntryCnt(0),cond1(false);
var : V1(0),V2(0),V3(0),V4(0),V5(0),V6(0),V7(0),V8(0),V9(0),V10(0);
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
ho = Dayhigh-Dayopen;
OL = DayOpen-DayLow;
HL = DayHigh-DayLow;
sumho = 0;
sumOL = 0;
sumHL = 0;
for cnt = 1 to 10{
sumho = sumho + (dayhigh(cnt)-dayopen(cnt));
sumOL = sumOL + (DayOpen(cnt)-DayLow(cnt));
sumHL = sumHL + (DayHigh(cnt)-DayLow(cnt));
}
maho = sumho/10;
maOL = sumOL/10;
maHL = sumHL/10;
V1 = dayopen(0)+maho;
V2 = DayOpen(0)-maOL;
V3 = DayOpen(0)+maHL;
V4 = DayOpen(0)-maHL;
V5 = NthMaxList(1,V1,V2,V3,V4);
V6 = NthMaxList(2,V1,V2,V3,V4);
V9 = NthMaxList(3,V1,V2,V3,V4);
V10 = NthMaxList(4,V1,V2,V3,V4);
V7 = (V5+V10)/2;
V8 = (V6+V9)/2;
if MarketPosition == 0 and entry == 0 and cond1 == true Then{
if V7 > V8 Then
sell("s1",AtStop,V7-0.02);
if V7 < V8 Then
sell("s2",Atlimit,V8-0.02);
}
if MarketPosition == -1 and IsEntryName("s1") == true Then{
ExitShort("sp1",atlimit,V9-0.03);
ExitShort("sl1",AtStop,V6);
}
if MarketPosition == -1 and IsEntryName("s2") == true Then{
ExitShort("sp2",atlimit,V9-0.03);
ExitShort("sl2",AtStop,V6);
}
SetStopLoss(0.8,PercentStop);
SetStopProfittarget(3,PercentStop);
SetStopInactivity(3,23,PercentStop);
> 통큰베팅 님이 쓴 글입니다.
> 제목 : 함수변경요청(12-1호)
> 안녕하세요?
아래의 함수에서는 매도가 먼저 매수가 나중에 쓰여져 있습니다.
이것을 매수가 먼저 매도가 나중에 오도록 식을 수정하고 싶습니다.
즉 현재는 s1,s2,b 이렇게 나와있는데
b,s1,s2 이렇게 바꾸고 싶습니다.
var : entry(0),NP(0),NP1(0),NP2(0);
var : ho(0),OL(0),HL(0);
var : maho(0),maOL(0),maHL(0);
var : cnt(0),sumho(0),sumOL(0),sumHL(0);
var : EntryCnt(0),cond1(false);
var : V1(0),V2(0),V3(0),V4(0),V5(0),V6(0),V7(0),V8(0),V9(0),V10(0);
NP = NetProfit;
if bdate != bdate[1] Then{
entry = 0;
NP1 = NP[1];
NP2 = NP1[1];
Cond1 = true;
if NP1 > NP2 Then
cond1 = false;
}
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
ho = Dayhigh-Dayopen;
OL = DayOpen-DayLow;
HL = DayHigh-DayLow;
sumho = 0;
sumOL = 0;
sumHL = 0;
for cnt = 1 to 10{
sumho = sumho + (dayhigh(cnt)-dayopen(cnt));
sumOL = sumOL + (DayOpen(cnt)-DayLow(cnt));
sumHL = sumHL + (DayHigh(cnt)-DayLow(cnt));
}
maho = sumho/10;
maOL = sumOL/10;
maHL = sumHL/10;
V1 = dayopen(0)+maho;
V2 = DayOpen(0)-maOL;
V3 = DayOpen(0)+maHL;
V4 = DayOpen(0)-maHL;
V5 = NthMaxList(1,V1,V2,V3,V4);
V6 = NthMaxList(2,V1,V2,V3,V4);
V9 = NthMaxList(3,V1,V2,V3,V4);
V10 = NthMaxList(4,V1,V2,V3,V4);
V7 = (V5+V10)/2;
V8 = (V6+V9)/2;
if MarketPosition == 0 and entry == 0 and cond1 == true Then{
if V7 > V8 Then
sell("s1",AtStop,V7-0.02);
if V7 < V8 Then
sell("s2",Atlimit,V8-0.02);
}
if MarketPosition == -1 and IsEntryName("s1") == true Then{
ExitShort("sp1",atlimit,V9-0.03);
ExitShort("sl1",AtStop,V6);
}
if MarketPosition == -1 and IsEntryName("s2") == true Then{
ExitShort("sp2",atlimit,V9-0.03);
ExitShort("sl2",AtStop,V6);
}
var : TF(0);
var : Xtime(0), Etime(false),mav1(0),mav2(0);
var : HV(0),LV(0),HV1(0),LV1(0),HV2(0),LV2(0);
Array : HH[50](0),LL[50](0),CC[50](0);
mav1 = ma(c,5);
mav2 = ma(C,20);
TF = TimeToMinutes(stime)%30;
if Bdate != Bdate[1] Then{
Etime = true;
if stime >= 090000 Then
Xtime = 060000;
Else
Xtime = 060000;
}
if Bdate != Bdate[1] or (TF < TF[1] and stime > stime[1]) or date != date[1] Then{
HH[0] = H;
LL[0] = L;
for cnt = 1 to 49{
HH[cnt] = HH[cnt-1][1];
LL[cnt] = LL[cnt-1][1];
CC[cnt] = CC[cnt-1][1];
}
}
if H > HH[0] Then
HH[0] = H;
if L < LL[0] Then
LL[0] = L;
CC[0] = C;
if HH[25+2] > 0 Then{
HV = HH[0];
LV = LL[0];
HV1 = HH[1];
LV1 = LL[1];
HV2 = HH[2];
LV2 = LL[2];
for cnt = 0 to 25{
if HH[cnt] > HV Then
HV = HH[cnt];
if LL[cnt] < LV Then
LV = LL[cnt];
if HH[cnt+1] > HV Then
HV = HH[cnt+1];
if LL[cnt+1] < LV Then
LV = LL[cnt+1];
if HH[cnt+2] > HV Then
HV = HH[cnt+2];
if LL[cnt+2] < LV Then
LV = LL[cnt+2];
}
var1 = (HV+LV)/2;
var2 = (HV1+LV1)/2;
var3 = (HV2+LV2)/2;
if Etime == true then{
if MarketPosition == 0 and CC[0] > var1 and CC[1] < var2 and CC[2] < var3 and C >= daylow+0.5 Then
buy("b",AtMarket);
if MarketPosition == 1 and c <= highest(H,BarsSinceEntry)-0.5 and CrossDown(mav1,mav2) Then
ExitLong("bx",AtMarket);
}
}
if stime == Xtime or (stime > Xtime and stime[1] < Xtime) Then{
Etime = false;
ExitLong();
}
SetStopLoss(0.8,PercentStop);
SetStopProfittarget(3,PercentStop);
SetStopInactivity(3,23,PercentStop);
다음글
이전글