커뮤니티
문의합니다
2019-03-06 09:11:29
185
글번호 126761
input : 시작시간(090000),종료시간(0);
input : Period15(15),Period20(20),Period30(30),Period120(120),Period180(180),Period240(240),Period480(480),
Period960(960),Period60(60),Period3(3),Period10(10),Period2(2),Period7(7),Period144(144),Period100(100);
input : 익절틱수1(150),손절틱수1(150),익절틱수2(200),손절틱수2(200),익절틱수3(200),손절틱수3(200),익절틱수4(200),손절틱수4(200),익절틱수5(200),손절틱수5(200);
var : mav15(0),mav20(0),mav30(0),mav120(0),mav180(0),mav240(0),mav480(0),mav960(0),mav60(0),mav1(0),
mav3(0),mav10(0),mav2(0),mav7(0),mav144(0),mav100(0),Bxcond(false),Sxcond(false);
var : Tcond(false);
var : T(0);
input : ntime1(4),P(50);
var : S1(0),D1(0),TM(0),TF(0);
var : cnt(0),sum1(0),tmav1(0),tmav11(0),tmav12(0),tmav13(0);
Array : C1[50](0);
var : BE1(0),BE2(0),BE3(0),BE4(0),BE5(0);
var : SE1(0),SE2(0),SE3(0),SE4(0),SE5(0);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%ntime1;
if Bdate != Bdate[1] or (Bdate == Bdate[1] and TF < TF[1]) Then
{
for cnt = 1 to 49
{
C1[cnt] = C1[cnt-1][1];
}
tmav11 = tmav1[1];
tmav12 = tmav11[1];
tmav13 = tmav12[1];
}
C1[0] = C;
if C1[P] > 0 then{
sum1 = 0;
for cnt = 0 to P-1{
sum1 = sum1+C1[cnt];
}
tmav1 = sum1/P;
}
}
mav15 = ma(c, Period15);
mav20 = ma(c, Period20);
mav30 = ma(c, Period30);
mav120 = ma(c, Period120);
mav180 = ma(c, Period180);
mav240 = ma(c, Period240);
mav480 = ma(c, Period480);
mav960 = ma(c, Period960);
mav60 = ma(c, Period60);
mav3 = ma(c, Period3);
mav10 = ma(c, Period10);
mav2 = ma(c, Period2);
mav7 = ma(c, Period7);
mav144 = ma(c, Period144);
mav100 = ma(c, Period100);
if (sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and (Stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간))) Then
{
Tcond = True;
BXcond = false;
SXcond = false;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if TotalTrades > TotalTrades[1] then
{
BXcond = false;
SXcond = false;
if (IsExitName("bl",0) == true or IsExitName("bp",0) == true or IsExitName("bx",1) == true or IsExitName("bx",1) == true) Then
BXcond = true;
if (IsExitName("sl",0) == true or IsExitName("sp",0) == true or IsExitName("sx",1) == true or IsExitName("sx",1) == true) Then
SXcond = true;
}
if Tcond == true then
{
if MarketPosition <= 0 and Bxcond == false and
tmav13 < tmav12 and tmav12 < tmav11 and tmav11 < tmav1 and tmav12 > 0 Then
{
buy("매수1",OnClose,def,1);
}
if MarketPosition == 1 Then
{
if crossup(mav20, mav30) and MaxEntries == 1 Then
buy("매수2",OnClose,def,1);
if crossup(mav20, mav30) and MaxEntries == 2 Then
buy("매수3",OnClose,def,1);
if crossup(mav20, mav30) and MaxEntries == 3 Then
buy("매수4",OnClose,def,1);
if crossup(mav20, mav30) and MaxEntries == 4 Then
buy("매수5",OnClose,def,1);
}
if MarketPosition == 1 Then
{
if (tmav12 > tmav11 and tmav11 > tmav1 and tmav12 > 0) Then
exitlong("수청산1",OnClose,def,"매수1");
if (CrossDown(mav20, mav30)) or (tmav12 > tmav11 and tmav11 > tmav1 and tmav12 > 0) Then
{
exitlong("수청산2",OnClose,def,"매수2");
exitlong("수청산3",OnClose,def,"매수3");
exitlong("수청산4",OnClose,def,"매수4");
exitlong("수청산5",OnClose,def,"매수5");
}
if CurrentContracts > CurrentContracts[1] and MaxEntries == 1 Then
BE1 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 2 Then
BE2 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 3 Then
BE3 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 4 Then
BE4 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 5 Then
BE5 = LatestEntryPrice(0);
ExitLong("bp1",atlimit,BE1+PriceScale*익절틱수1,"매수1");
ExitLong("bl1",AtStop,BE1-PriceScale*손절틱수1,"매수1");
ExitLong("bp2",atlimit,BE2+PriceScale*익절틱수2,"매수2");
ExitLong("bl2",AtStop,BE2-PriceScale*손절틱수2,"매수2");
ExitLong("bp3",atlimit,BE3+PriceScale*익절틱수3,"매수3");
ExitLong("bl3",AtStop,BE3-PriceScale*손절틱수3,"매수3");
ExitLong("bp4",atlimit,BE4+PriceScale*익절틱수4,"매수4");
ExitLong("bl4",AtStop,BE4-PriceScale*손절틱수4,"매수4");
ExitLong("bp5",atlimit,BE5+PriceScale*익절틱수5,"매수5");
ExitLong("bl5",AtStop,BE5-PriceScale*손절틱수5,"매수5");
}
if MarketPosition >= 0 and Sxcond == false and
tmav13 > tmav12 and tmav12 > tmav11 and tmav11 > tmav1 and tmav12 > 0 Then
{
sell("매도1",OnClose,def,1);
}
if MarketPosition == -1 then
{
if CrossDown(mav20, mav30) and MaxEntries == 1 Then
sell("매도2",OnClose,def,1);
if CrossDown(mav20, mav30) and MaxEntries == 2 Then
sell("매도3",OnClose,def,1);
if CrossDown(mav20, mav30) and MaxEntries == 3 Then
sell("매도4",OnClose,def,1);
if CrossDown(mav20, mav30) and MaxEntries == 4 Then
sell("매도5",OnClose,def,1);
}
if MarketPosition == -1 then
{
if (tmav12 < tmav11 and tmav11 < tmav1 and tmav12 > 0) Then
ExitShort("도청산1",OnClose,def,"매도1");
if (crossup(mav20, mav30)) or (tmav12 < tmav11 and tmav11 < tmav1 and tmav12 > 0) Then
{
ExitShort("도청산2",OnClose,def,"매도2");
ExitShort("도청산3",OnClose,def,"매도3");
ExitShort("도청산4",OnClose,def,"매도4");
ExitShort("도청산5",OnClose,def,"매도5");
}
if CurrentContracts > CurrentContracts[1] and MaxEntries == 1 Then
SE1 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 2 Then
SE2 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 3 Then
SE3 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 4 Then
SE4 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 5 Then
SE5 = LatestEntryPrice(0);
ExitShort("sp1",atlimit,SE1-PriceScale*익절틱수1,"매도1");
ExitShort("sl1",AtStop,SE1+PriceScale*손절틱수1,"매도1");
ExitShort("sp2",atlimit,SE2-PriceScale*익절틱수2,"매도2");
ExitShort("sl2",AtStop,SE2+PriceScale*손절틱수2,"매도2");
ExitShort("sp3",atlimit,SE3-PriceScale*익절틱수3,"매도3");
ExitShort("sl3",AtStop,SE3+PriceScale*손절틱수3,"매도3");
ExitShort("sp4",atlimit,SE4-PriceScale*익절틱수4,"매도4");
ExitShort("sl4",AtStop,SE4+PriceScale*손절틱수4,"매도4");
ExitShort("sp5",atlimit,SE5-PriceScale*익절틱수5,"매도5");
ExitShort("sl5",AtStop,SE5+PriceScale*손절틱수5,"매도5");
}
}
---- 각 진입별로 손익절을 지정 하였으나 무슨 이유인지는 모르나
매수진입(매수2)후 바로 익절(bp2) 나오고
매도진입(매도2)후 바로 손절(sl2)이 발생하고 있습니다
수정 부탁합니다 감사합니다
답변 1
예스스탁 예스스탁 답변
2019-03-06 17:09:36
안녕하세요
예스스탁입니다.
input : 시작시간(090000),종료시간(0);
input : Period15(15),Period20(20),Period30(30),Period120(120),Period180(180),Period240(240),Period480(480),
Period960(960),Period60(60),Period3(3),Period10(10),Period2(2),Period7(7),Period144(144),Period100(100);
input : 익절틱수1(150),손절틱수1(150),익절틱수2(200),손절틱수2(200),익절틱수3(200),손절틱수3(200),익절틱수4(200),손절틱수4(200),익절틱수5(200),손절틱수5(200);
var : mav15(0),mav20(0),mav30(0),mav120(0),mav180(0),mav240(0),mav480(0),mav960(0),mav60(0),mav1(0),
mav3(0),mav10(0),mav2(0),mav7(0),mav144(0),mav100(0),Bxcond(false),Sxcond(false);
var : Tcond(false);
var : T(0);
input : ntime1(4),P(50);
var : S1(0),D1(0),TM(0),TF(0);
var : cnt(0),sum1(0),tmav1(0),tmav11(0),tmav12(0),tmav13(0);
Array : C1[50](0);
var : BE1(0),BE2(0),BE3(0),BE4(0),BE5(0);
var : SE1(0),SE2(0),SE3(0),SE4(0),SE5(0);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%ntime1;
if Bdate != Bdate[1] or (Bdate == Bdate[1] and TF < TF[1]) Then
{
for cnt = 1 to 49
{
C1[cnt] = C1[cnt-1][1];
}
tmav11 = tmav1[1];
tmav12 = tmav11[1];
tmav13 = tmav12[1];
}
C1[0] = C;
if C1[P] > 0 then{
sum1 = 0;
for cnt = 0 to P-1{
sum1 = sum1+C1[cnt];
}
tmav1 = sum1/P;
}
}
mav15 = ma(c, Period15);
mav20 = ma(c, Period20);
mav30 = ma(c, Period30);
mav120 = ma(c, Period120);
mav180 = ma(c, Period180);
mav240 = ma(c, Period240);
mav480 = ma(c, Period480);
mav960 = ma(c, Period960);
mav60 = ma(c, Period60);
mav3 = ma(c, Period3);
mav10 = ma(c, Period10);
mav2 = ma(c, Period2);
mav7 = ma(c, Period7);
mav144 = ma(c, Period144);
mav100 = ma(c, Period100);
if (sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and (Stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간))) Then
{
Tcond = True;
BXcond = false;
SXcond = false;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if TotalTrades > TotalTrades[1] then
{
BXcond = false;
SXcond = false;
if (IsExitName("bl",0) == true or IsExitName("bp",0) == true or IsExitName("bx",1) == true or IsExitName("bx",1) == true) Then
BXcond = true;
if (IsExitName("sl",0) == true or IsExitName("sp",0) == true or IsExitName("sx",1) == true or IsExitName("sx",1) == true) Then
SXcond = true;
}
if Tcond == true then
{
if /*MarketPosition <= 0 and Bxcond == false and
tmav13 < tmav12 and tmav12 < tmav11 and tmav11 < tmav1 and tmav12 > 0*/MarketPosition == 0 and crossup(mav20, mav30) Then
{
buy("매수1",OnClose,def,1);
}
if MarketPosition == 1 Then
{
if crossup(mav20, mav30) and MaxEntries == 1 Then
buy("매수2",OnClose,def,1);
if crossup(mav20, mav30) and MaxEntries == 2 Then
buy("매수3",OnClose,def,1);
if crossup(mav20, mav30) and MaxEntries == 3 Then
buy("매수4",OnClose,def,1);
if crossup(mav20, mav30) and MaxEntries == 4 Then
buy("매수5",OnClose,def,1);
}
if MarketPosition == 1 Then
{
if (tmav12 > tmav11 and tmav11 > tmav1 and tmav12 > 0) Then
exitlong("수청산1",OnClose,def,"매수1");
if (CrossDown(mav20, mav30)) or (tmav12 > tmav11 and tmav11 > tmav1 and tmav12 > 0) Then
{
exitlong("수청산2",OnClose,def,"매수2");
exitlong("수청산3",OnClose,def,"매수3");
exitlong("수청산4",OnClose,def,"매수4");
exitlong("수청산5",OnClose,def,"매수5");
}
if CurrentContracts > CurrentContracts[1] and MaxEntries == 1 Then
BE1 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 2 Then
BE2 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 3 Then
BE3 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 4 Then
BE4 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 5 Then
BE5 = LatestEntryPrice(0);
if MaxEntries >= 1 Then
{
ExitLong("bp1",atlimit,BE1+PriceScale*익절틱수1,"매수1");
ExitLong("bl1",AtStop,BE1-PriceScale*손절틱수1,"매수1");
}
if MaxEntries >= 2 then
{
ExitLong("bp2",atlimit,BE2+PriceScale*익절틱수2,"매수2");
ExitLong("bl2",AtStop,BE2-PriceScale*손절틱수2,"매수2");
}
if MaxEntries >= 3 then
{
ExitLong("bp3",atlimit,BE3+PriceScale*익절틱수3,"매수3");
ExitLong("bl3",AtStop,BE3-PriceScale*손절틱수3,"매수3");
}
if MaxEntries >= 4 then
{
ExitLong("bp4",atlimit,BE4+PriceScale*익절틱수4,"매수4");
ExitLong("bl4",AtStop,BE4-PriceScale*손절틱수4,"매수4");
}
if MaxEntries >= 5 then
{
ExitLong("bp5",atlimit,BE5+PriceScale*익절틱수5,"매수5");
ExitLong("bl5",AtStop,BE5-PriceScale*손절틱수5,"매수5");
}
}
if MarketPosition >= 0 and Sxcond == false and
tmav13 > tmav12 and tmav12 > tmav11 and tmav11 > tmav1 and tmav12 > 0 Then
{
sell("매도1",OnClose,def,1);
}
if MarketPosition == -1 then
{
if CrossDown(mav20, mav30) and MaxEntries == 1 Then
sell("매도2",OnClose,def,1);
if CrossDown(mav20, mav30) and MaxEntries == 2 Then
sell("매도3",OnClose,def,1);
if CrossDown(mav20, mav30) and MaxEntries == 3 Then
sell("매도4",OnClose,def,1);
if CrossDown(mav20, mav30) and MaxEntries == 4 Then
sell("매도5",OnClose,def,1);
}
if MarketPosition == -1 then
{
if (tmav12 < tmav11 and tmav11 < tmav1 and tmav12 > 0) Then
ExitShort("도청산1",OnClose,def,"매도1");
if (crossup(mav20, mav30)) or (tmav12 < tmav11 and tmav11 < tmav1 and tmav12 > 0) Then
{
ExitShort("도청산2",OnClose,def,"매도2");
ExitShort("도청산3",OnClose,def,"매도3");
ExitShort("도청산4",OnClose,def,"매도4");
ExitShort("도청산5",OnClose,def,"매도5");
}
if CurrentContracts > CurrentContracts[1] and MaxEntries == 1 Then
SE1 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 2 Then
SE2 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 3 Then
SE3 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 4 Then
SE4 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 5 Then
SE5 = LatestEntryPrice(0);
if MaxEntries >= 1 then
{
ExitShort("sp1",atlimit,SE1-PriceScale*익절틱수1,"매도1");
ExitShort("sl1",AtStop,SE1+PriceScale*손절틱수1,"매도1");
}
if MaxEntries >= 2 then
{
ExitShort("sp2",atlimit,SE2-PriceScale*익절틱수2,"매도2");
ExitShort("sl2",AtStop,SE2+PriceScale*손절틱수2,"매도2");
}
if MaxEntries >= 3 then
{
ExitShort("sp3",atlimit,SE3-PriceScale*익절틱수3,"매도3");
ExitShort("sl3",AtStop,SE3+PriceScale*손절틱수3,"매도3");
}
if MaxEntries >= 4 then
{
ExitShort("sp4",atlimit,SE4-PriceScale*익절틱수4,"매도4");
ExitShort("sl4",AtStop,SE4+PriceScale*손절틱수4,"매도4");
}
if MaxEntries >= 5 then
{
ExitShort("sp5",atlimit,SE5-PriceScale*익절틱수5,"매도5");
ExitShort("sl5",AtStop,SE5+PriceScale*손절틱수5,"매도5");
}
}
}
즐거운 하루되세요
> 남산 님이 쓴 글입니다.
> 제목 : 문의합니다
> input : 시작시간(090000),종료시간(0);
input : Period15(15),Period20(20),Period30(30),Period120(120),Period180(180),Period240(240),Period480(480),
Period960(960),Period60(60),Period3(3),Period10(10),Period2(2),Period7(7),Period144(144),Period100(100);
input : 익절틱수1(150),손절틱수1(150),익절틱수2(200),손절틱수2(200),익절틱수3(200),손절틱수3(200),익절틱수4(200),손절틱수4(200),익절틱수5(200),손절틱수5(200);
var : mav15(0),mav20(0),mav30(0),mav120(0),mav180(0),mav240(0),mav480(0),mav960(0),mav60(0),mav1(0),
mav3(0),mav10(0),mav2(0),mav7(0),mav144(0),mav100(0),Bxcond(false),Sxcond(false);
var : Tcond(false);
var : T(0);
input : ntime1(4),P(50);
var : S1(0),D1(0),TM(0),TF(0);
var : cnt(0),sum1(0),tmav1(0),tmav11(0),tmav12(0),tmav13(0);
Array : C1[50](0);
var : BE1(0),BE2(0),BE3(0),BE4(0),BE5(0);
var : SE1(0),SE2(0),SE3(0),SE4(0),SE5(0);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%ntime1;
if Bdate != Bdate[1] or (Bdate == Bdate[1] and TF < TF[1]) Then
{
for cnt = 1 to 49
{
C1[cnt] = C1[cnt-1][1];
}
tmav11 = tmav1[1];
tmav12 = tmav11[1];
tmav13 = tmav12[1];
}
C1[0] = C;
if C1[P] > 0 then{
sum1 = 0;
for cnt = 0 to P-1{
sum1 = sum1+C1[cnt];
}
tmav1 = sum1/P;
}
}
mav15 = ma(c, Period15);
mav20 = ma(c, Period20);
mav30 = ma(c, Period30);
mav120 = ma(c, Period120);
mav180 = ma(c, Period180);
mav240 = ma(c, Period240);
mav480 = ma(c, Period480);
mav960 = ma(c, Period960);
mav60 = ma(c, Period60);
mav3 = ma(c, Period3);
mav10 = ma(c, Period10);
mav2 = ma(c, Period2);
mav7 = ma(c, Period7);
mav144 = ma(c, Period144);
mav100 = ma(c, Period100);
if (sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and (Stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간))) Then
{
Tcond = True;
BXcond = false;
SXcond = false;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if TotalTrades > TotalTrades[1] then
{
BXcond = false;
SXcond = false;
if (IsExitName("bl",0) == true or IsExitName("bp",0) == true or IsExitName("bx",1) == true or IsExitName("bx",1) == true) Then
BXcond = true;
if (IsExitName("sl",0) == true or IsExitName("sp",0) == true or IsExitName("sx",1) == true or IsExitName("sx",1) == true) Then
SXcond = true;
}
if Tcond == true then
{
if MarketPosition <= 0 and Bxcond == false and
tmav13 < tmav12 and tmav12 < tmav11 and tmav11 < tmav1 and tmav12 > 0 Then
{
buy("매수1",OnClose,def,1);
}
if MarketPosition == 1 Then
{
if crossup(mav20, mav30) and MaxEntries == 1 Then
buy("매수2",OnClose,def,1);
if crossup(mav20, mav30) and MaxEntries == 2 Then
buy("매수3",OnClose,def,1);
if crossup(mav20, mav30) and MaxEntries == 3 Then
buy("매수4",OnClose,def,1);
if crossup(mav20, mav30) and MaxEntries == 4 Then
buy("매수5",OnClose,def,1);
}
if MarketPosition == 1 Then
{
if (tmav12 > tmav11 and tmav11 > tmav1 and tmav12 > 0) Then
exitlong("수청산1",OnClose,def,"매수1");
if (CrossDown(mav20, mav30)) or (tmav12 > tmav11 and tmav11 > tmav1 and tmav12 > 0) Then
{
exitlong("수청산2",OnClose,def,"매수2");
exitlong("수청산3",OnClose,def,"매수3");
exitlong("수청산4",OnClose,def,"매수4");
exitlong("수청산5",OnClose,def,"매수5");
}
if CurrentContracts > CurrentContracts[1] and MaxEntries == 1 Then
BE1 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 2 Then
BE2 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 3 Then
BE3 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 4 Then
BE4 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 5 Then
BE5 = LatestEntryPrice(0);
ExitLong("bp1",atlimit,BE1+PriceScale*익절틱수1,"매수1");
ExitLong("bl1",AtStop,BE1-PriceScale*손절틱수1,"매수1");
ExitLong("bp2",atlimit,BE2+PriceScale*익절틱수2,"매수2");
ExitLong("bl2",AtStop,BE2-PriceScale*손절틱수2,"매수2");
ExitLong("bp3",atlimit,BE3+PriceScale*익절틱수3,"매수3");
ExitLong("bl3",AtStop,BE3-PriceScale*손절틱수3,"매수3");
ExitLong("bp4",atlimit,BE4+PriceScale*익절틱수4,"매수4");
ExitLong("bl4",AtStop,BE4-PriceScale*손절틱수4,"매수4");
ExitLong("bp5",atlimit,BE5+PriceScale*익절틱수5,"매수5");
ExitLong("bl5",AtStop,BE5-PriceScale*손절틱수5,"매수5");
}
if MarketPosition >= 0 and Sxcond == false and
tmav13 > tmav12 and tmav12 > tmav11 and tmav11 > tmav1 and tmav12 > 0 Then
{
sell("매도1",OnClose,def,1);
}
if MarketPosition == -1 then
{
if CrossDown(mav20, mav30) and MaxEntries == 1 Then
sell("매도2",OnClose,def,1);
if CrossDown(mav20, mav30) and MaxEntries == 2 Then
sell("매도3",OnClose,def,1);
if CrossDown(mav20, mav30) and MaxEntries == 3 Then
sell("매도4",OnClose,def,1);
if CrossDown(mav20, mav30) and MaxEntries == 4 Then
sell("매도5",OnClose,def,1);
}
if MarketPosition == -1 then
{
if (tmav12 < tmav11 and tmav11 < tmav1 and tmav12 > 0) Then
ExitShort("도청산1",OnClose,def,"매도1");
if (crossup(mav20, mav30)) or (tmav12 < tmav11 and tmav11 < tmav1 and tmav12 > 0) Then
{
ExitShort("도청산2",OnClose,def,"매도2");
ExitShort("도청산3",OnClose,def,"매도3");
ExitShort("도청산4",OnClose,def,"매도4");
ExitShort("도청산5",OnClose,def,"매도5");
}
if CurrentContracts > CurrentContracts[1] and MaxEntries == 1 Then
SE1 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 2 Then
SE2 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 3 Then
SE3 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 4 Then
SE4 = LatestEntryPrice(0);
if CurrentContracts > CurrentContracts[1] and MaxEntries == 5 Then
SE5 = LatestEntryPrice(0);
ExitShort("sp1",atlimit,SE1-PriceScale*익절틱수1,"매도1");
ExitShort("sl1",AtStop,SE1+PriceScale*손절틱수1,"매도1");
ExitShort("sp2",atlimit,SE2-PriceScale*익절틱수2,"매도2");
ExitShort("sl2",AtStop,SE2+PriceScale*손절틱수2,"매도2");
ExitShort("sp3",atlimit,SE3-PriceScale*익절틱수3,"매도3");
ExitShort("sl3",AtStop,SE3+PriceScale*손절틱수3,"매도3");
ExitShort("sp4",atlimit,SE4-PriceScale*익절틱수4,"매도4");
ExitShort("sl4",AtStop,SE4+PriceScale*손절틱수4,"매도4");
ExitShort("sp5",atlimit,SE5-PriceScale*익절틱수5,"매도5");
ExitShort("sl5",AtStop,SE5+PriceScale*손절틱수5,"매도5");
}
}
---- 각 진입별로 손익절을 지정 하였으나 무슨 이유인지는 모르나
매수진입(매수2)후 바로 익절(bp2) 나오고
매도진입(매도2)후 바로 손절(sl2)이 발생하고 있습니다
수정 부탁합니다 감사합니다