커뮤니티
30958 답변 부탁 드립니다
2013-06-19 16:16:30
158
글번호 64512
수고가 많으십니다 감사합니다
답변 2
예스스탁 예스스탁 답변
2013-06-19 17:55:04
안녕하세요
예스스탁입니다.
올려드린 기존식에 외부변수로 처리가 되어 있습니다.
부변수(input)중 양봉개수와 음봉갯수가 해당 내용입니다.
##매수식
input : LossPoint(0.65),양봉갯수(3),음봉갯수(3),재매수횟수(3),재매수청산횟수(3),ProfitPoint(3.7);
var : cnt(0),count(0),rebuy(0),ReEL(0);
var : cond1(false),cond2(false);
//ma1
input : maPeriod1(8);
var : MAv1(0);
MAv1 = ma(C,maPeriod1);
//ma2
input : maPeriod2(16);
var : MAv2(0);
MAv2 = ma(C,maPeriod2);
//ma3
input : maPeriod3(23);
var : MAv3(0);
MAv3 = ma(C,maPeriod3);
//ma4
input : maPeriod4(47);
var : MAv4(0);
MAv4 = ma(C,maPeriod4);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if date != date[1] Then{
Rebuy = 0;
ReEL = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("최초매수") == true Then{
Rebuy = 0;
ReEL = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("재매수") == true Then
Rebuy = Rebuy+1;
if BarsSinceExit(1) == 1 and MarketPosition != MarketPosition[1] and IsExitName("매수청산4",1) == true Then
ReEL = ReEL+1;
cond1 = C > O or (C==O and C >= C[1]);
cond2 = C < O or (C==O and C < C[1]);
if MarketPosition <= 0 and
(count == 0 or
(count > 0 and IsExitName("매수청산4",1) == false) or
(count > 0 and countif(C < mav4,BarsSinceExit(1)) >= 1)) and
MAv1 > MAv2 and
MAv2 > MAv3 and
MAv3 > MAv4 and
C > MAv1 Then{
Buy("최초매수", OnClose, DEF);
}
if MarketPosition == 1 Then{
ExitLong("매수청산2",AtStop,EntryPrice-Losspoint);
ExitLong("매수청산3",AtLimit,EntryPrice+Profitpoint);
}
if MarketPosition == 1 and C < MAv4 Then
Exitlong("매수청산1");
if count >= 1 Then{
if MarketPosition == 0 and
(IsEntryName("최초매수",1) == true or IsEntryName("재매수",1) == true) and
IsExitName("매수청산4",1) == True and
BarsSinceExit(1) >= 3 and
(Countif(cond1 == true,양봉갯수) == 양봉갯수 or Countif(cond1 == true,음봉갯수) == 음봉갯수) and
rebuy < 재매수횟수 and
countif(C < mav4,BarsSinceExit(1)) < 1 Then
buy("재매수");
}
if MarketPosition == 1 and BarsSinceEntry >= 3 and ReEL < 재매수청산횟수 then{
if Countif(cond1 == true,양봉갯수) == 양봉갯수 or Countif(cond2 == true,음봉갯수) == 음봉갯수 Then
ExitLong("매수청산4");
}
##매도식
input : LossPoint(0.65),양봉갯수(3),음봉갯수(3),재매도횟수(3),재매도청산횟수(3),ProfitPoint(3.7);
var : cnt(0),count(0),resell(0),ReES(0);
var : cond1(false),cond2(false);
//ma1
input : maPeriod1(8);
var : MAv1(0);
MAv1 = ma(C,maPeriod1);
//ma2
input : maPeriod2(16);
var : MAv2(0);
MAv2 = ma(C,maPeriod2);
//ma3
input : maPeriod3(23);
var : MAv3(0);
MAv3 = ma(C,maPeriod3);
//ma4
input : maPeriod4(47);
var : MAv4(0);
MAv4 = ma(C,maPeriod4);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if date != date[1] Then{
ReSell = 0;
ReES = 0;
}
if MarketPosition == -1 and MarketPosition != MarketPosition[1] and IsEntryName("최초매도") == true Then{
ReSell = 0;
ReES = 0;
}
if MarketPosition == -1 and MarketPosition != MarketPosition[1] and IsEntryName("재매도") == true Then
ReSell = ReSell+1;
if BarsSinceExit(1) == 1 and MarketPosition != MarketPosition[1] and IsExitName("매도청산4",1) == true Then
ReES = ReES+1;
cond1 = C > O or (C==O and C >= C[1]);
cond2 = C < O or (C==O and C < C[1]);
if MarketPosition >= 0 and
(count == 0 or
(count > 0 and IsExitName("매도청산4",1) == false) or
(count > 0 and countif(C > mav4,BarsSinceExit(1)) >= 1)) and
MAv1 < MAv2 and
MAv2 < MAv3 and
MAv3 < MAv4 and
C < MAv1 Then{
Sell("최초매도");
}
if MarketPosition == -1 Then{
ExitShort("매도청산2",AtStop,EntryPrice+Losspoint);
ExitShort("매도청산3",AtLimit,EntryPrice-Profitpoint);
}
if MarketPosition == -1 and C > MAv4 Then
ExitShort("매도청산1");
if count >= 1 Then{
if MarketPosition == 0 and
(IsEntryName("최초매도",1) == true or IsEntryName("재매도",1) == true) and
IsExitName("매도청산4",1) == True and
BarsSinceExit(1) >= 3 and
(Countif(cond1 == true,양봉갯수) == 양봉갯수 or Countif(cond1 == true,음봉갯수) == 음봉갯수) and
reSell < 재매도횟수 and
countif(C > mav4,BarsSinceExit(1)) < 1 Then
Sell("재매도");
}
if MarketPosition == -1 and BarsSinceEntry >= 3 and ReES < 재매도청산횟수 then{
if Countif(cond1 == true,양봉갯수) == 양봉갯수 or Countif(cond2 == true,음봉갯수) == 음봉갯수 Then
ExitShort("매도청산4");
}
즐거운 하루되세요
> 난정욱 님이 쓴 글입니다.
> 제목 : 30958 답변 부탁 드립니다
> 수고가 많으십니다 감사합니다
예스스탁 예스스탁 답변
2013-06-19 18:12:50
안녕하세요
예스스탁입니다.
진입양봉갯수, 진입음봉갯수, 청산양봉갯수, 청산음봉갯수
로 처리해서 올려드립니다.
1. 매수식
##매수식
input : LossPoint(0.65),진입양봉갯수(3),진입음봉갯수(3),청산양봉갯수(3),청산음봉갯수(3),
재매수횟수(3),재매수청산횟수(3),ProfitPoint(3.7);
var : cnt(0),count(0),rebuy(0),ReEL(0);
var : cond1(false),cond2(false);
//ma1
input : maPeriod1(8);
var : MAv1(0);
MAv1 = ma(C,maPeriod1);
//ma2
input : maPeriod2(16);
var : MAv2(0);
MAv2 = ma(C,maPeriod2);
//ma3
input : maPeriod3(23);
var : MAv3(0);
MAv3 = ma(C,maPeriod3);
//ma4
input : maPeriod4(47);
var : MAv4(0);
MAv4 = ma(C,maPeriod4);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if date != date[1] Then{
Rebuy = 0;
ReEL = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("최초매수") == true Then{
Rebuy = 0;
ReEL = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("재매수") == true Then
Rebuy = Rebuy+1;
if BarsSinceExit(1) == 1 and MarketPosition != MarketPosition[1] and IsExitName("매수청산4",1) == true Then
ReEL = ReEL+1;
cond1 = C > O or (C==O and C >= C[1]);
cond2 = C < O or (C==O and C < C[1]);
if MarketPosition <= 0 and
(count == 0 or
(count > 0 and IsExitName("매수청산4",1) == false) or
(count > 0 and countif(C < mav4,BarsSinceExit(1)) >= 1)) and
MAv1 > MAv2 and
MAv2 > MAv3 and
MAv3 > MAv4 and
C > MAv1 Then{
Buy("최초매수", OnClose, DEF);
}
if MarketPosition == 1 Then{
ExitLong("매수청산2",AtStop,EntryPrice-Losspoint);
ExitLong("매수청산3",AtLimit,EntryPrice+Profitpoint);
}
if MarketPosition == 1 and C < MAv4 Then
Exitlong("매수청산1");
if count >= 1 Then{
if MarketPosition == 0 and
(IsEntryName("최초매수",1) == true or IsEntryName("재매수",1) == true) and
IsExitName("매수청산4",1) == True and
BarsSinceExit(1) >= 3 and
(Countif(cond1 == true,진입양봉갯수) == 진입양봉갯수 or Countif(cond1 == true,진입음봉갯수) == 진입음봉갯수) and
rebuy < 재매수횟수 and
countif(C < mav4,BarsSinceExit(1)) < 1 Then
buy("재매수");
}
if MarketPosition == 1 and BarsSinceEntry >= 3 and ReEL < 재매수청산횟수 then{
if Countif(cond1 == true,청산양봉갯수) == 청산양봉갯수 or Countif(cond2 == true,청산음봉갯수) == 청산음봉갯수 Then
ExitLong("매수청산4");
}
2. 매도식
##매도식
input : LossPoint(0.65),진입양봉갯수(3),진입음봉갯수(3),청산양봉갯수(3),청산음봉갯수(3),
재매도횟수(3),재매도청산횟수(3),ProfitPoint(3.7);
var : cnt(0),count(0),resell(0),ReES(0);
var : cond1(false),cond2(false);
//ma1
input : maPeriod1(8);
var : MAv1(0);
MAv1 = ma(C,maPeriod1);
//ma2
input : maPeriod2(16);
var : MAv2(0);
MAv2 = ma(C,maPeriod2);
//ma3
input : maPeriod3(23);
var : MAv3(0);
MAv3 = ma(C,maPeriod3);
//ma4
input : maPeriod4(47);
var : MAv4(0);
MAv4 = ma(C,maPeriod4);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if date != date[1] Then{
ReSell = 0;
ReES = 0;
}
if MarketPosition == -1 and MarketPosition != MarketPosition[1] and IsEntryName("최초매도") == true Then{
ReSell = 0;
ReES = 0;
}
if MarketPosition == -1 and MarketPosition != MarketPosition[1] and IsEntryName("재매도") == true Then
ReSell = ReSell+1;
if BarsSinceExit(1) == 1 and MarketPosition != MarketPosition[1] and IsExitName("매도청산4",1) == true Then
ReES = ReES+1;
cond1 = C > O or (C==O and C >= C[1]);
cond2 = C < O or (C==O and C < C[1]);
if MarketPosition >= 0 and
(count == 0 or
(count > 0 and IsExitName("매도청산4",1) == false) or
(count > 0 and countif(C > mav4,BarsSinceExit(1)) >= 1)) and
MAv1 < MAv2 and
MAv2 < MAv3 and
MAv3 < MAv4 and
C < MAv1 Then{
Sell("최초매도");
}
if MarketPosition == -1 Then{
ExitShort("매도청산2",AtStop,EntryPrice+Losspoint);
ExitShort("매도청산3",AtLimit,EntryPrice-Profitpoint);
}
if MarketPosition == -1 and C > MAv4 Then
ExitShort("매도청산1");
if count >= 1 Then{
if MarketPosition == 0 and
(IsEntryName("최초매도",1) == true or IsEntryName("재매도",1) == true) and
IsExitName("매도청산4",1) == True and
BarsSinceExit(1) >= 3 and
(Countif(cond1 == true,진입양봉갯수) == 진입양봉갯수 or Countif(cond1 == true,진입음봉갯수) == 진입음봉갯수) and
reSell < 재매도횟수 and
countif(C > mav4,BarsSinceExit(1)) < 1 Then
Sell("재매도");
}
if MarketPosition == -1 and BarsSinceEntry >= 3 and ReES < 재매도청산횟수 then{
if Countif(cond1 == true,청산양봉갯수) == 청산양봉갯수 or Countif(cond2 == true,청산음봉갯수) == 청산음봉갯수 Then
ExitShort("매도청산4");
}
즐거운 하루되세요
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 30958 답변 부탁 드립니다
> 안녕하세요
예스스탁입니다.
올려드린 기존식에 외부변수로 처리가 되어 있습니다.
부변수(input)중 양봉개수와 음봉갯수가 해당 내용입니다.
##매수식
input : LossPoint(0.65),양봉갯수(3),음봉갯수(3),재매수횟수(3),재매수청산횟수(3),ProfitPoint(3.7);
var : cnt(0),count(0),rebuy(0),ReEL(0);
var : cond1(false),cond2(false);
//ma1
input : maPeriod1(8);
var : MAv1(0);
MAv1 = ma(C,maPeriod1);
//ma2
input : maPeriod2(16);
var : MAv2(0);
MAv2 = ma(C,maPeriod2);
//ma3
input : maPeriod3(23);
var : MAv3(0);
MAv3 = ma(C,maPeriod3);
//ma4
input : maPeriod4(47);
var : MAv4(0);
MAv4 = ma(C,maPeriod4);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if date != date[1] Then{
Rebuy = 0;
ReEL = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("최초매수") == true Then{
Rebuy = 0;
ReEL = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("재매수") == true Then
Rebuy = Rebuy+1;
if BarsSinceExit(1) == 1 and MarketPosition != MarketPosition[1] and IsExitName("매수청산4",1) == true Then
ReEL = ReEL+1;
cond1 = C > O or (C==O and C >= C[1]);
cond2 = C < O or (C==O and C < C[1]);
if MarketPosition <= 0 and
(count == 0 or
(count > 0 and IsExitName("매수청산4",1) == false) or
(count > 0 and countif(C < mav4,BarsSinceExit(1)) >= 1)) and
MAv1 > MAv2 and
MAv2 > MAv3 and
MAv3 > MAv4 and
C > MAv1 Then{
Buy("최초매수", OnClose, DEF);
}
if MarketPosition == 1 Then{
ExitLong("매수청산2",AtStop,EntryPrice-Losspoint);
ExitLong("매수청산3",AtLimit,EntryPrice+Profitpoint);
}
if MarketPosition == 1 and C < MAv4 Then
Exitlong("매수청산1");
if count >= 1 Then{
if MarketPosition == 0 and
(IsEntryName("최초매수",1) == true or IsEntryName("재매수",1) == true) and
IsExitName("매수청산4",1) == True and
BarsSinceExit(1) >= 3 and
(Countif(cond1 == true,양봉갯수) == 양봉갯수 or Countif(cond1 == true,음봉갯수) == 음봉갯수) and
rebuy < 재매수횟수 and
countif(C < mav4,BarsSinceExit(1)) < 1 Then
buy("재매수");
}
if MarketPosition == 1 and BarsSinceEntry >= 3 and ReEL < 재매수청산횟수 then{
if Countif(cond1 == true,양봉갯수) == 양봉갯수 or Countif(cond2 == true,음봉갯수) == 음봉갯수 Then
ExitLong("매수청산4");
}
##매도식
input : LossPoint(0.65),양봉갯수(3),음봉갯수(3),재매도횟수(3),재매도청산횟수(3),ProfitPoint(3.7);
var : cnt(0),count(0),resell(0),ReES(0);
var : cond1(false),cond2(false);
//ma1
input : maPeriod1(8);
var : MAv1(0);
MAv1 = ma(C,maPeriod1);
//ma2
input : maPeriod2(16);
var : MAv2(0);
MAv2 = ma(C,maPeriod2);
//ma3
input : maPeriod3(23);
var : MAv3(0);
MAv3 = ma(C,maPeriod3);
//ma4
input : maPeriod4(47);
var : MAv4(0);
MAv4 = ma(C,maPeriod4);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if date != date[1] Then{
ReSell = 0;
ReES = 0;
}
if MarketPosition == -1 and MarketPosition != MarketPosition[1] and IsEntryName("최초매도") == true Then{
ReSell = 0;
ReES = 0;
}
if MarketPosition == -1 and MarketPosition != MarketPosition[1] and IsEntryName("재매도") == true Then
ReSell = ReSell+1;
if BarsSinceExit(1) == 1 and MarketPosition != MarketPosition[1] and IsExitName("매도청산4",1) == true Then
ReES = ReES+1;
cond1 = C > O or (C==O and C >= C[1]);
cond2 = C < O or (C==O and C < C[1]);
if MarketPosition >= 0 and
(count == 0 or
(count > 0 and IsExitName("매도청산4",1) == false) or
(count > 0 and countif(C > mav4,BarsSinceExit(1)) >= 1)) and
MAv1 < MAv2 and
MAv2 < MAv3 and
MAv3 < MAv4 and
C < MAv1 Then{
Sell("최초매도");
}
if MarketPosition == -1 Then{
ExitShort("매도청산2",AtStop,EntryPrice+Losspoint);
ExitShort("매도청산3",AtLimit,EntryPrice-Profitpoint);
}
if MarketPosition == -1 and C > MAv4 Then
ExitShort("매도청산1");
if count >= 1 Then{
if MarketPosition == 0 and
(IsEntryName("최초매도",1) == true or IsEntryName("재매도",1) == true) and
IsExitName("매도청산4",1) == True and
BarsSinceExit(1) >= 3 and
(Countif(cond1 == true,양봉갯수) == 양봉갯수 or Countif(cond1 == true,음봉갯수) == 음봉갯수) and
reSell < 재매도횟수 and
countif(C > mav4,BarsSinceExit(1)) < 1 Then
Sell("재매도");
}
if MarketPosition == -1 and BarsSinceEntry >= 3 and ReES < 재매도청산횟수 then{
if Countif(cond1 == true,양봉갯수) == 양봉갯수 or Countif(cond2 == true,음봉갯수) == 음봉갯수 Then
ExitShort("매도청산4");
}
즐거운 하루되세요
> 난정욱 님이 쓴 글입니다.
> 제목 : 30958 답변 부탁 드립니다
> 수고가 많으십니다 감사합니다