커뮤니티
확인 부탁드립니다.
2017-10-01 22:12:48
161
글번호 113230
작성해 주신 식으로 구동해도 진입(구동)이 없습니다. 확인 부탁드립니다.
틱차트사용중입니다
매매 조건입니다.
(매수로만 설명드립니다 매도는 반대 동일조건으로 해주세요)
1번. 매수포지션 1차 진입하여 손절되면 매도 조건시 2차 진입
(단, 매도 진입은 Data2의 20일선이 100일선 위에 있고 80일선이 상방일때만)
* 55029 에서작성해주신 아래식에서 부등호가 ">"로 변경해야 되는거 아닌지 문의드립니다.?
IsExitName("S손절",1) == true and avg1 < avg3 and avg2 < avg2[1] then
buy("Buy4");
2번. 매수, 매도 포지션 진입 후 익절이되면 당일 매매 끝
3번. 진입횟수를 2로 하면 1번과같은 조건으로 두번까지만 진입이 되게 해주시고,
첫번째 매매에서 익절이 되면 당일 매매는 종료하게 해주세요.
input : short(12),long(26),sig(9),P1(3),P2(20),P3(100);
input : 시작시간(102000), 종료시간(172000);
input : 진입횟수(2);
var : mav1(0,data1),mav2(0,data1),mav3(0,data1);
var : Tcond(False,data1),count(0,data1),T1(0,data1);
var : MACDO2(0,data2), MACDO1(0,data1);
var : BH(0,data1),SL(0,data1),Xcond(false,data1);
var : avg1(0,data2),avg2(0,data2),avg3(0,data2);
MACDO2 = data2(MACD_OSC(short,long,sig));
MACDO1 = data1(MACD_OSC(short,long,sig));
mav1 = data1(ma(c,P1));
mav2 = data1(ma(c,P2));
mav3 = data1(ma(c,P3));
avg1 = data2(ma(c,20));
avg2 = data2(ma(c,80));
avg3 = data2(ma(c,100));
if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{
T1 = TotalTrades;
Tcond = true;
Xcond = true;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
}
if TotalTrades > TotalTrades[1] and
(IsExitName("B익절1",1) or
IsExitName("B익절2",1) or
IsExitName("S익절1",1) or
IsExitName("S익절2",1)) Then
Xcond = true;
if MarketPosition == 0 Then
count = TotalTrades-T1;
Else
count = TotalTrades-T1+1;
//진입
if Tcond == true and Xcond == false Then{
if MACDO2 > MACDO2[1] and crossup(mav2,mav3) Then{
if count == 0 and MarketPosition <= 0 Then
buy("Buy1");
if count > 0 and count < 진입횟수 and MarketPosition == -1 then
buy("Buy2");
if count > 0 and count < 진입횟수 and MarketPosition == 0 and MarketPosition(1) != 1 and
IsExitName("S손절",1) == false then
buy("Buy3");
if count > 0 and count < 진입횟수 and MarketPosition == 0 and MarketPosition(1) != 1 and
IsExitName("S손절",1) == true and avg1 < avg3 and avg2 < avg2[1] then
buy("Buy4");
}
if MACDO2 < MACDO2[1] and CrossDown(mav2,mav3) then{
if count == 0 and MarketPosition >= 0 Then
Sell("Sell1");
if count > 0 and count < 진입횟수 and MarketPosition == 1 then
Sell("Sell2");
if count > 0 and count < 진입횟수 and MarketPosition == 0 and MarketPosition(1) != -1 and
IsExitName("B손절",1) == false then
Sell("Sell3");
if count > 0 and count < 진입횟수 and MarketPosition == 0 and MarketPosition(1) != -1 and
IsExitName("B손절",1) == true and avg1 > avg3 and avg2 > avg2[1] then
Sell("Sell4");
}
}
//청산1
if MarketPosition == 1 Then{
BH = highest(H,BarsSinceEntry);
if BH >= EntryPrice+PriceScale*60 and BH < EntryPrice+PriceScale*80 Then
ExitLong("B익절1",AtStop,BH-PriceScale*30);
if BH >= EntryPrice+PriceScale*80 Then
ExitLong("B익절2",AtStop,BH-PriceScale*20);
ExitLong("B손절",AtStop,EntryPrice-PriceScale*40);
}
if MarketPosition == -1 Then{
SL = Lowest(L,BarsSinceEntry);
if SL <= EntryPrice-PriceScale*60 and SL > EntryPrice-PriceScale*80 Then
ExitShort("S익절1",AtStop,SL+PriceScale*30);
if SL <= EntryPrice-PriceScale*80 Then
ExitShort("S익절2",AtStop,sL+PriceScale*20);
ExitShort("S손절",AtStop,EntryPrice+PriceScale*40);
}
if 종료시간 <= sTime or sTime < 시작시간 then {
if MarketPosition == 1 then{
ExitLong("B장종료");
}
if MarketPosition == -1 then{
ExitShort("S장종료");
}
}
답변 1
예스스탁 예스스탁 답변
2017-10-10 15:59:19
안녕하세요
예스스탁입니다.
식을 수정했습니다.
1번. 매수포지션 1차 진입하여 손절되면 매도 조건시 2차 진입
(단, 매도 진입은 Data2의 20일선이 100일선 위에 있고 80일선이 상방일때만)
Buy4는 위 내용과 반대인 식입니다.
직전거래가 매도로 진입후에 손절된 후 진입하는 매수입니다.
20선이 100선아래 80일선 하방으로 작성한 내용입니다.
input : short(12),long(26),sig(9),P1(3),P2(20),P3(100);
input : 시작시간(102000), 종료시간(172000);
input : 진입횟수(2);
var : mav1(0,data1),mav2(0,data1),mav3(0,data1);
var : Tcond(False,data1),count(0,data1),T1(0,data1);
var : MACDO2(0,data2), MACDO1(0,data1);
var : BH(0,data1),SL(0,data1),Xcond(false,data1);
var : avg1(0,data2),avg2(0,data2),avg3(0,data2);
MACDO2 = data2(MACD_OSC(short,long,sig));
MACDO1 = data1(MACD_OSC(short,long,sig));
mav1 = data1(ma(c,P1));
mav2 = data1(ma(c,P2));
mav3 = data1(ma(c,P3));
avg1 = data2(ma(c,20));
avg2 = data2(ma(c,80));
avg3 = data2(ma(c,100));
if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{
T1 = TotalTrades;
Tcond = true;
Xcond = false;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
}
if TotalTrades > TotalTrades[1] and
(IsExitName("B익절1",1) or
IsExitName("B익절2",1) or
IsExitName("S익절1",1) or
IsExitName("S익절2",1)) Then
Xcond = true;
if MarketPosition == 0 Then
count = TotalTrades-T1;
Else
count = TotalTrades-T1+1;
//진입
if Tcond == true and Xcond == false Then{
if MACDO2 > MACDO2[1] and crossup(mav2,mav3) Then{
if count == 0 and MarketPosition <= 0 Then
buy("Buy1");
if count > 0 and count < 진입횟수 and MarketPosition == -1 then
buy("Buy2");
if count > 0 and count < 진입횟수 and MarketPosition == 0 and
MarketPosition(1) != 1 and IsExitName("S손절",1) == false then
buy("Buy3");
if count > 0 and count < 진입횟수 and MarketPosition == 0 and
MarketPosition(1) != 1 and IsExitName("S손절",1) == true and
avg1 < avg3 and avg2 < avg2[1] then
buy("Buy4");
}
if MACDO2 < MACDO2[1] and CrossDown(mav2,mav3) then{
if count == 0 and MarketPosition >= 0 Then
Sell("Sell1");
if count > 0 and count < 진입횟수 and MarketPosition == 1 then
Sell("Sell2");
if count > 0 and count < 진입횟수 and MarketPosition == 0 and MarketPosition(1) != -1 and
IsExitName("B손절",1) == false then
Sell("Sell3");
if count > 0 and count < 진입횟수 and MarketPosition == 0 and
MarketPosition(1) != -1 and IsExitName("B손절",1) == true and
avg1 > avg3 and avg2 > avg2[1] then
Sell("Sell4");
}
}
//청산1
if MarketPosition == 1 Then{
BH = highest(H,BarsSinceEntry);
if BH >= EntryPrice+PriceScale*60 and BH < EntryPrice+PriceScale*80 Then
ExitLong("B익절1",AtStop,BH-PriceScale*30);
if BH >= EntryPrice+PriceScale*80 Then
ExitLong("B익절2",AtStop,BH-PriceScale*20);
ExitLong("B손절",AtStop,EntryPrice-PriceScale*40);
}
if MarketPosition == -1 Then{
SL = Lowest(L,BarsSinceEntry);
if SL <= EntryPrice-PriceScale*60 and SL > EntryPrice-PriceScale*80 Then
ExitShort("S익절1",AtStop,SL+PriceScale*30);
if SL <= EntryPrice-PriceScale*80 Then
ExitShort("S익절2",AtStop,sL+PriceScale*20);
ExitShort("S손절",AtStop,EntryPrice+PriceScale*40);
}
if 종료시간 <= sTime or sTime < 시작시간 then {
if MarketPosition == 1 then{
ExitLong("B장종료");
}
if MarketPosition == -1 then{
ExitShort("S장종료");
}
}
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 확인 부탁드립니다.
> 작성해 주신 식으로 구동해도 진입(구동)이 없습니다. 확인 부탁드립니다.
틱차트사용중입니다
매매 조건입니다.
(매수로만 설명드립니다 매도는 반대 동일조건으로 해주세요)
1번. 매수포지션 1차 진입하여 손절되면 매도 조건시 2차 진입
(단, 매도 진입은 Data2의 20일선이 100일선 위에 있고 80일선이 상방일때만)
* 55029 에서작성해주신 아래식에서 부등호가 ">"로 변경해야 되는거 아닌지 문의드립니다.?
IsExitName("S손절",1) == true and avg1 < avg3 and avg2 < avg2[1] then
buy("Buy4");
2번. 매수, 매도 포지션 진입 후 익절이되면 당일 매매 끝
3번. 진입횟수를 2로 하면 1번과같은 조건으로 두번까지만 진입이 되게 해주시고,
첫번째 매매에서 익절이 되면 당일 매매는 종료하게 해주세요.
input : short(12),long(26),sig(9),P1(3),P2(20),P3(100);
input : 시작시간(102000), 종료시간(172000);
input : 진입횟수(2);
var : mav1(0,data1),mav2(0,data1),mav3(0,data1);
var : Tcond(False,data1),count(0,data1),T1(0,data1);
var : MACDO2(0,data2), MACDO1(0,data1);
var : BH(0,data1),SL(0,data1),Xcond(false,data1);
var : avg1(0,data2),avg2(0,data2),avg3(0,data2);
MACDO2 = data2(MACD_OSC(short,long,sig));
MACDO1 = data1(MACD_OSC(short,long,sig));
mav1 = data1(ma(c,P1));
mav2 = data1(ma(c,P2));
mav3 = data1(ma(c,P3));
avg1 = data2(ma(c,20));
avg2 = data2(ma(c,80));
avg3 = data2(ma(c,100));
if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{
T1 = TotalTrades;
Tcond = true;
Xcond = true;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
}
if TotalTrades > TotalTrades[1] and
(IsExitName("B익절1",1) or
IsExitName("B익절2",1) or
IsExitName("S익절1",1) or
IsExitName("S익절2",1)) Then
Xcond = true;
if MarketPosition == 0 Then
count = TotalTrades-T1;
Else
count = TotalTrades-T1+1;
//진입
if Tcond == true and Xcond == false Then{
if MACDO2 > MACDO2[1] and crossup(mav2,mav3) Then{
if count == 0 and MarketPosition <= 0 Then
buy("Buy1");
if count > 0 and count < 진입횟수 and MarketPosition == -1 then
buy("Buy2");
if count > 0 and count < 진입횟수 and MarketPosition == 0 and MarketPosition(1) != 1 and
IsExitName("S손절",1) == false then
buy("Buy3");
if count > 0 and count < 진입횟수 and MarketPosition == 0 and MarketPosition(1) != 1 and
IsExitName("S손절",1) == true and avg1 < avg3 and avg2 < avg2[1] then
buy("Buy4");
}
if MACDO2 < MACDO2[1] and CrossDown(mav2,mav3) then{
if count == 0 and MarketPosition >= 0 Then
Sell("Sell1");
if count > 0 and count < 진입횟수 and MarketPosition == 1 then
Sell("Sell2");
if count > 0 and count < 진입횟수 and MarketPosition == 0 and MarketPosition(1) != -1 and
IsExitName("B손절",1) == false then
Sell("Sell3");
if count > 0 and count < 진입횟수 and MarketPosition == 0 and MarketPosition(1) != -1 and
IsExitName("B손절",1) == true and avg1 > avg3 and avg2 > avg2[1] then
Sell("Sell4");
}
}
//청산1
if MarketPosition == 1 Then{
BH = highest(H,BarsSinceEntry);
if BH >= EntryPrice+PriceScale*60 and BH < EntryPrice+PriceScale*80 Then
ExitLong("B익절1",AtStop,BH-PriceScale*30);
if BH >= EntryPrice+PriceScale*80 Then
ExitLong("B익절2",AtStop,BH-PriceScale*20);
ExitLong("B손절",AtStop,EntryPrice-PriceScale*40);
}
if MarketPosition == -1 Then{
SL = Lowest(L,BarsSinceEntry);
if SL <= EntryPrice-PriceScale*60 and SL > EntryPrice-PriceScale*80 Then
ExitShort("S익절1",AtStop,SL+PriceScale*30);
if SL <= EntryPrice-PriceScale*80 Then
ExitShort("S익절2",AtStop,sL+PriceScale*20);
ExitShort("S손절",AtStop,EntryPrice+PriceScale*40);
}
if 종료시간 <= sTime or sTime < 시작시간 then {
if MarketPosition == 1 then{
ExitLong("B장종료");
}
if MarketPosition == -1 then{
ExitShort("S장종료");
}
}
다음글
이전글