답변완료
수식 수정,추가 부탁드립니다.
안녕하세요?
아래수식에서 일부 수정및 추가 부탁드립니다.
수정)
정배열에서 매수, 역배열에서 매도 로 되어있는데, 이것을
정배열에서 매도, 역배열에서 매수 로 바꾸고싶습니다.
추가)
1. 정배열에서 매도진입후 골든크로스 발생시 청산
2. 역배열에서 매수진입후 데드크로스 발생시 청산
3. 1번과2번의 골든/데드크로스에 청산 또는 기존설정되어있는 익/손절에 먼저 도달하는것에 청산. 이후 다음신호발생전까지 재진입x
감사합니다.
input : b기준선(0.05),s기준선(0.95),n(3),P1(5),P2(20);
var : entry(0);
if Bdate != Bdate[1] Then
entry = 0;
var1 = C%1;
var2 = C%1;
value1 = ma(C,P1);
value2 = ma(C,P2);
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if entry < n Then
{
if MarketPosition == 0 and C > O and b기준선 == var1 and value1 < Value2 then
Buy();
if MarketPosition == 0 and C < O and s기준선 == Var2 and value1 > Value2 then
Sell();
}
input : 익절틱수(50),손절틱수(50);
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
2021-01-16
1173
글번호 145503
시스템
답변완료
문의
수식 답변 고맙습니다.
첨부파일은 아래수식 시뮬레이션 결과입니다
1분차트
data2 kp외국인순매수금액
data3 kp기관계순매수금액
문제점은
시작시간을 10시로 했을 경우 9시01분에 진입하는 경우들이 생깁니다.
수식 살펴주세요.
항상 고맙습니다.
**********************************************************************************
안녕하세요
예스스탁입니다.
input : b1(28),b2(28),X1(28),X2(28),ER(8),EF(8),CR(8),CF(8),거래횟수(20),시작시간(090000) ;
var : T1(0,Data1),entry(0,Data1),LL(0,Data1),EH(0,Data1),E1(0,Data1),H1(0,Data1),i1(0,Data1),S1(0,Data1),L1(0,Data1),V1(0,Data1);
var : sum(0,Data1);
sum = Data2(c)+data3(c);
if Data2((sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간)) Then
{
T1 = TotalTrades;
E1 = 0;
LL = sum;
}
if data2(stime >= 시작시간) then
{
if sum < LL Then
LL = sum;
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if MarketPosition == 0 and entry == 0 Then
{
if E1 == 0 and sum >= LL+data2(PriceScale)*B1 and sum[1] < LL+data2(PriceScale)*B1 Then
{
E1 = 1;
H1 = sum;
i1 = data2(index);
V1 = LL; //시작점 종가
}
if E1 == 1 and data2(index > i1) then
{
if sum > H1 Then
H1 = sum;
#저가가 시작봉종가보다 클때만 눌림체크
if sum >= V1 and sum <= H1-data2(PriceScale)*ER Then
{
E1 = 2;
i1 = data2(index);
S1 = H1;
}
}
//시작점 종가보다 낮은 가격이 발생하면 초기화
if E1 >= 1 and sum < V1 Then
{
E1 = 0;
LL = L;
}
if E1 == 2 and data2(index) > i1 and sum >= S1+data2(PriceScale)*EF Then
{
buy("b1");
}
}
if TotalTrades > TotalTrades[1] Then
{
E1 = 0;
LL = sum;
}
if sum < LL Then
LL = sum;
if MarketPosition == 0 and entry >= 1 and entry < 거래횟수 Then
{
if E1 == 0 and sum >= LL+data2(PriceScale)*B2 and sum[1] < LL+data2(PriceScale)*B2 Then{
E1 = 1;
H1 = sum;
i1 = data2(index);
V1 = LL; //시작점 종가
}
if E1 == 1 and index > i1 then
{
if sum > H1 Then
H1 = sum;
#저가가 시작봉종가보다 클때만 눌림체크
if sum >= V1 and sum <= H1-data2(PriceScale)*ER Then
{
E1 = 2;
i1 = Data2(index);
S1 = H1;
}
}
//시작점 종가보다 낮은 가격이 발생하면 초기화
if E1 >= 1 and sum < V1 Then
{
E1 = 0;
LL = sum;
}
if E1 == 2 and data2(index) > i1 and sum >= S1+data2(PriceScale)*EF Then
{
buy("b2");
}
}
if MarketPosition == 1 Then
{
if entry >= 1 then
{
if CurrentContracts > CurrentContracts[1] Then
{
EH = sum;
E1 = 0;
}
if sum > EH Then
{
EH = sum;
E1 = 0;
}
if E1 == 0 and sum <= EH-data2(PriceScale)*X1 Then
{
E1 = 1;
L1 = sum;
i1 = index;
}
if E1 == 1 and data2(index) > i1 Then
{
if sum < L1 Then
L1 = sum;
if H >= L1+PriceScale*CR Then
{
E1 = 2;
I1 = data2(index);
S1 = L1;
}
}
if E1 == 2 and data2(index) > i1 and sum <= S1-data2(PriceScale)*CF Then
{
exitlong("bx1");
E1 = 0;
}
}
}
if MarketPosition == 1 Then
{
if entry >= 1 then
{
if CurrentContracts > CurrentContracts[1] Then
{
EH = sum;
E1 = 0;
}
if sum > EH Then
{
EH = sum;
E1 = 0;
}
if E1 == 0 and C <= EH-data2(PriceScale)*X2 Then
{
E1 = 1;
L1 = sum;
i1 = data2(index);
}
if E1 == 1 and data2(index) > i1 Then
{
if sum < L1 Then
L1 = sum;
if H >= L1+data2(PriceScale)*CR Then
{
E1 = 2;
I1 = data2(index);
S1 = L1;
}
}
if E1 == 2 and data2(index) > i1 and sum <= S1-data2(PriceScale)*CF Then
{
exitlong("bx2");
E1 = 0;
}
}
}
}
즐거운 하루되세요
> 좌오비우오비 님이 쓴 글입니다.
> 제목 : 문의1
> 아래수식은 주차트에 사용하는 buy 수식입니다.
1. 보조차트2와 보조차트3을 이용해서 양합을 구합니다.
var : sum(0,Data1);
sum = Data2(c)+data3(c);
2. 구한 양합을 아래 수식에 따라 진입과 청산에 사용하고 싶습니다.
2021-01-16
1222
글번호 145502
시스템
답변완료
전고점 돌파 매매
제가 쓰는 수식을 바탕으로 전고점 돌파매매로 변환해 보고싶습니다.
매수는 전고점 돌파시마다 5차매수까지 진행, 동일비율로 진입합니다.
그리고 손절선을 1차매수시 -5%, 2차매수시 평균단가 -2.5%, 3차매수시 평균단가 -1.7%,
4차매수시 평균단가 -1.25%, 5차매수시 평균단가 -1.0%로 지정합니다.
수익실현은 따로 설정하지 않고, 손절시에는 처음부터 다시 1차매수로 진입하도록 하고 싶습니다. 전고점 확인봉 개수는 5분봉을 이용하고 첨부한 파일처럼.. 대략 120개 정도 되는거 같습니다. 이부분이 명확하지 않다면 일반적으로 전고점 확인하는 갯수로 지정해주셔도 됩니다.
아래는 제가 사용하는 수식입니다.
----------------
Input : 투자금액(10000000),Period(20), MultiD(2), N(1),시작일(20200921),시작시간(090000),청산시간(153000);
Input : loss(5),P(3),WRP(10);
var : e(0),x(0),count(0),Tcond(false),BBup(0),BBdn(0),WR(0),Vma(0);
var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false);
var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false);
Array : VV[6](0),XX[5](0);
BBup = BollBandUp(Period,MultiD);
BBdn = BollBandDown(Period,MultiD);
WR = WILLR(WRP);
Vma = ma(V,P);
vv[0] = floor((투자금액*0.1)/NextBarOpen);
vv[1] = floor((투자금액*0.1)/NextBarOpen);
vv[2] = floor((투자금액*0.1)/NextBarOpen);
vv[3] = floor((투자금액*0.2)/NextBarOpen);
vv[4] = floor((투자금액*0.2)/NextBarOpen);
vv[5] = floor((투자금액*0.3)/NextBarOpen);
if NextBarSdate >= 시작일 and NextBarStime >= 시작시간 Then
Tcond = true;
if bdate != bdate[1] Then
count = 0;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
count = count+1;
if sdate >= 시작일 and stime >= 시작시간 Then
Tcond = true;
if Tcond == true and NextBarStime <= 151000 then{
if (TotalTrades == 0 or MarketPosition == 0 and BarsSinceExit(1) > 2) then{
if MarketPosition == 0 and count < N and CrossDown(c,bbdn) and
V >= Vma[1]*2.0 Then {
buy("b1",atmarket,def,vv[MaxEntries]);
}
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] Then{
e = e +1;
if e == 1 then
XX[e] = CurrentContracts;
Else
XX[e] = CurrentContracts-CurrentContracts[1];
}
#두번째 매수
if MarketPosition == 1 and e == 1 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b2",atmarket,def,vv[MaxEntries]);
}
#세번재매수
if MarketPosition == 1 and e == 2 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b3",atmarket,def,vv[MaxEntries]);
}
#네번재매수
if MarketPosition == 1 and e == 3 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b4",atmarket,def,vv[MaxEntries]);
}
#다섯번재매수
if MarketPosition == 1 and e == 4 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b5",atmarket,def,vv[MaxEntries]);
}
#여섯번재매수
if MarketPosition == 1 and e == 5 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*3.0 Then
{
buy("b6",atmarket,def,vv[MaxEntries]);
}
HH = highest(H,BarsSinceEntry);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx1" Then
Bxcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx2" Then
Bxcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx3" Then
Bxcond3 = true;
if Bxcond1 == false and HH >= EntryPrice*1.10 and HH < EntryPrice*1.15 Then
ExitLong("Bx1",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(1/5)),1);
if Bxcond2 == false and HH >= EntryPrice*1.15 and HH < EntryPrice*1.20 Then
ExitLong("Bx2",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
if Bxcond3 == false and HH >= EntryPrice*1.20 and HH < EntryPrice*1.30 Then
ExitLong("Bx3",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
}}}
2021-01-15
1509
글번호 145495
시스템