커뮤니티
함수수정요청(251)
2016-04-19 07:03:42
99
글번호 97218
안녕하세요?
아래의 함수 수정요청드립니다.
1. 직전거래가 3번연속 손실이 발생되면 4번째 거래를 그만하고자 합니다. (날짜와 무관)
2. 직전거래 3번 연속 손실이 발생되면 당일 거래를 그만하고자 합니다.
1번과 2번식을 각각 부탁드립니다.
input : starttime(70000), xtime(60000);
var : tcond(false),cond1(false),cond2(false);
if stime == starttime or (stime > starttime and stime[1] < starttime) Then{
Tcond = true;
Condition1 = false;
Condition2 = false;
}
if stime == xtime or (stime > xtime and stime[1] < Xtime) Then{
Tcond = false;
}
var1 = ma(c,5);
var2 = ma(c,20);
cond1 = C > var1 and var1 > var2;
cond2 = C < var1 and var1 < var2;
if cond1 == true and cond1[1] == false then
Condition1 = true;
if cond2 == true and cond2[1] == false then
Condition2 = true;
if Tcond == true And
Condition1 == true and cond1 == true and
var1 > var1[1] and var2 > var2[1] Then
buy();
if Tcond == true And
Condition2 == true and Cond2 == true and
var1 < var1[1] and var2 < var2[1] Then
sell();
답변 1
예스스탁 예스스탁 답변
2016-04-19 14:22:17
안녕하세요
예스스탁입니다.
1.
input : starttime(70000), xtime(60000);
var : tcond(false),cond1(false),cond2(false),Xcond(false);
if MarketPosition == 0 and PositionProfit(1) < 0 and PositionProfit(2) < 0 and PositionProfit(3) < 0 Then
Xcond = true;
Else if MarketPosition != 0 and PositionProfit(0) < 0 and PositionProfit(1) < 0 and PositionProfit(2) < 0 Then
Xcond = true;
Else
Xcond = false;
if stime == starttime or (stime > starttime and stime[1] < starttime) Then{
Tcond = true;
Condition1 = false;
Condition2 = false;
}
if stime == xtime or (stime > xtime and stime[1] < Xtime) Then{
Tcond = false;
}
var1 = ma(c,5);
var2 = ma(c,20);
cond1 = C > var1 and var1 > var2;
cond2 = C < var1 and var1 < var2;
if cond1 == true and cond1[1] == false then
Condition1 = true;
if cond2 == true and cond2[1] == false then
Condition2 = true;
if Tcond == true And
Condition1 == true and cond1 == true and
var1 > var1[1] and var2 > var2[1] Then{
if Xcond == false Then
buy();
if Xcond == true Then
ExitShort();
}
if Tcond == true And
Condition2 == true and Cond2 == true and
var1 < var1[1] and var2 < var2[1] Then{
if Xcond == false Then
Sell();
if Xcond == true Then
Exitlong();
}
2.
input : starttime(70000), xtime(60000);
var : tcond(false),cond1(false),cond2(false),Xcond(false);
var : T1(0),TT(0),entry(0);
TT = TotalTrades;
if stime == starttime or (stime > starttime and stime[1] < starttime) Then{
Tcond = true;
Xcond = false;
T1 = TT;
Condition1 = false;
Condition2 = false;
}
if stime == xtime or (stime > xtime and stime[1] < Xtime) Then{
Tcond = false;
}
if MarketPosition == 0 Then
entry = TT-T1;
Else
entry = TT-T1+1;
if MarketPosition == 0 and entry >= 3 and PositionProfit(1) < 0 and PositionProfit(2) < 0 and PositionProfit(3) < 0 Then
Xcond = true;
Else if MarketPosition != 0 and entry >= 3 and PositionProfit(0) < 0 and PositionProfit(1) < 0 and PositionProfit(2) < 0 Then
Xcond = true;
Else
Xcond = false;
var1 = ma(c,5);
var2 = ma(c,20);
cond1 = C > var1 and var1 > var2;
cond2 = C < var1 and var1 < var2;
if cond1 == true and cond1[1] == false then
Condition1 = true;
if cond2 == true and cond2[1] == false then
Condition2 = true;
if Tcond == true And
Condition1 == true and cond1 == true and
var1 > var1[1] and var2 > var2[1] Then{
if Xcond == false Then
buy();
if Xcond == true Then
ExitShort();
}
if Tcond == true And
Condition2 == true and Cond2 == true and
var1 < var1[1] and var2 < var2[1] Then{
if Xcond == false Then
Sell();
if Xcond == true Then
Exitlong();
}
즐거운 하루되세요
> 통큰베팅 님이 쓴 글입니다.
> 제목 : 함수수정요청(251)
> 안녕하세요?
아래의 함수 수정요청드립니다.
1. 직전거래가 3번연속 손실이 발생되면 4번째 거래를 그만하고자 합니다. (날짜와 무관)
2. 직전거래 3번 연속 손실이 발생되면 당일 거래를 그만하고자 합니다.
1번과 2번식을 각각 부탁드립니다.
input : starttime(70000), xtime(60000);
var : tcond(false),cond1(false),cond2(false);
if stime == starttime or (stime > starttime and stime[1] < starttime) Then{
Tcond = true;
Condition1 = false;
Condition2 = false;
}
if stime == xtime or (stime > xtime and stime[1] < Xtime) Then{
Tcond = false;
}
var1 = ma(c,5);
var2 = ma(c,20);
cond1 = C > var1 and var1 > var2;
cond2 = C < var1 and var1 < var2;
if cond1 == true and cond1[1] == false then
Condition1 = true;
if cond2 == true and cond2[1] == false then
Condition2 = true;
if Tcond == true And
Condition1 == true and cond1 == true and
var1 > var1[1] and var2 > var2[1] Then
buy();
if Tcond == true And
Condition2 == true and Cond2 == true and
var1 < var1[1] and var2 < var2[1] Then
sell();