커뮤니티
수익 손실별 진입횟수 제한
2008-02-11 21:43:53
746
글번호 14692
var : count(0),Profit(0),Loss(0);
Profit = 0 ;
loss = 0;
for Value1 = 0 to 20 {
if EntryDate(Value1) == sdate and PositionProfit(value1) > 0 then
Profit = Profit + 1;
if EntryDate(Value1) == sdate and PositionProfit(value1) < 0 then
loss = loss + 1;
}
if crossup(c,ma(c,20)) and Profit < 2 Then //또는 and loss < 2
buy();
if CrossDown(c,ma(c,20)) Then
exitlong();
1.위 수식이 일별 수익 손일별로 진입횟수를 제한하는 수식인데요.
일별이 아닌 주별(week) 또는 월별(month)로 설정하는 방법이 있는지요...
2. 단순한 수익/손실 횟수 를 초월해서
연속 수익/손실별로 제한을 걸 수도 있습니까?
예를 들어 당일 연속으로 2번 수익이 나면 진입금지 이런 식으루요...
답변 1
예스스탁 예스스탁 답변
2008-02-12 16:19:10
안녕하세요
예스스탁입니다.
1. 월별
var : count(0),Profit(0),Loss(0);
Profit = 0 ;
loss = 0;
for Value1 = 0 to 20 {
if int(FracPortion(EntryDate(value1)/10000)*100) == int(FracPortion(sdate/10000)*100)
and PositionProfit(value1) > 0 then
Profit = Profit + 1;
if int(FracPortion(EntryDate(value1)/10000)*100) == int(FracPortion(sdate/10000)*100)
and PositionProfit(value1) < 0 then
loss = loss + 1;
}
if crossup(c,ma(c,20)) and loss < 2 Then //또는 and loss < 2
buy();
if CrossDown(c,ma(c,20)) Then
exitlong();
2. 주별
var : Bval(0),Exval(0),Profit(0),Loss(0);
if DayOfWeek(sdate) < DayOfWeek(Sdate) Then{
Profit = 0;
Loss = 0;
}
if crossup(c,ma(c,20)) and Profit < 2 Then{ //또는 and loss < 2
buy();
Bval = C;
}
if CrossDown(c,ma(c,20)) Then{
exitlong();
ExVal = C;
if Exval - Bval > 0 Then
Profit = Profit+1;
if Exval - Bval < 0 Then
loss = Loss +1;
}
3. 연속손실
var : Bval(0),Exval(0),Profit(0),Loss(0);
if date != date[1] Then{
Profit = 0;
Loss = 0;
}
if crossup(c,ma(c,20)) and Profit < 2 Then{ //또는 and loss < 2
buy();
Bval = C;
}
if CrossDown(c,ma(c,20)) Then{
exitlong();
ExVal = C;
if Exval - Bval > 0 Then
Profit = Profit+1;
Else
Profit = 0;
if Exval - Bval < 0 Then
loss = Loss +1;
Else
Loss = 0;
}
즐거운 하루되세요
> 도레미트리오 님이 쓴 글입니다.
> 제목 : 수익 손실별 진입횟수 제한
> var : count(0),Profit(0),Loss(0);
Profit = 0 ;
loss = 0;
for Value1 = 0 to 20 {
if EntryDate(Value1) == sdate and PositionProfit(value1) > 0 then
Profit = Profit + 1;
if EntryDate(Value1) == sdate and PositionProfit(value1) < 0 then
loss = loss + 1;
}
if crossup(c,ma(c,20)) and Profit < 2 Then //또는 and loss < 2
buy();
if CrossDown(c,ma(c,20)) Then
exitlong();
1.위 수식이 일별 수익 손일별로 진입횟수를 제한하는 수식인데요.
일별이 아닌 주별(week) 또는 월별(month)로 설정하는 방법이 있는지요...
2. 단순한 수익/손실 횟수 를 초월해서
연속 수익/손실별로 제한을 걸 수도 있습니까?
예를 들어 당일 연속으로 2번 수익이 나면 진입금지 이런 식으루요...
다음글