예스스탁
예스스탁 답변
2023-04-17 13:20:05
안녕하세요
예스스탁입니다.
input : 시작시간(093300),끝시간(093900);
var : h1(0);
input : 고가갱신수(6);
input : uppyra검증1(0),상승pyra1(0),상승N1(440);
input : uppyra검증2(10),상승pyra2(0),상승N2(660);
input : up연속봉1(10),up연속small1(120),up연속large1(220);
input : up연속봉2(10),up연속small2(110),up연속large2(180);
var : T1(0),entry(0);
if Bdate != Bdate[1] Then
T1 = TotalTrades;
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if (sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then
{
H1 = H;
}
if stime >= 시작시간 and sTime <= 끝시간 Then
{
if h > h1 Then
h1 = h;
}
if sTime > 끝시간 and CrossUp(c,h1) and entry==0 Then
Buy("b1");
if MarketPosition == 0 and #현재 무포지션이고
EntryDate(1) == sdate and #직전거래가 오늘 발생한 거래이고
MarketPosition(1) == 1 and #직전거래가 매수거래이고
countif(DayHigh(0) != DayHigh(0)[1],BarsSinceExit(1)) >= 고가갱신수 Then #청산이후 당일고가 갱신이 n회이상 있었으면
{
buy("b2");
}
if MarketPosition == 1 and IsEntryName("b1") == true Then
{
if C >= EntryPrice+uppyra검증1 and MaxContracts < 상승N1 Then
buy("bb1",AtStop,LatestEntryPrice(0)+상승Pyra1);
}
if MarketPosition == 1 and IsEntryName("b2") == true then
{
if C >= EntryPrice+uppyra검증2 and MaxContracts < 상승N2 Then
buy("bb2",AtStop,LatestEntryPrice(0)+상승Pyra2);
}
if MarketPosition == 1 Then
{
#피라미딩 10개 이상 작동
if CurrentEntries >= 10 and accumN(iff(C<O,1,0),up연속봉1) == up연속봉1 and ExitDate(1) != sdate and AccumN(abs(C-O), up연속봉1) >= up연속small1 and AccumN(abs(C-O), up연속봉1) < up연속large1 then
ExitLong("연1");
#피라미딩 7개~10개 미만 작동
if CurrentEntries >= 7 and CurrentEntries < 10 and accumN(iff(C<O,1,0),up연속봉2) == up연속봉2 and ExitDate(1) != sdate and AccumN(abs(C-O), up연속봉2) >= up연속small2 and AccumN(abs(C-O), up연속봉2) < up연속large2 then
ExitLong("연2");
}
즐거운 하루되세요
> 목마와숙녀 님이 쓴 글입니다.
> 제목 : 문의
> 연속봉으로 청산하는 수식에 수정을 요청합니다.
아래수식은 별첨파일처럼 피라미딩 수에 상관없이 연속봉 청산이 작동됩니다.
연속봉1은 피라미딩 10개부터 exitlong 작동하고
연속봉2는 피라미딩 7개부터 exitlong 작동되도록 요청합니다.
****************************************************************************************
input : 시작시간(093300),끝시간(093900);
var : h1(0);
input : 고가갱신수(6);
input : uppyra검증1(0),상승pyra1(0),상승N1(440);
input : uppyra검증2(10),상승pyra2(0),상승N2(660);
input : up연속봉1(10),up연속small1(120),up연속large1(220);
input : up연속봉2(10),up연속small2(110),up연속large2(180);
var : T1(0),entry(0);
if Bdate != Bdate[1] Then
T1 = TotalTrades;
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if (sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then
{
H1 = H;
}
if stime >= 시작시간 and sTime <= 끝시간 Then
{
if h > h1 Then
h1 = h;
}
if sTime > 끝시간 and CrossUp(c,h1) and entry==0 Then
Buy("b1");
if MarketPosition == 0 and #현재 무포지션이고
EntryDate(1) == sdate and #직전거래가 오늘 발생한 거래이고
MarketPosition(1) == 1 and #직전거래가 매수거래이고
countif(DayHigh(0) != DayHigh(0)[1],BarsSinceExit(1)) >= 고가갱신수 Then #청산이후 당일고가 갱신이 n회이상 있었으면
{
buy("b2");
}
if MarketPosition == 1 and IsEntryName("b1") == true Then
{
if C >= EntryPrice+uppyra검증1 and MaxContracts < 상승N1 Then
buy("bb1",AtStop,LatestEntryPrice(0)+상승Pyra1);
}
if MarketPosition == 1 and IsEntryName("b2") == true then
{
if C >= EntryPrice+uppyra검증2 and MaxContracts < 상승N2 Then
buy("bb2",AtStop,LatestEntryPrice(0)+상승Pyra2);
}
#피라미딩 10개 이상부터 작동
if accumN(iff(C<O,1,0),up연속봉1) == up연속봉1 and ExitDate(1) != sdate and AccumN(abs(C-O), up연속봉1) >= up연속small1 and AccumN(abs(C-O), up연속봉1) < up연속large1 then
ExitLong("연1");
#피라미딩 7개 이상부터 작동
if accumN(iff(C<O,1,0),up연속봉2) == up연속봉2 and ExitDate(1) != sdate and AccumN(abs(C-O), up연속봉2) >= up연속small2 and AccumN(abs(C-O), up연속봉2) < up연속large2 then
ExitLong("연2");