커뮤니티
수정식 의뢰
2018-04-30 14:19:35
331
글번호 118560
안녕하세요!
보내드린 수식은 이평 5 20 변곡 막대 수식입니다!
매매를 하다보니 막대수식에 가격이 표시되면 매매에 도움이 될 것 같아서 수식 수정을
부탁드립니다! 강세약세 첨부파일 화살표시 가격표시 부분 참조해 주세요!
가격표시가 꼭 화살표 부분이 안되면 다른 위치라도 가격표시가 되었으면 좋겠습니다!
감사합니다!
input : P1(5),P2(20);
var1 = ma(C,P1);
var2 = ma(C,P2);
if crossup(var1,var2) Then
value1 = (var1+var2)/2;
if CrossDown(var1,var2) Then
value2 = (var1+var2)/2;
plot1(var1,"이평1");
plot2(var2,"이평2");
plot3(value1,"골드");
plot4(value2,"데드");
---------------------------------------------------------------------------------
2. 추가로 수식을 올립니다! 첨부파일은 수식대로 나온 결과 입니다!
수정을 부탁드려요!
2번째 첨부파일을 보면 노랑색선과 녹색선이 있는데 이 선들을 좀더 길게 연장하고 싶습니다!
첨부 그림은 제가 수동으로 연장을 하였습니다!
최근을기준으로 8개 변곡선이 연장이 되었으면 좋겠습니다!
Input:length1(12);
Var: j1(0),lastHiVal1(0),lastLoVal1(0),sBar1(0),eBar1(0),TL11(0),TL12(0),Text11(0),처리구분1(""),T(0);
var : A1(0),V1(0),D1(0),T1(0),Bcond(false);
var : A2(0),V2(0),D2(0),T2(0),Scond(false);
Array:고점1[10,2](0),저점1[10,2](0); //가격,위치
##############
Input:chRate(0.5); //전환율 또는 변동률
Var:j(0),upTr(100),dnTr(-100),upRate(0),dnRate(0),trnd(0),TL(0),
date11(0),date12(0),time11(0),time12(0),TL1(0),
date21(0),date22(0),time21(0),time22(0),TL2(0),
date31(0),date32(0),time31(0),time32(0),TL3(0);
Array:hiVal[10](0),loVal[10](0),hiBar[10](0),loBar[10](0);
//hiVal[1]은 전고점, hiVal[2]는 전전고점, hiVal[3]은 전전전고점
//hiVal[0]은 변곡점 이후 현재봉까지의 고점. 현재 고점은 진행중이므로 계속 바뀐다.
//loVal[0]은 반대 개념
처리구분1 = "";
If Highest(H,length1) == H and lastHiVal1 <> H and
Lowest(L,length1) == L and lastLoVal1 <> L Then
{
If 저점1[1,1] > L Then 처리구분1 = "저점처리";
If 고점1[1,1] < H Then 처리구분1 = "고점처리";
}
Else If Highest(H,length1) == H and lastHiVal1 <> H Then
처리구분1 = "고점처리";
Else If Lowest(L,length1) == L and lastLoVal1 <> L Then
처리구분1 = "저점처리";
If 처리구분1 == "고점처리" Then
{
lastHiVal1 = H;
If 고점1[1,2] < 저점1[1,2] Then
{
For j1 = 10 DownTo 2
{
고점1[j1,1] = 고점1[j1-1,1];
고점1[j1,2] = 고점1[j1-1,2];
}
}
If 고점1[1,2] < 저점1[1,2] or 고점1[1,1] < H Then
{
고점1[1,1] = H;
고점1[1,2] = Index;
sBar1 = Index - 저점1[1,2];
eBar1 = 0;
If TL_GetBeginDate(TL11) == sDate[sBar1] and
TL_GetBeginTime(TL11) == sTime[sBar1] Then
{
TL_Delete(TL11);
TL_Delete(TL12);
Text_Delete(Text11);
}
TL11 = TL_New(sDate[sBar1],sTime[sBar1],저점1[1,1],sDate[eBar1],sTime[eBar1],고점1[1,1]);
TL12 = TL_New(sDate[sBar1],sTime[sBar1],저점1[1,1],sDate[eBar1],sTime[eBar1],저점1[1,1]);
A1 = 1;
V1 = 저점1[1,1];
D1 = sDate[sBar1];
T1 = sTime[sBar1];
Text11 = Text_New(sDate[eBar1],sTime[eBar1],고점1[1,1],
NumToStr(고점1[1,1],2));
Text_SetStyle(Text11, 2, 1);
TL_SetSize(TL12,2);
TL_SetColor(TL12,green);
}
}
If 처리구분1 == "저점처리" Then
{
lastLoVal1 = L;
If 저점1[1,2] < 고점1[1,2] then
{
For j1 = 10 DownTo 2
{
저점1[j1,1] = 저점1[j1-1,1];
저점1[j1,2] = 저점1[j1-1,2];
}
}
If 저점1[1,2] < 고점1[1,2] or 저점1[1,1] > L then
{
저점1[1,1] = L;
저점1[1,2] = Index;
sBar1 = Index - 고점1[1,2];
eBar1 = 0;
If TL_GetBeginDate(TL11) == sDate[sBar1] and
TL_GetBeginTime(TL11) == sTime[sBar1] Then
{
TL_Delete(TL11);
TL_Delete(TL12);
Text_Delete(Text11);
}
TL11 = TL_New(sDate[sBar1],sTime[sBar1],고점1[1,1],
sDate[eBar1],sTime[eBar1],저점1[1,1]);
TL12 = TL_New(sDate[sBar1],sTime[sBar1],고점1[1,1],
sDate[eBar1],sTime[eBar1],고점1[1,1]);
A1 = -1;
V1 = 고점1[1,1];
D1 = sDate[sBar1];
T1 = sTime[sBar1];
Text11 = Text_New(sDate[eBar1],sTime[eBar1],저점1[1,1],
NumToStr(저점1[1,1],2));
Text_SetStyle(Text11, 2, 0);
TL_SetSize(TL12,2);
TL_SetColor(TL12,yellow);
}
}
TL_SetSize(TL11,2);
TL_SetColor(TL11,red);
###############################
upRate = 1 + (chRate/100); //상승률
dnRate = 1 - (chRate/100); //하락률
for j = 1 to 9 { //전고,전저점을 9개까지 보관
loBar[j] = loBar[j] + 1; //전저점의 위치. 현재 봉으로부터 떨어져 있는 거리
hiBar[j] = hiBar[j] + 1; //전고점의 위치
}
if hiVal[0] <= H or hiVal[0] == 0 then { //전고,전저점 이후 현재까지의 고점
hiVal[0] = H; //0을 체크한 이유는 초기에 값이 없는 구간이 생기기 때문
hiBar[0] = 0; //현재 고점의 위치가 0이란 것은 현재봉의 고가가 구간 고점이라는 의미
}
else {
hiBar[0] = hiBar[0] + 1; //현재 고점의 위치
}
if loVal[0] >= L or loVal[0] == 0 then { //전고,전저점 이후 현재까지 저점
loVal[0] = L;
loBar[0] = 0;
}
else {
loBar[0] = loBar[0] + 1; //현재 구간 저점의 위치
}
if trnd != dnTr && hiVal[0] > H && hiVal[0] * dnRate > L then trnd = dnTr;
//저가가 고가 대비 변동률보다 밑으로 떨어지면 하락추세로 설정
//단, 현재봉의 고가가 변곡점 이후 최고가이면 상승 추세가 진행중이라고 본다.
//그래서 현재봉의 고가가 hiVal[0]보다 작다는 조건이 추가되었다.
else if trnd != upTr && loVal[0] < L && loVal[0] * upRate < H then trnd = upTr;
//고가가 저가 대비 변동률보다 높으면 상승추세로 설정
if trnd[1] == upTr and trnd == dnTr then { //상승추세였다가 하락추세로 바뀌었다면
for j = 8 downto 1 { //새로운 전고점이 생기는 것이므로
hiVal[j+1] = hiVal[j]; //전고점을 하나씩 뒤로 보낸다.
hiBar[j+1] = hiBar[j]; //전고점은 전전고점이 되고, 전전고점은 전전전고점이 된다.
}
hiVal[1] = hiVal[0]; //새로운 전고점에 현재 고점을 대입
hiBar[1] = hiBar[0];
hiVal[0] = H; //전고점이 확정되었으므로 전고점 이후 최고가는 현재봉의 고가
hiBar[0] = 0;
loVal[0] = L;
loBar[0] = 0;
//전고점이 새로 생긴 것이니까 전저점에서 전고점까지 추세선을 긋는다.
date11 = date[loBar[1]]; //추세선 시작일. 전저점의 날짜
time11 = stime[loBar[1]]; //추세선 시작시간
Value11 = loVal[1]; //추세선 시작가격
date12 = date[hiBar[1]]; //추세선 종료일. 전고점의 날짜
time12 = stime[hiBar[1]]; //추세선 종료시간
Value12 = hiVal[1]; //추세선 종료가격
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
//TL_New는 신규 추세선을 그려주는 함수
A2 = -1;
V2 = Value12;
D2 = date12;
T2 = time12;
}
if trnd[1] == dnTr and trnd == dnTr and //추세는 하락 상태에서 바뀌지 않았는데
hiVal[1] < hiVal[0] and //전고점보다 더 높은 고점이 출현했다면
hiVal[0] * dnRate > L then {
hiVal[1] = hiVal[0]; //전고점을 현재의 고점으로 바꿔준다.
hiBar[1] = hiBar[0];
hiVal[0] = H;
hiBar[0] = 0;
loVal[0] = L;
loBar[0] = 0;
//전고점이 추가된 게 아니고 바뀐 것이므로 종료일,종료시간,종료가격만 바꿔준다.
date12 = date[hiBar[1]]; //추세선 종료일
time12 = stime[hiBar[1]];
Value12 = hiVal[1];
TL_SetEnd(TL1, date12,time12,Value12);
//TL_SetEnd는 기존추세선의 종료지점을 변경해주는 추세선 함수이다.
//TL_Delete 함수를 써서 직전의 추세선을 지우고 다시 TL_New로 추세선을 추가해도 된다.
}
if trnd[1] == dnTr and trnd == upTr then { //추세가 하락에서 상승으로 바뀌었을 경우
for j = 8 downto 1 {
//이전저점은 전전저점으로, 전전저점은 전전전저점으로 번호를 부여
loVal[j+1] = loVal[j];
loBar[j+1] = loBar[j];
}
loVal[1] = loVal[0];
loBar[1] = loBar[0];
loVal[0] = L;
loBar[0] = 0;
hiVal[0] = H;
hiBar[0] = 0;
date11 = date[hiBar[1]]; //전저점이 새로이 생긴 것이므로 시작점은 전고점이 된다.
time11 = stime[hiBar[1]];
Value11 = hiVal[1];
date12 = date[loBar[1]];
time12 = stime[loBar[1]];
Value12 = loVal[1];
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
A2 = 1;
V2 = Value12;
D2 = date12;
T2 = time12;
}
if trnd[1] == upTr and trnd == upTr and //추세는 상승을 유지하고 있는데
loVal[1] > loVal[0] and //전저점보다 낮은 저가가 출현했다면
loVal[0] * upRate < H then {
loVal[1] = loVal[0]; //직전의 전저점만 바꿔준다.
loBar[1] = loBar[0];
loVal[0] = L;
loBar[0] = 0;
hiVal[0] = H;
hiBar[0] = 0;
date12 = date[loBar[1]];
time12 = stime[loBar[1]];
Value12 = loVal[1];
TL_SetEnd(TL1, date12,time12,Value12);
}
if trnd == upTr and loVal[2] > loVal[1] then
TL_SetColor(TL1,BLUE);
else if trnd == dnTr and hiVal[2] < hiVal[1] then
TL_SetColor(TL1,RED);
else
TL_SetColor(TL1,BLACK);
TL_SetSize(TL1,2);
TL_SetColor(TL2,RED);
TL_SetColor(TL3,BLUE);
if var1 <= 0 and Trnd == uptr and Trnd != Trnd[1] Then{
var1 = 1;
value1 = loval[1];
TL1 = Text_New(sdate[lobar[1]],stime[lobar[1]],value1-PriceScale*2,"●");
TL_SetColor(TL,RED);
TL_SetSize(TL,2);
Text_SetStyle(TL1,2,2);
Text_SetColor(TL1,RED);#텍스트 색상
TL= Text_New(sdate[lobar[1]],stime[lobar[1]],L,"상승");
Text_SetColor(TL,RED);#텍스트 색상
}
if var1 >= 0 and Trnd == dntr and Trnd != Trnd[1] then{
var1 = -1;
value1 = hival[1];
TL2 = Text_New(sdate[hibar[1]],stime[hibar[1]],value1+PriceScale*2,"●");
TL_SetColor(TL,BLUE);
TL_SetSize(TL,2);
Text_SetStyle(TL2,2,2);#텍스트 좌우 상하 정렬
Text_SetColor(TL2,BLUE);#텍스트 색상
TL= Text_New(sdate[hibar[1]],stime[hibar[1]],H,"하락");
Text_SetColor(TL,BLUE);#텍스트 색상
}
Bcond = A1 == 1 and A2 == 1;
Scond = A1 == -1 and A2 == -1;
if Bcond == true and Bcond[1] == false and
V1 == V2 and
D1 == D2 and
T1 == T2 Then
buy();
if Scond == true and Scond[1] == false and
V1 == V2 and
D1 == D2 and
T1 == T2 Then
sell();
------------------------------------------------------------------------------------
3. 아래는 키움의 신호 입니다! 예스용으로 변환 부탁드립니다!
상한가
h == c AND
((if(c<5000,c+5,if(c<10000,c+10,if(c<50000,c+50,if(c<100000,c+100,if(c<500000,c+500,c+1000)))))) / c(1) > 1.15)
하한가
l == c AND
((if(c(1)<5000,c-5,if(c(1)<10000,c-10,if(c(1)<50000,c-50,if(c(1)<100000,c-100,if(c(1)<500000,c-500,c-1000 )))))) / c(1) < 0.85)
답변 1
예스스탁 예스스탁 답변
2018-04-30 10:47:01
안녕하세요
예스스탁입니다.
1.
input : P1(5),P2(20);
var1 = ma(C,P1);
var2 = ma(C,P2);
if crossup(var1,var2) Then{
value1 = (var1+var2)/2;
value11 = Text_New(sdate,stime,H,NumToStr(value1,2));
}
if CrossDown(var1,var2) Then{
value2 = (var1+var2)/2;
value22 = Text_New(sdate,stime,H,NumToStr(value1,2));
}
plot1(var1,"이평1");
plot2(var2,"이평2");
plot3(value1,"골드");
plot4(value2,"데드");
2
Input:length1(12);
Var: j1(0),lastHiVal1(0),lastLoVal1(0),sBar1(0),eBar1(0),TL11(0),Text11(0),처리구분1(""),T(0);
var : A1(0),V1(0),D1(0),T1(0),Bcond(false);
var : A2(0),V2(0),D2(0),T2(0),Scond(false),cnt(0),s(0);
Array:고점1[10,2](0),저점1[10,2](0); //가격,위치
##############
Input:chRate(0.5); //전환율 또는 변동률
Var:j(0),upTr(100),dnTr(-100),upRate(0),dnRate(0),trnd(0),TL(0),
date11(0),date12(0),time11(0),time12(0),TL1(0),
date21(0),date22(0),time21(0),time22(0),TL2(0),
date31(0),date32(0),time31(0),time32(0),TL3(0);
Array:hiVal[10](0),loVal[10](0),hiBar[10](0),loBar[10](0);
Array : TL12[10](0),TL13[10](0);
//hiVal[1]은 전고점, hiVal[2]는 전전고점, hiVal[3]은 전전전고점
//hiVal[0]은 변곡점 이후 현재봉까지의 고점. 현재 고점은 진행중이므로 계속 바뀐다.
//loVal[0]은 반대 개념
처리구분1 = "";
If Highest(H,length1) == H and lastHiVal1 <> H and
Lowest(L,length1) == L and lastLoVal1 <> L Then
{
If 저점1[1,1] > L Then 처리구분1 = "저점처리";
If 고점1[1,1] < H Then 처리구분1 = "고점처리";
}
Else If Highest(H,length1) == H and lastHiVal1 <> H Then
처리구분1 = "고점처리";
Else If Lowest(L,length1) == L and lastLoVal1 <> L Then
처리구분1 = "저점처리";
If 처리구분1 == "고점처리" Then
{
s = 1;
lastHiVal1 = H;
If 고점1[1,2] < 저점1[1,2] Then
{
For j1 = 10 DownTo 2
{
고점1[j1,1] = 고점1[j1-1,1];
고점1[j1,2] = 고점1[j1-1,2];
}
}
If 고점1[1,2] < 저점1[1,2] or 고점1[1,1] < H Then
{
고점1[1,1] = H;
고점1[1,2] = Index;
sBar1 = Index - 저점1[1,2];
eBar1 = 0;
If TL_GetBeginDate(TL11) == sDate[sBar1] and
TL_GetBeginTime(TL11) == sTime[sBar1] Then
{
TL_Delete(TL11);
TL_Delete(TL12[0]);
Text_Delete(Text11);
}
TL11 = TL_New(sDate[sBar1],sTime[sBar1],저점1[1,1],sDate[eBar1],sTime[eBar1],고점1[1,1]);
TL12[0] = TL_New(sDate[sBar1],sTime[sBar1],저점1[1,1],sDate[eBar1],sTime[eBar1],저점1[1,1]);
if S != S[1] Then
{
for cnt = 1 to 9
{
TL12[cnt] = TL12[cnt-1][1];
}
}
A1 = 1;
V1 = 저점1[1,1];
D1 = sDate[sBar1];
T1 = sTime[sBar1];
Text11 = Text_New(sDate[eBar1],sTime[eBar1],고점1[1,1],NumToStr(고점1[1,1],2));
Text_SetStyle(Text11, 2, 1);
TL_SetSize(TL12[0],2);
TL_SetColor(TL12[0],green);
TL_SetExtRight(TL12[0],true);
TL_SetExtRight(TL12[4],false);
}
}
If 처리구분1 == "저점처리" Then
{
s = -1;
lastLoVal1 = L;
If 저점1[1,2] < 고점1[1,2] then
{
For j1 = 10 DownTo 2
{
저점1[j1,1] = 저점1[j1-1,1];
저점1[j1,2] = 저점1[j1-1,2];
}
}
If 저점1[1,2] < 고점1[1,2] or 저점1[1,1] > L then
{
저점1[1,1] = L;
저점1[1,2] = Index;
sBar1 = Index - 고점1[1,2];
eBar1 = 0;
If TL_GetBeginDate(TL11) == sDate[sBar1] and
TL_GetBeginTime(TL11) == sTime[sBar1] Then
{
TL_Delete(TL11);
TL_Delete(TL13[0]);
Text_Delete(Text11);
}
TL11 = TL_New(sDate[sBar1],sTime[sBar1],고점1[1,1],sDate[eBar1],sTime[eBar1],저점1[1,1]);
TL13[0] = TL_New(sDate[sBar1],sTime[sBar1],고점1[1,1],sDate[eBar1],sTime[eBar1],고점1[1,1]);
if S != S[1] Then
{
for cnt = 1 to 9
{
TL13[cnt] = TL13[cnt-1][1];
}
}
A1 = -1;
V1 = 고점1[1,1];
D1 = sDate[sBar1];
T1 = sTime[sBar1];
Text11 = Text_New(sDate[eBar1],sTime[eBar1],저점1[1,1],NumToStr(저점1[1,1],2));
Text_SetStyle(Text11, 2, 0);
TL_SetSize(TL13[0],2);
TL_SetColor(TL13[0],yellow);
TL_SetExtRight(TL13[0],true);
TL_SetExtRight(TL13[4],false);
}
}
TL_SetSize(TL11,2);
TL_SetColor(TL11,red);
###############################
upRate = 1 + (chRate/100); //상승률
dnRate = 1 - (chRate/100); //하락률
for j = 1 to 9 { //전고,전저점을 9개까지 보관
loBar[j] = loBar[j] + 1; //전저점의 위치. 현재 봉으로부터 떨어져 있는 거리
hiBar[j] = hiBar[j] + 1; //전고점의 위치
}
if hiVal[0] <= H or hiVal[0] == 0 then { //전고,전저점 이후 현재까지의 고점
hiVal[0] = H; //0을 체크한 이유는 초기에 값이 없는 구간이 생기기 때문
hiBar[0] = 0; //현재 고점의 위치가 0이란 것은 현재봉의 고가가 구간 고점이라는 의미
}
else {
hiBar[0] = hiBar[0] + 1; //현재 고점의 위치
}
if loVal[0] >= L or loVal[0] == 0 then { //전고,전저점 이후 현재까지 저점
loVal[0] = L;
loBar[0] = 0;
}
else {
loBar[0] = loBar[0] + 1; //현재 구간 저점의 위치
}
if trnd != dnTr && hiVal[0] > H && hiVal[0] * dnRate > L then trnd = dnTr;
//저가가 고가 대비 변동률보다 밑으로 떨어지면 하락추세로 설정
//단, 현재봉의 고가가 변곡점 이후 최고가이면 상승 추세가 진행중이라고 본다.
//그래서 현재봉의 고가가 hiVal[0]보다 작다는 조건이 추가되었다.
else if trnd != upTr && loVal[0] < L && loVal[0] * upRate < H then trnd = upTr;
//고가가 저가 대비 변동률보다 높으면 상승추세로 설정
if trnd[1] == upTr and trnd == dnTr then { //상승추세였다가 하락추세로 바뀌었다면
for j = 8 downto 1 { //새로운 전고점이 생기는 것이므로
hiVal[j+1] = hiVal[j]; //전고점을 하나씩 뒤로 보낸다.
hiBar[j+1] = hiBar[j]; //전고점은 전전고점이 되고, 전전고점은 전전전고점이 된다.
}
hiVal[1] = hiVal[0]; //새로운 전고점에 현재 고점을 대입
hiBar[1] = hiBar[0];
hiVal[0] = H; //전고점이 확정되었으므로 전고점 이후 최고가는 현재봉의 고가
hiBar[0] = 0;
loVal[0] = L;
loBar[0] = 0;
//전고점이 새로 생긴 것이니까 전저점에서 전고점까지 추세선을 긋는다.
date11 = date[loBar[1]]; //추세선 시작일. 전저점의 날짜
time11 = stime[loBar[1]]; //추세선 시작시간
Value11 = loVal[1]; //추세선 시작가격
date12 = date[hiBar[1]]; //추세선 종료일. 전고점의 날짜
time12 = stime[hiBar[1]]; //추세선 종료시간
Value12 = hiVal[1]; //추세선 종료가격
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
//TL_New는 신규 추세선을 그려주는 함수
A2 = -1;
V2 = Value12;
D2 = date12;
T2 = time12;
}
if trnd[1] == dnTr and trnd == dnTr and //추세는 하락 상태에서 바뀌지 않았는데
hiVal[1] < hiVal[0] and //전고점보다 더 높은 고점이 출현했다면
hiVal[0] * dnRate > L then {
hiVal[1] = hiVal[0]; //전고점을 현재의 고점으로 바꿔준다.
hiBar[1] = hiBar[0];
hiVal[0] = H;
hiBar[0] = 0;
loVal[0] = L;
loBar[0] = 0;
//전고점이 추가된 게 아니고 바뀐 것이므로 종료일,종료시간,종료가격만 바꿔준다.
date12 = date[hiBar[1]]; //추세선 종료일
time12 = stime[hiBar[1]];
Value12 = hiVal[1];
TL_SetEnd(TL1, date12,time12,Value12);
//TL_SetEnd는 기존추세선의 종료지점을 변경해주는 추세선 함수이다.
//TL_Delete 함수를 써서 직전의 추세선을 지우고 다시 TL_New로 추세선을 추가해도 된다.
}
if trnd[1] == dnTr and trnd == upTr then { //추세가 하락에서 상승으로 바뀌었을 경우
for j = 8 downto 1 {
//이전저점은 전전저점으로, 전전저점은 전전전저점으로 번호를 부여
loVal[j+1] = loVal[j];
loBar[j+1] = loBar[j];
}
loVal[1] = loVal[0];
loBar[1] = loBar[0];
loVal[0] = L;
loBar[0] = 0;
hiVal[0] = H;
hiBar[0] = 0;
date11 = date[hiBar[1]]; //전저점이 새로이 생긴 것이므로 시작점은 전고점이 된다.
time11 = stime[hiBar[1]];
Value11 = hiVal[1];
date12 = date[loBar[1]];
time12 = stime[loBar[1]];
Value12 = loVal[1];
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
A2 = 1;
V2 = Value12;
D2 = date12;
T2 = time12;
}
if trnd[1] == upTr and trnd == upTr and //추세는 상승을 유지하고 있는데
loVal[1] > loVal[0] and //전저점보다 낮은 저가가 출현했다면
loVal[0] * upRate < H then {
loVal[1] = loVal[0]; //직전의 전저점만 바꿔준다.
loBar[1] = loBar[0];
loVal[0] = L;
loBar[0] = 0;
hiVal[0] = H;
hiBar[0] = 0;
date12 = date[loBar[1]];
time12 = stime[loBar[1]];
Value12 = loVal[1];
TL_SetEnd(TL1, date12,time12,Value12);
}
if trnd == upTr and loVal[2] > loVal[1] then
TL_SetColor(TL1,BLUE);
else if trnd == dnTr and hiVal[2] < hiVal[1] then
TL_SetColor(TL1,RED);
else
TL_SetColor(TL1,BLACK);
TL_SetSize(TL1,2);
TL_SetColor(TL2,RED);
TL_SetColor(TL3,BLUE);
if var1 <= 0 and Trnd == uptr and Trnd != Trnd[1] Then{
var1 = 1;
value1 = loval[1];
TL1 = Text_New(sdate[lobar[1]],stime[lobar[1]],value1-PriceScale*2,"●");
TL_SetColor(TL,RED);
TL_SetSize(TL,2);
Text_SetStyle(TL1,2,2);
Text_SetColor(TL1,RED);#텍스트 색상
TL= Text_New(sdate[lobar[1]],stime[lobar[1]],L,"상승");
Text_SetColor(TL,RED);#텍스트 색상
}
if var1 >= 0 and Trnd == dntr and Trnd != Trnd[1] then{
var1 = -1;
value1 = hival[1];
TL2 = Text_New(sdate[hibar[1]],stime[hibar[1]],value1+PriceScale*2,"●");
TL_SetColor(TL,BLUE);
TL_SetSize(TL,2);
Text_SetStyle(TL2,2,2);#텍스트 좌우 상하 정렬
Text_SetColor(TL2,BLUE);#텍스트 색상
TL= Text_New(sdate[hibar[1]],stime[hibar[1]],H,"하락");
Text_SetColor(TL,BLUE);#텍스트 색상
}
Bcond = A1 == 1 and A2 == 1;
Scond = A1 == -1 and A2 == -1;
if Bcond == true and Bcond[1] == false and
V1 == V2 and
D1 == D2 and
T1 == T2 Then
buy();
if Scond == true and Scond[1] == false and
V1 == V2 and
D1 == D2 and
T1 == T2 Then
sell();
3
if h == c AND
((iff(c<5000,c+5,iff(c<10000,c+10,iff(c<50000,c+50,iff(c<100000,c+100,iff(c<500000,c+500,c+1000)))))) / c[1] > 1.15) Then
buy();
if l == c AND
((iff(c[1]<5000,c-5,iff(c[1]<10000,c-10,iff(c[1]<50000,c-50,iff(c[1]<100000,c-100,iff(c[1]<500000,c-500,c-1000 )))))) / c[1] < 0.85) Then
sell();
즐거운 하루되세요
> qha71 님이 쓴 글입니다.
> 제목 : 수정식 의뢰
> 안녕하세요!
보내드린 수식은 이평 5 20 변곡 막대 수식입니다!
매매를 하다보니 막대수식에 가격이 표시되면 매매에 도움이 될 것 같아서 수식 수정을
부탁드립니다! 강세약세 첨부파일 화살표시 가격표시 부분 참조해 주세요!
가격표시가 꼭 화살표 부분이 안되면 다른 위치라도 가격표시가 되었으면 좋겠습니다!
감사합니다!
input : P1(5),P2(20);
var1 = ma(C,P1);
var2 = ma(C,P2);
if crossup(var1,var2) Then
value1 = (var1+var2)/2;
if CrossDown(var1,var2) Then
value2 = (var1+var2)/2;
plot1(var1,"이평1");
plot2(var2,"이평2");
plot3(value1,"골드");
plot4(value2,"데드");
---------------------------------------------------------------------------------
2. 추가로 수식을 올립니다! 첨부파일은 수식대로 나온 결과 입니다!
수정을 부탁드려요!
2번째 첨부파일을 보면 노랑색선과 녹색선이 있는데 이 선들을 좀더 길게 연장하고 싶습니다!
첨부 그림은 제가 수동으로 연장을 하였습니다!
최근을기준으로 8개 변곡선이 연장이 되었으면 좋겠습니다!
Input:length1(12);
Var: j1(0),lastHiVal1(0),lastLoVal1(0),sBar1(0),eBar1(0),TL11(0),TL12(0),Text11(0),처리구분1(""),T(0);
var : A1(0),V1(0),D1(0),T1(0),Bcond(false);
var : A2(0),V2(0),D2(0),T2(0),Scond(false);
Array:고점1[10,2](0),저점1[10,2](0); //가격,위치
##############
Input:chRate(0.5); //전환율 또는 변동률
Var:j(0),upTr(100),dnTr(-100),upRate(0),dnRate(0),trnd(0),TL(0),
date11(0),date12(0),time11(0),time12(0),TL1(0),
date21(0),date22(0),time21(0),time22(0),TL2(0),
date31(0),date32(0),time31(0),time32(0),TL3(0);
Array:hiVal[10](0),loVal[10](0),hiBar[10](0),loBar[10](0);
//hiVal[1]은 전고점, hiVal[2]는 전전고점, hiVal[3]은 전전전고점
//hiVal[0]은 변곡점 이후 현재봉까지의 고점. 현재 고점은 진행중이므로 계속 바뀐다.
//loVal[0]은 반대 개념
처리구분1 = "";
If Highest(H,length1) == H and lastHiVal1 <> H and
Lowest(L,length1) == L and lastLoVal1 <> L Then
{
If 저점1[1,1] > L Then 처리구분1 = "저점처리";
If 고점1[1,1] < H Then 처리구분1 = "고점처리";
}
Else If Highest(H,length1) == H and lastHiVal1 <> H Then
처리구분1 = "고점처리";
Else If Lowest(L,length1) == L and lastLoVal1 <> L Then
처리구분1 = "저점처리";
If 처리구분1 == "고점처리" Then
{
lastHiVal1 = H;
If 고점1[1,2] < 저점1[1,2] Then
{
For j1 = 10 DownTo 2
{
고점1[j1,1] = 고점1[j1-1,1];
고점1[j1,2] = 고점1[j1-1,2];
}
}
If 고점1[1,2] < 저점1[1,2] or 고점1[1,1] < H Then
{
고점1[1,1] = H;
고점1[1,2] = Index;
sBar1 = Index - 저점1[1,2];
eBar1 = 0;
If TL_GetBeginDate(TL11) == sDate[sBar1] and
TL_GetBeginTime(TL11) == sTime[sBar1] Then
{
TL_Delete(TL11);
TL_Delete(TL12);
Text_Delete(Text11);
}
TL11 = TL_New(sDate[sBar1],sTime[sBar1],저점1[1,1],sDate[eBar1],sTime[eBar1],고점1[1,1]);
TL12 = TL_New(sDate[sBar1],sTime[sBar1],저점1[1,1],sDate[eBar1],sTime[eBar1],저점1[1,1]);
A1 = 1;
V1 = 저점1[1,1];
D1 = sDate[sBar1];
T1 = sTime[sBar1];
Text11 = Text_New(sDate[eBar1],sTime[eBar1],고점1[1,1],
NumToStr(고점1[1,1],2));
Text_SetStyle(Text11, 2, 1);
TL_SetSize(TL12,2);
TL_SetColor(TL12,green);
}
}
If 처리구분1 == "저점처리" Then
{
lastLoVal1 = L;
If 저점1[1,2] < 고점1[1,2] then
{
For j1 = 10 DownTo 2
{
저점1[j1,1] = 저점1[j1-1,1];
저점1[j1,2] = 저점1[j1-1,2];
}
}
If 저점1[1,2] < 고점1[1,2] or 저점1[1,1] > L then
{
저점1[1,1] = L;
저점1[1,2] = Index;
sBar1 = Index - 고점1[1,2];
eBar1 = 0;
If TL_GetBeginDate(TL11) == sDate[sBar1] and
TL_GetBeginTime(TL11) == sTime[sBar1] Then
{
TL_Delete(TL11);
TL_Delete(TL12);
Text_Delete(Text11);
}
TL11 = TL_New(sDate[sBar1],sTime[sBar1],고점1[1,1],
sDate[eBar1],sTime[eBar1],저점1[1,1]);
TL12 = TL_New(sDate[sBar1],sTime[sBar1],고점1[1,1],
sDate[eBar1],sTime[eBar1],고점1[1,1]);
A1 = -1;
V1 = 고점1[1,1];
D1 = sDate[sBar1];
T1 = sTime[sBar1];
Text11 = Text_New(sDate[eBar1],sTime[eBar1],저점1[1,1],
NumToStr(저점1[1,1],2));
Text_SetStyle(Text11, 2, 0);
TL_SetSize(TL12,2);
TL_SetColor(TL12,yellow);
}
}
TL_SetSize(TL11,2);
TL_SetColor(TL11,red);
###############################
upRate = 1 + (chRate/100); //상승률
dnRate = 1 - (chRate/100); //하락률
for j = 1 to 9 { //전고,전저점을 9개까지 보관
loBar[j] = loBar[j] + 1; //전저점의 위치. 현재 봉으로부터 떨어져 있는 거리
hiBar[j] = hiBar[j] + 1; //전고점의 위치
}
if hiVal[0] <= H or hiVal[0] == 0 then { //전고,전저점 이후 현재까지의 고점
hiVal[0] = H; //0을 체크한 이유는 초기에 값이 없는 구간이 생기기 때문
hiBar[0] = 0; //현재 고점의 위치가 0이란 것은 현재봉의 고가가 구간 고점이라는 의미
}
else {
hiBar[0] = hiBar[0] + 1; //현재 고점의 위치
}
if loVal[0] >= L or loVal[0] == 0 then { //전고,전저점 이후 현재까지 저점
loVal[0] = L;
loBar[0] = 0;
}
else {
loBar[0] = loBar[0] + 1; //현재 구간 저점의 위치
}
if trnd != dnTr && hiVal[0] > H && hiVal[0] * dnRate > L then trnd = dnTr;
//저가가 고가 대비 변동률보다 밑으로 떨어지면 하락추세로 설정
//단, 현재봉의 고가가 변곡점 이후 최고가이면 상승 추세가 진행중이라고 본다.
//그래서 현재봉의 고가가 hiVal[0]보다 작다는 조건이 추가되었다.
else if trnd != upTr && loVal[0] < L && loVal[0] * upRate < H then trnd = upTr;
//고가가 저가 대비 변동률보다 높으면 상승추세로 설정
if trnd[1] == upTr and trnd == dnTr then { //상승추세였다가 하락추세로 바뀌었다면
for j = 8 downto 1 { //새로운 전고점이 생기는 것이므로
hiVal[j+1] = hiVal[j]; //전고점을 하나씩 뒤로 보낸다.
hiBar[j+1] = hiBar[j]; //전고점은 전전고점이 되고, 전전고점은 전전전고점이 된다.
}
hiVal[1] = hiVal[0]; //새로운 전고점에 현재 고점을 대입
hiBar[1] = hiBar[0];
hiVal[0] = H; //전고점이 확정되었으므로 전고점 이후 최고가는 현재봉의 고가
hiBar[0] = 0;
loVal[0] = L;
loBar[0] = 0;
//전고점이 새로 생긴 것이니까 전저점에서 전고점까지 추세선을 긋는다.
date11 = date[loBar[1]]; //추세선 시작일. 전저점의 날짜
time11 = stime[loBar[1]]; //추세선 시작시간
Value11 = loVal[1]; //추세선 시작가격
date12 = date[hiBar[1]]; //추세선 종료일. 전고점의 날짜
time12 = stime[hiBar[1]]; //추세선 종료시간
Value12 = hiVal[1]; //추세선 종료가격
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
//TL_New는 신규 추세선을 그려주는 함수
A2 = -1;
V2 = Value12;
D2 = date12;
T2 = time12;
}
if trnd[1] == dnTr and trnd == dnTr and //추세는 하락 상태에서 바뀌지 않았는데
hiVal[1] < hiVal[0] and //전고점보다 더 높은 고점이 출현했다면
hiVal[0] * dnRate > L then {
hiVal[1] = hiVal[0]; //전고점을 현재의 고점으로 바꿔준다.
hiBar[1] = hiBar[0];
hiVal[0] = H;
hiBar[0] = 0;
loVal[0] = L;
loBar[0] = 0;
//전고점이 추가된 게 아니고 바뀐 것이므로 종료일,종료시간,종료가격만 바꿔준다.
date12 = date[hiBar[1]]; //추세선 종료일
time12 = stime[hiBar[1]];
Value12 = hiVal[1];
TL_SetEnd(TL1, date12,time12,Value12);
//TL_SetEnd는 기존추세선의 종료지점을 변경해주는 추세선 함수이다.
//TL_Delete 함수를 써서 직전의 추세선을 지우고 다시 TL_New로 추세선을 추가해도 된다.
}
if trnd[1] == dnTr and trnd == upTr then { //추세가 하락에서 상승으로 바뀌었을 경우
for j = 8 downto 1 {
//이전저점은 전전저점으로, 전전저점은 전전전저점으로 번호를 부여
loVal[j+1] = loVal[j];
loBar[j+1] = loBar[j];
}
loVal[1] = loVal[0];
loBar[1] = loBar[0];
loVal[0] = L;
loBar[0] = 0;
hiVal[0] = H;
hiBar[0] = 0;
date11 = date[hiBar[1]]; //전저점이 새로이 생긴 것이므로 시작점은 전고점이 된다.
time11 = stime[hiBar[1]];
Value11 = hiVal[1];
date12 = date[loBar[1]];
time12 = stime[loBar[1]];
Value12 = loVal[1];
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
A2 = 1;
V2 = Value12;
D2 = date12;
T2 = time12;
}
if trnd[1] == upTr and trnd == upTr and //추세는 상승을 유지하고 있는데
loVal[1] > loVal[0] and //전저점보다 낮은 저가가 출현했다면
loVal[0] * upRate < H then {
loVal[1] = loVal[0]; //직전의 전저점만 바꿔준다.
loBar[1] = loBar[0];
loVal[0] = L;
loBar[0] = 0;
hiVal[0] = H;
hiBar[0] = 0;
date12 = date[loBar[1]];
time12 = stime[loBar[1]];
Value12 = loVal[1];
TL_SetEnd(TL1, date12,time12,Value12);
}
if trnd == upTr and loVal[2] > loVal[1] then
TL_SetColor(TL1,BLUE);
else if trnd == dnTr and hiVal[2] < hiVal[1] then
TL_SetColor(TL1,RED);
else
TL_SetColor(TL1,BLACK);
TL_SetSize(TL1,2);
TL_SetColor(TL2,RED);
TL_SetColor(TL3,BLUE);
if var1 <= 0 and Trnd == uptr and Trnd != Trnd[1] Then{
var1 = 1;
value1 = loval[1];
TL1 = Text_New(sdate[lobar[1]],stime[lobar[1]],value1-PriceScale*2,"●");
TL_SetColor(TL,RED);
TL_SetSize(TL,2);
Text_SetStyle(TL1,2,2);
Text_SetColor(TL1,RED);#텍스트 색상
TL= Text_New(sdate[lobar[1]],stime[lobar[1]],L,"상승");
Text_SetColor(TL,RED);#텍스트 색상
}
if var1 >= 0 and Trnd == dntr and Trnd != Trnd[1] then{
var1 = -1;
value1 = hival[1];
TL2 = Text_New(sdate[hibar[1]],stime[hibar[1]],value1+PriceScale*2,"●");
TL_SetColor(TL,BLUE);
TL_SetSize(TL,2);
Text_SetStyle(TL2,2,2);#텍스트 좌우 상하 정렬
Text_SetColor(TL2,BLUE);#텍스트 색상
TL= Text_New(sdate[hibar[1]],stime[hibar[1]],H,"하락");
Text_SetColor(TL,BLUE);#텍스트 색상
}
Bcond = A1 == 1 and A2 == 1;
Scond = A1 == -1 and A2 == -1;
if Bcond == true and Bcond[1] == false and
V1 == V2 and
D1 == D2 and
T1 == T2 Then
buy();
if Scond == true and Scond[1] == false and
V1 == V2 and
D1 == D2 and
T1 == T2 Then
sell();
------------------------------------------------------------------------------------
3. 아래는 키움의 신호 입니다! 예스용으로 변환 부탁드립니다!
상한가
h == c AND
((if(c<5000,c+5,if(c<10000,c+10,if(c<50000,c+50,if(c<100000,c+100,if(c<500000,c+500,c+1000)))))) / c(1) > 1.15)
하한가
l == c AND
((if(c(1)<5000,c-5,if(c(1)<10000,c-10,if(c(1)<50000,c-50,if(c(1)<100000,c-100,if(c(1)<500000,c-500,c-1000 )))))) / c(1) < 0.85)
다음글
이전글