커뮤니티
익절값 변동(재 질문입니다.)
2012-08-07 12:04:45
189
글번호 53561
아래 익절값 변동식에서 "value3> 100" 조건과
"당일 value3의 최대값이 200 이상"일경우를 더하려면 어떻게 해야 하는지요?
아래와 같이 바꿨는데 안되네요.
if MarketPosition == 1 Then{
if value3 > 100 and dayhigh(value3) > 200 Then
exitlong("bx1",Atlimit,EntryPrice+3.5);
Else
exitlong("bx2",Atlimit,EntryPrice+2.0);
}
if MarketPosition == -1 Then{
if value3 > 100 and dayhigh(value3) > 200 Then
ExitShort("sx1",Atlimit,EntryPrice-3.5);
Else
ExitShort("sx2",Atlimit,EntryPrice-2.0);
}
> 예스스탁 님이 쓴 글입니다.
안녕하세요
예스스탁입니다.
식을 풀어서 작성하셔야 합니다.
Input : period2(2);
input : Vol3(1),value(0);
var : count(0),cnt(0);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;}
value1 = 수식1;
value2 = 수식2;
value3 = 수식3;
#당일 발생한 청산 중 최근청산이 손절이나 목표수익이면 true 아니면 false
Condition1 = ExitDate(1) == sdate and (IsExitName("StopLoss",1) == true or IsExitName("StopProfittarget",1) == true);
if count == 0 or (MarketPosition == 0 and Condition1 == false and BarsSinceExit(1) > 0) or MarketPosition != 0 then{
If 매수조건 then
buy("b1");
If 매도조건 then
Sell("s1");
}
if (MarketPosition == 0 and Condition1 == true and BarsSinceExit(1) > 0) or MarketPosition != 0 then{
if MarketPosition(1) == -1 and 매수조건 then
buy("b2");
if MarketPosition(1) == 1 and 매도조건 then
Sell("s2");
}
# 매수청산
If 매수청산조건 Then
{
Exitlong();
}
# 매도청산
If 매도청산조건 Then
{
Exitshort();
}
if MarketPosition == 1 Then{
if value3 > 100 Then
exitlong("bx1",Atlimit,EntryPrice+3.5);
Else
exitlong("bx2",Atlimit,EntryPrice+2.0);
}
if MarketPosition == -1 Then{
if value3 > 100 Then
ExitShort("sx1",Atlimit,EntryPrice-3.5);
Else
ExitShort("sx2",Atlimit,EntryPrice-2.0);
}
SetStopLoss(2.0,PointStop);
SetStopEndofday(150000);
즐거운 하루되세요
> 몸통공격 님이 쓴 글입니다.
> 제목 : 익절값 변경
> 시스템식은 아래와 같습니다.
value1,value2 ,value3 지표이며 이를 바탕으로 매수,매도,청산 조건을 부여합니다.
손절,익절 모두 2.0 point 식입니다.
그런데 이중 value3지표 값의 크기에 따라서 익절폭을 달리 하고자 합니다.
즉, value3의 크기가 100 보다 크면 3.5point로 익절을 하고,
100보다 작으면 지금처럼 2.0 point 익절을 하려고 합니다.
모든 것은 그대로 두고 하나의 시스템으로서 익절폭만 달리 하고자 할 때 어떻게 만들어야 하는지 알려 주십시오,. 감사합니다.
*********************************************************************************
Input : period2(2);
input : Vol3(1),value(0);
var : count(0),cnt(0);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;}
value1 = 수식1;
value2 = 수식2;
value3 = 수식3;
#당일 발생한 청산 중 최근청산이 손절이나 목표수익이면 true 아니면 false
Condition1 = ExitDate(1) == sdate and (IsExitName("StopLoss",1) == true or IsExitName("StopProfittarget",1) == true);
if count == 0 or (MarketPosition == 0 and Condition1 == false and BarsSinceExit(1) > 0) or MarketPosition != 0 then{
If 매수조건 then
buy("b1");
If 매도조건 then
Sell("s1");
}
if (MarketPosition == 0 and Condition1 == true and BarsSinceExit(1) > 0) or MarketPosition != 0 then{
if MarketPosition(1) == -1 and 매수조건 then
buy("b2");
if MarketPosition(1) == 1 and 매도조건 then
Sell("s2");
}
# 매수청산
If 매수청산조건 Then
{
Exitlong();
}
# 매도청산
If 매도청산조건 Then
{
Exitshort();
}
SetStopLoss(2.0,PointStop);
SetStopProfittarget(2.0,pointStop);
SetStopEndofday(150000);
답변 1
예스스탁 예스스탁 답변
2012-08-07 14:40:18
안녕하세요
예스스탁입니다.
if MarketPosition == 1 Then{
if value3 > 100 and highest(value3,dayindex+1) > 200 Then
exitlong("bx1",Atlimit,EntryPrice+3.5);
else
exitlong("bx2",Atlimit,EntryPrice+2.0);
}
if MarketPosition == -1 Then{
if value3 > 100 and highest(value3,dayindex+1) > 200 Then
ExitShort("sx1",Atlimit,EntryPrice-3.5);
Else
ExitShort("sx2",Atlimit,EntryPrice-2.0);
}
즐거운 하루되세요
> 몸통공격 님이 쓴 글입니다.
> 제목 : 익절값 변동(재 질문입니다.)
> 아래 익절값 변동식에서 "value3> 100" 조건과
"당일 value3의 최대값이 200 이상"일경우를 더하려면 어떻게 해야 하는지요?
아래와 같이 바꿨는데 안되네요.
if MarketPosition == 1 Then{
if value3 > 100 and dayhigh(value3) > 200 Then
exitlong("bx1",Atlimit,EntryPrice+3.5);
Else
exitlong("bx2",Atlimit,EntryPrice+2.0);
}
if MarketPosition == -1 Then{
if value3 > 100 and dayhigh(value3) > 200 Then
ExitShort("sx1",Atlimit,EntryPrice-3.5);
Else
ExitShort("sx2",Atlimit,EntryPrice-2.0);
}
> 예스스탁 님이 쓴 글입니다.
안녕하세요
예스스탁입니다.
식을 풀어서 작성하셔야 합니다.
Input : period2(2);
input : Vol3(1),value(0);
var : count(0),cnt(0);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;}
value1 = 수식1;
value2 = 수식2;
value3 = 수식3;
#당일 발생한 청산 중 최근청산이 손절이나 목표수익이면 true 아니면 false
Condition1 = ExitDate(1) == sdate and (IsExitName("StopLoss",1) == true or IsExitName("StopProfittarget",1) == true);
if count == 0 or (MarketPosition == 0 and Condition1 == false and BarsSinceExit(1) > 0) or MarketPosition != 0 then{
If 매수조건 then
buy("b1");
If 매도조건 then
Sell("s1");
}
if (MarketPosition == 0 and Condition1 == true and BarsSinceExit(1) > 0) or MarketPosition != 0 then{
if MarketPosition(1) == -1 and 매수조건 then
buy("b2");
if MarketPosition(1) == 1 and 매도조건 then
Sell("s2");
}
# 매수청산
If 매수청산조건 Then
{
Exitlong();
}
# 매도청산
If 매도청산조건 Then
{
Exitshort();
}
if MarketPosition == 1 Then{
if value3 > 100 Then
exitlong("bx1",Atlimit,EntryPrice+3.5);
Else
exitlong("bx2",Atlimit,EntryPrice+2.0);
}
if MarketPosition == -1 Then{
if value3 > 100 Then
ExitShort("sx1",Atlimit,EntryPrice-3.5);
Else
ExitShort("sx2",Atlimit,EntryPrice-2.0);
}
SetStopLoss(2.0,PointStop);
SetStopEndofday(150000);
즐거운 하루되세요
> 몸통공격 님이 쓴 글입니다.
> 제목 : 익절값 변경
> 시스템식은 아래와 같습니다.
value1,value2 ,value3 지표이며 이를 바탕으로 매수,매도,청산 조건을 부여합니다.
손절,익절 모두 2.0 point 식입니다.
그런데 이중 value3지표 값의 크기에 따라서 익절폭을 달리 하고자 합니다.
즉, value3의 크기가 100 보다 크면 3.5point로 익절을 하고,
100보다 작으면 지금처럼 2.0 point 익절을 하려고 합니다.
모든 것은 그대로 두고 하나의 시스템으로서 익절폭만 달리 하고자 할 때 어떻게 만들어야 하는지 알려 주십시오,. 감사합니다.
*********************************************************************************
Input : period2(2);
input : Vol3(1),value(0);
var : count(0),cnt(0);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;}
value1 = 수식1;
value2 = 수식2;
value3 = 수식3;
#당일 발생한 청산 중 최근청산이 손절이나 목표수익이면 true 아니면 false
Condition1 = ExitDate(1) == sdate and (IsExitName("StopLoss",1) == true or IsExitName("StopProfittarget",1) == true);
if count == 0 or (MarketPosition == 0 and Condition1 == false and BarsSinceExit(1) > 0) or MarketPosition != 0 then{
If 매수조건 then
buy("b1");
If 매도조건 then
Sell("s1");
}
if (MarketPosition == 0 and Condition1 == true and BarsSinceExit(1) > 0) or MarketPosition != 0 then{
if MarketPosition(1) == -1 and 매수조건 then
buy("b2");
if MarketPosition(1) == 1 and 매도조건 then
Sell("s2");
}
# 매수청산
If 매수청산조건 Then
{
Exitlong();
}
# 매도청산
If 매도청산조건 Then
{
Exitshort();
}
SetStopLoss(2.0,PointStop);
SetStopProfittarget(2.0,pointStop);
SetStopEndofday(150000);