답변완료
수식 수정부탁드립니다.
안녕하십니까
작성하여 주신 아래수식 잘 사용중입니다.
매수조건을 추가 하고 싶어 문의 드립니다.
----------------------------------------------------
input : 금액(10000000),ntime(100000);
var : 상한가(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0);
input : P(20),진입횟수(3),BBP(20),dv(2);
input : 진입시작1(91500),진입종료1(110000);
input : 진입시작2(130000),진입종료2(153000);
var : mav(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;
mav = ma(C,P);
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;
}
}
if MarketPosition == 0 Then
{
if Tcond == true and
entry < 진입횟수 and #당일진입은 3회까지
C > DayOpen and #일봉양봉
mav > mav[1] and
(TotalTrades == 0 or (TotalTrades > 0 and CountIf(mav<mav[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(C,mav) Then
Buy("b");
}
if MarketPosition == 1 Then
#if CrossDown(C,BBup) Then #볼밴상단 하향돌파
#ExitLong("bx2");
ExitLong("bx",AtLimit,상한가);
SetStopProfittarget(1.8,PercentStop);
SetStopLoss(1.3,PercentStop);
SetStopEndofday(151500);
------------------------------------------------------------------
현재 매수조건(분봉에 적용)
1. 일봉양봉
2. 20거래량 평균 2배이상 거래량 발생
위 조건 만족후
3. 현재가격이 20일선 하향 돌파
추가 조건
4. 5,20,60일선이 정배열
5. 20일선 상승
위 조건이 모두 만족 할때 매수
잘부탁드립니다.
감사합니다.
2022-05-04
1105
글번호 158572
시스템
답변완료
PINE 을 YES로 요청해 봅니다.
항상 감사하게 도움받고 있습니다.
다음은 pine 스크립트로 작성된 것인데....YES LANGUAGE로 변환하고 싶습니다. 저는 YES를 사용하기를 원해서,...
둘 다 익숙치 않아 해보다가 그래도 한번 도움 받으면 다음에는 혼자 가능하지 않을까 싶어서 도움 요청해 봅니다. 무리한 요청이라면 거절해 주셔도 충분히 이해하겠습니다.
length = input(14, minval=1)
src = input(close, title="Source")
mult = input(2.0, minval=0.001, maxval=50)
maLen=input(7,title="maLength")
basis = sma(src, length)
dev = mult * atr(length)
upper = basis + dev
lower = basis - dev
bbr = (src - lower)/(upper - lower)
bbe= ema(bbr,maLen)
up = bbe[1]>bbe and bbe[2]<bbe[1]?bbe:na
bt = bbe[1]<bbe and bbe[2]>bbe[1]?bbe:na
topH=na(up)==0?highest(3):na
bottomL=na(bt)==0?lowest(3):na
tf= fixnan(topH)
bf =fixnan(bottomL)
btop=close>open?close:open
bbot=close>open?open:close
plot(tf,color=red,style=circles,linewidth=1,offset=-1)
plot(bf,color=green,style=circles,linewidth=1,offset=-1)
감사합니다.
2022-05-04
810
글번호 158561
지표
답변완료
수정 요청
먼저 답변에 감사드립니다. 질문이 많다 보니 발생하는 문제가 있었던 것같습니다.
질문1) 최저가라인은 장대양봉출현 이후부터의 저가라인이기 때문에 장대양봉의 저가는 제외가 되어야 하는데 아래의 수식으로 하면 장대양봉의 저가가 포함되어 버립니다.
횡보가 시작되는 첫번째캔들부터 기준캔들(5번째 캔들)까지의 최저가를 비교 가격으로 삼아 이후 캔들이 횡보상단가나 하단가를 이탈하는 캔들이 나오기 바로 직전까지의 최저가선을 긋는 수식. 5번째 캔들 이전과 이탈캔들 나온 뒤에는 선이 나타나지 않아야 합니다.
그리고 if Index <= var1+기준캔들 Then 이 수식도 if Index >= var1+기준캔들 Then 으로 바뀌어야 하는 것이 아닌지 ..... 바꾸니까 얼추 비슷하게는 나오는 것같습니다. 여러 가지로 시도해 보았지만 원하는 선이 나오지 않아서 다시 질문드립니다.
질문2) 위의 질문과 관련하여 5번째캔들까지의 최저가를 기준가격으로 하여 그 이후 캔들이 횡보가를 위 또는 아래로 이탈하기 전까지 기준가격의 저가를 깨는 횟수를 카운트하여 5회가 넘을 때의 Find(카운트) 종목 검색식도 같이 답변해 주셨는데 같이 수정을 부탁드립니다.
================================
앞에서 답변해 주신 내용
질문1)
input : 비율1(20), 비율2(3), 기간(60), 횟수(10);
var : 장대양봉조건(False),시종중심가(0),상단가(0),하단가(0),count(0),
기준캔들(5),LL(0);
장대양봉조건 = C>O and H>O*(1+비율1/100) and V>ma(V,기간)[1] ;
시종중심가= (C+O)/2;
IF 장대양봉조건 Then
{
상단가 = H*(1+비율2/100);
하단가 = (C+O)/3*2;
Condition1 = true;
count = 0;
LL = L;
var1 = Index;
}
Else
{
if 시종중심가 > 상단가 or 하단가 > 시종중심가 then
Condition1 = False;
if Condition1 == true Then
{
if Index <= var1+기준캔들 Then
{
if L < LL Then
LL = L;
}
plot1(LL);
}
}
질문2
input : 비율1(20), 비율2(3), 기간(60), 횟수(5);
var : 장대양봉조건(False),시종중심가(0),상단가(0),하단가(0),count(0),
기준캔들(5),LL(0);
장대양봉조건 = C>O and H>O*(1+비율1/100) and V>ma(V,기간)[1] ;
시종중심가= (C+O)/2;
IF 장대양봉조건 Then
{
상단가 = H*(1+비율2/100);
하단가 = (C+O)/3*2;
Condition1 = true;
count = 0;
LL = L;
var1 = Index;
}
Else
{
if 시종중심가 > 상단가 or 하단가 > 시종중심가 then
Condition1 = False;
if Condition1 == true Then
{
if Index <= var1+기준캔들 Then
{
if L < LL Then
LL = L;
}
Else
{
if L < LL Then
{
count = count+1;
if count >= 횟수 Then
Find(1);
}
}
}
}
2022-05-03
834
글번호 158557
지표