답변완료
수식 수정부탁드립니다.
안녕하십니까
아래수식 중 일부 수정 부탁드립니다.
input : 금액(10000000),ntime(100000);
var : 상한가(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0);
input : P1(5),P2(20),P3(60),P(20),진입횟수(3),BBP(20),dv(2);
input : 진입시작1(91500),진입종료1(110000);
input : 진입시작2(130000),진입종료2(153000);
var : mav1(0),mav2(0),mav3(0),entry(0),volma(0),Tcond(False),BBup(0);
if Bdate != Bdate[1] Then
{
entry = 0;
Condition1 = False;
}
if TotalTrades > TotalTrades[1] Then
Condition1 = False;
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
mav1 = ma(C,P1);
mav2 = ma(C,P2);
mav3 = ma(C,P3);
volma = ma(V,P);
BBup = BollBandUp(BBP,dv);
Tcond = (sTime >= 진입시작1 and sTime < 진입종료1) or (sTime >= 진입시작2 and sTime < 진입종료2); #오전 09:30~11:00, 오후 1:00~15:30분 사이만 매수
if date >= 19981207 then {
if date < 20050328 && CodeCategory() == 2 then
UpLimit = (BP[0] * 1.12);
Else if date >= 20050328 and date < 20150615 Then
UpLimit = (BP[0] * 1.15);
Else
UpLimit = (BP[0] * 1.30);
if CodeCategory() == 2 then
{
if date >= 20030721 then
{
up1 = int(UpLimit/100+0.00001)*100;
up2 = int(UpLimit/100+0.00001)*100;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/5+0.00001)*5;
up7 = int(UpLimit/1+0.00001)*1;
}
else
{
up1 = int(UpLimit/1000+0.00001)*1000;
up2 = int(UpLimit/500+0.00001)*500;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/10+0.00001)*10;
up7 = int(UpLimit/1+0.00001)*1;
}
}
Else
{
up1 = int(UpLimit/1000+0.00001)*1000;
up2 = int(UpLimit/500+0.00001)*500;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/5+0.00001)*5;
up7 = int(UpLimit/1+0.00001)*1;
}
if CodeCategory() == 1 || CodeCategory() == 2 then
{
if sdate < 20101004 Then
{
If BP >= 500000 Then
상한가 = up1;
Else If BP >= 100000 Then
상한가 = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
상한가 = iff(up3>=100000, up2, up3);
Else If BP >= 10000 Then
상한가 = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
상한가 = iff(up5>=10000, up4, up5);
Else If BP >= 1000 Then
상한가 = iff(up5>=5000, up5, up6);
Else
상한가 = iff(up6>=1000, up6, up6);
}
Else
{
If BP >= 500000 Then
상한가 = up1;
Else If BP >= 100000 Then
상한가 = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
상한가 = iff(up3>=100000, up2, up3);
Else If BP >= 10000 Then
상한가 = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
상한가 = iff(up5>=10000, up4, up5);
Else If BP >= 1000 Then
상한가 = iff(up5>=5000, up5, up6);
Else
상한가 = iff(up6>=1000, up6, up7);
}
}
else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF
상한가 = up6;
}
}
var1 = ma(v,P1);
var2 = ma(v,P2);
var3 = ma(v,P3);
if MarketPosition == 0 Then
{
if Tcond == true and
entry < 진입횟수 and #당일진입은 3회까지
C > DayOpen and #일봉양봉
mav2 > mav2[1] and
(TotalTrades == 0 or (TotalTrades > 0 and CountIf(mav2<mav2[1],BarsSinceExit(1)) >= 1)) and
V >= volma[1]*2.0 Then #20거래량 평균 2배이상 거래량 발생
{
Condition1 = true;
TL_New(sDate,sTime,0,sDate,sTime,9999999);
}
if Condition1 == true and
CrossDown(var1,var3) and var1 < Var2 and
mav1 > mav2 and mav2 > mav3 and mav2 > mav2[1] Then
Buy("b");
}
if MarketPosition == 1 Then
#if CrossDown(C,BBup) Then #볼밴상단 하향돌파
#ExitLong("bx2");
ExitLong("bx",AtLimit,상한가);
SetStopProfittarget(1.7,PercentStop);
SetStopLoss(1.3,PercentStop);
SetStopEndofday(151500);
#ㅇ 현재 조건
#1. 일봉양봉
#2. 20거래량 평균 2배이상 거래량 발생
#위 조건 만족후
#3. 5거래량 이동평균이 20, 60일 거래량 이동평균을 차례로 하향돌파
#4. 5,20,60일 가격이동 평균선이 정배열
#5. 20일선 가격이동평균선 상승
#ㅇ 수정 요청 사항
#1. 일봉양봉
#2. 5거래량 이동평균이 20, 60일 거래량 이동평균을 차례로 하향돌파
#3. 5,20,60일 가격이동 평균선이 정배열
#4. 20일선 가격이동평균선 상승
잘 부탁 드립니다.
감사합니다.
2022-05-10
847
글번호 158726
시스템
답변완료
수식 문의드립니다!
항상 수고가 많으십니다. 수식작성중 어려움이 있어 도움을 받고자 글 남깁니다.
제가 구현하고자 하는 수식은
1. 볼벤 상하단을 일목균형표의 후행스팬이 상향,하향 돌파했을시. 그 값을 저장
(이후부터는 빠른 이해를 위해 상향돌파 기준으로만 작성하지만 실제식은 하,상향 둘다 적용시길 예정)
2. 후행스팬이 볼벤 상단을 유지중일때 1번값 밑으로 내려간가면 손절, 다시 위로 올라간다면 재진입
3. 340포인트 이상 나왔을시나 볼벤안으로 후행스팬이 재진입했을시 익절
4. 하루 340포인트 이상 수익이 나왔을시 그날은 거래 중지.
5. 340포인트의 수익을 봤다면 볼밴 진입전까지는 거래 중지.
이렇게 수식을 짜고싶습니다. 지금 대략적으로 수식을 짠게 있지만 생각처럼 작동하지 않아서 한번 부탁드립니다. 언제나 고생이 많으십니다. 감사합니다
기존 수식)
Input : Period(20), MultiD(2);
var : BBup(0),BBdn(0),B_Money(0),S_Money(0),StateSwich(True);
BBup = BollBandUp(Period,MultiD);
BBdn = BollBandDown(Period,MultiD);
if CrossUp(c,BBup[25]) Then{
StateSwich = True;
B_Money = c;
}
if CrossDown(c,BBdn[25]) Then{
StateSwich = False;
S_Money = c;
}
if StateSwich Then{
if c > BBup[25] and C > B_Money Then
Buy();
if c <= BBup[25] or c <= B_Money Then
ExitLong();
}
if !StateSwich Then{
if c < BBup[25] and C < S_Money Then
Sell();
if c >= BBup[25] Then
ExitShort();
if c >= S_Money Then
ExitShort();
}
빠른 답변 부탁드립니다.
2022-05-10
1043
글번호 158719
시스템