커뮤니티
26409 재문의
2012-09-25 23:06:08
376
글번호 55050
익절 후 같은 신호가 안 나오게 하려면 어떻게 해야 하는지요?
그림에서 보면
첫신호가 매도진입해서 매도로 익절 됐으니
매수신호에서만 진입하기를 원하는데 다시 매도 진입이 되 버립니다.
매수익절 후에도 매수진입이 또 나옵니다.
익절된 방향으로는 재진입이 안 나오도록 해 주십시오.
input : Period1(2),period2(5);
input : Vol3(1),value(0);
var : count(0),cnt(0),SA1(0);
var : a(0);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;}
a = fffff(0.9)/gggg(hhhh*1.1);
value1 = ######;
value2 = ######;
value3 = ######;
#당일 발생한 청산 중 최근청산이 손절이나 목표수익이면 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 If (매수조건) then
buy("b2");
if MarketPosition(1) == 1 and If (매도조건) then
Sell("s2");
}
##익절조건##
if MarketPosition == 1 Then{
if (익절조건1) Then
exitlong("bx1",Atlimit,EntryPrice+1.2);
if (익절조건2) Then
exitlong("bx2",Atlimit,EntryPrice+0.9);
}
if MarketPosition == -1 Then{
if (익절조건1) Then
ExitShort("sx1",Atlimit,EntryPrice-1.2);
if (익절조건2) Then
ExitShort("sx2",Atlimit,EntryPrice-0.9);
}
if MarketPosition == 1 Then{
if (익절조건3) Then
exitlong("bx3",Atlimit,EntryPrice+2.0);
if (익절조건4) Then
exitlong("bx4",Atlimit,EntryPrice+1.5);
}
if MarketPosition == -1 Then{
if (익절조건3) Then
ExitShort("sx5",Atlimit,EntryPrice-2.0);
if (익절조건4) Then
ExitShort("sx6",Atlimit,EntryPrice-1.5);
}
if MarketPosition == 1 Then{
if (익절조건5) Then
exitlong("bx7",Atlimit,EntryPrice+3.0);
if (익절조건6) Then
exitlong("bx8",Atlimit,EntryPrice+2.5);
}
if MarketPosition == -1 Then{
if (익절조건5) Then
ExitShort("sx9",Atlimit,EntryPrice-3.0);
if (익절조건6) Then
ExitShort("sx10",Atlimit,EntryPrice-2.5);
}
if MarketPosition == 1 Then{
if (익절조건7) Then
exitlong("bx11",Atlimit,EntryPrice+6.5);
if (익절조건8) Then
exitlong("bx12",Atlimit,EntryPrice+4.5);
}
if MarketPosition == -1 Then{
if (익절조건7) Then
ExitShort("sx13",Atlimit,EntryPrice-6.5);
if (익절조건8) Then
ExitShort("sx14",Atlimit,EntryPrice-4.5);
}
# 매수청산
If (매수청산 조건) Then
{
Exitlong();
}
# 매도청산
If (매도청산 조건) Then
{
Exitshort();
}
SetStopLoss(1.0,PointStop);
SetStopEndofday(150000);
- 1. 메가2.jpg (0.07 MB)
답변 1
예스스탁 예스스탁 답변
2012-09-26 09:25:38
안녕하세요
예스스탁입니다.
input : Period1(2),period2(5);
input : Vol3(1),value(0);
var : count(0),cnt(0),SA1(0);
var : a(0);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;}
a = fffff(0.9)/gggg(hhhh*1.1);
value1 = ######;
value2 = ######;
value3 = ######;
Condition2 = MarketPosition == 0 and MarketPosition(1) == 1 and MarketPosition == 0 and
(IsExitName("bx1") or IsExitName("bx2") or IsExitName("bx3") or IsExitName("bx4")
or IsExitName("bx7") or IsExitName("bx8") or IsExitName("bx11") or IsExitName("bx12"));
Condition3 = MarketPosition == 0 and MarketPosition(1) == -1 and MarketPosition == 0 and
(IsExitName("sx1") or IsExitName("sx2") or IsExitName("sx5") or IsExitName("sx6")
or IsExitName("sx9") or IsExitName("sx10") or IsExitName("sx13") or IsExitName("sx14"));
#당일 첫진입
if count == 0 Then {
If (매수조건) then
buy("b1");
If (매도조건) then
Sell("s1");
}
#당일 첫진입 이후 반대포지션에 리버스
if count > 0 then{
If (MarketPosition == -1 and 매수조건) then
buy("b1");
If (MarketPosition == 1 and 매도조건) then
Sell("s1");
}
#당일 첫진입 이후 무포지션에 상태
if count > 0 and MarketPosition == 0 then{
If (매수조건) and Condition2 == false then
buy("b1");
If (매도조건) and Condition3 == false then
Sell("s1");
}
##익절조건##
if MarketPosition == 1 Then{
if (익절조건1) Then
exitlong("bx1",Atlimit,EntryPrice+1.2);
if (익절조건2) Then
exitlong("bx2",Atlimit,EntryPrice+0.9);
}
if MarketPosition == -1 Then{
if (익절조건1) Then
ExitShort("sx1",Atlimit,EntryPrice-1.2);
if (익절조건2) Then
ExitShort("sx2",Atlimit,EntryPrice-0.9);
}
if MarketPosition == 1 Then{
if (익절조건3) Then
exitlong("bx3",Atlimit,EntryPrice+2.0);
if (익절조건4) Then
exitlong("bx4",Atlimit,EntryPrice+1.5);
}
if MarketPosition == -1 Then{
if (익절조건3) Then
ExitShort("sx5",Atlimit,EntryPrice-2.0);
if (익절조건4) Then
ExitShort("sx6",Atlimit,EntryPrice-1.5);
}
if MarketPosition == 1 Then{
if (익절조건5) Then
exitlong("bx7",Atlimit,EntryPrice+3.0);
if (익절조건6) Then
exitlong("bx8",Atlimit,EntryPrice+2.5);
}
if MarketPosition == -1 Then{
if (익절조건5) Then
ExitShort("sx9",Atlimit,EntryPrice-3.0);
if (익절조건6) Then
ExitShort("sx10",Atlimit,EntryPrice-2.5);
}
if MarketPosition == 1 Then{
if (익절조건7) Then
exitlong("bx11",Atlimit,EntryPrice+6.5);
if (익절조건8) Then
exitlong("bx12",Atlimit,EntryPrice+4.5);
}
if MarketPosition == -1 Then{
if (익절조건7) Then
ExitShort("sx13",Atlimit,EntryPrice-6.5);
if (익절조건8) Then
ExitShort("sx14",Atlimit,EntryPrice-4.5);
}
# 매수청산
If (매수청산 조건) Then
{
Exitlong();
}
# 매도청산
If (매도청산 조건) Then
{
Exitshort();
}
SetStopLoss(1.0,PointStop);
SetStopEndofday(150000);
즐거운 하루되세요
> 몸통공격 님이 쓴 글입니다.
> 제목 : 26409 재문의
> 익절 후 같은 신호가 안 나오게 하려면 어떻게 해야 하는지요?
그림에서 보면
첫신호가 매도진입해서 매도로 익절 됐으니
매수신호에서만 진입하기를 원하는데 다시 매도 진입이 되 버립니다.
매수익절 후에도 매수진입이 또 나옵니다.
익절된 방향으로는 재진입이 안 나오도록 해 주십시오.
input : Period1(2),period2(5);
input : Vol3(1),value(0);
var : count(0),cnt(0),SA1(0);
var : a(0);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;}
a = fffff(0.9)/gggg(hhhh*1.1);
value1 = ######;
value2 = ######;
value3 = ######;
#당일 발생한 청산 중 최근청산이 손절이나 목표수익이면 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 If (매수조건) then
buy("b2");
if MarketPosition(1) == 1 and If (매도조건) then
Sell("s2");
}
##익절조건##
if MarketPosition == 1 Then{
if (익절조건1) Then
exitlong("bx1",Atlimit,EntryPrice+1.2);
if (익절조건2) Then
exitlong("bx2",Atlimit,EntryPrice+0.9);
}
if MarketPosition == -1 Then{
if (익절조건1) Then
ExitShort("sx1",Atlimit,EntryPrice-1.2);
if (익절조건2) Then
ExitShort("sx2",Atlimit,EntryPrice-0.9);
}
if MarketPosition == 1 Then{
if (익절조건3) Then
exitlong("bx3",Atlimit,EntryPrice+2.0);
if (익절조건4) Then
exitlong("bx4",Atlimit,EntryPrice+1.5);
}
if MarketPosition == -1 Then{
if (익절조건3) Then
ExitShort("sx5",Atlimit,EntryPrice-2.0);
if (익절조건4) Then
ExitShort("sx6",Atlimit,EntryPrice-1.5);
}
if MarketPosition == 1 Then{
if (익절조건5) Then
exitlong("bx7",Atlimit,EntryPrice+3.0);
if (익절조건6) Then
exitlong("bx8",Atlimit,EntryPrice+2.5);
}
if MarketPosition == -1 Then{
if (익절조건5) Then
ExitShort("sx9",Atlimit,EntryPrice-3.0);
if (익절조건6) Then
ExitShort("sx10",Atlimit,EntryPrice-2.5);
}
if MarketPosition == 1 Then{
if (익절조건7) Then
exitlong("bx11",Atlimit,EntryPrice+6.5);
if (익절조건8) Then
exitlong("bx12",Atlimit,EntryPrice+4.5);
}
if MarketPosition == -1 Then{
if (익절조건7) Then
ExitShort("sx13",Atlimit,EntryPrice-6.5);
if (익절조건8) Then
ExitShort("sx14",Atlimit,EntryPrice-4.5);
}
# 매수청산
If (매수청산 조건) Then
{
Exitlong();
}
# 매도청산
If (매도청산 조건) Then
{
Exitshort();
}
SetStopLoss(1.0,PointStop);
SetStopEndofday(150000);