커뮤니티

수식부탁드립니다

프로필 이미지
코기코기
2016-07-14 11:56:47
170
글번호 100058
답변완료
수고 많으십니다 1. 아래식 기간 변수 넣을수 있게 변경가능할까요? inputs : ShowAll(true); var : BoxTop(0), BoxBtm(0), Ctr(0), BBD(0), BBT(0), EBD(0), EBT(0), UpBand(0), DnBand(0), CurrState(1), TextId(-1), TopId(-1), TopIdP(-1), BtmId(-1), BtmIdP(-1), LSId(-1), LSIdP(-1), RSId(-1), RSIdP(-1), HiFirst(true), LoFirst(false), State1(false), State2(false), State3(false), State4(false), State5(false), DrawBox(false), ValidBox(false), HadBreak(false), NewBox(false); if index == 1 then begin BoxTop = high; BoxBtm = low; State1 = true; BBD = date; BBT = time; end; if NewBox and high > UpBand then begin BBD = date; BBT = time; TL_SetEnd(TopId, BBD, BBT, UpBand); TL_SetEnd(BtmId, BBD, BBt, DnBand); RSIdP = RSId ; RSId = TL_New(BBD, BBT, DnBand, BBD, BBT, UpBand); if ShowAll == false and RSIdP <> -1 then TL_Delete( RSIdP ) ; if HiFirst then TL_SetColor(RSId, yellow); else TL_SetColor(RSId, magenta); NewBox = false; State1 = true; LoFirst = false; HiFirst = true; end; if NewBox and low < DnBand then begin BBD = date; BBT = time; TL_SetEnd(TopId, BBD, BBT, UpBand); TL_SetEnd(BtmId, BBD, BBt, DnBand); RSIdP = RSId; RSId = TL_New(BBD, BBT, DnBand, BBD, BBT, UpBand); if ShowAll == false and RSIdP <> -1 then TL_Delete(RSIdP); if HiFirst then TL_SetColor(RSId, yellow) ; else TL_SetColor(RSId, magenta); NewBox = false; State1 = true; HiFirst = false; LoFirst = true; end; if HiFirst then begin if State4 then begin if high > BoxTop then begin BoxTop = high; State1 = true; State4 = false; CurrState = 1; end else begin if low < BoxBtm then begin State4 = false; State3 = true; BoxBtm = low; CurrState = 3; end else begin State4 = false; State5 = true; CurrState = 5; end; end; end; if State3 then begin if high > BoxTop then begin BoxTop = high; State1 = true; State3 = false; CurrState = 1; end else begin if low < BoxBtm then begin State3 = true; BoxBtm = low; CurrState = 3; end else begin State3 = false; State4 = true; CurrState = 4; end; end; end; if State2 then begin if high > BoxTop then begin BoxTop = high; State1 = true; State2 = false; CurrState = 1; end else begin State2 = false; State3 = true; BoxBtm = low; CurrState = 3; end; end; if State1 then begin if high > BoxTop then begin BoxTop = high; State1 = true; CurrState = 1; end else begin State1 = false; State2 = true; CurrState = 2; end; end; end else begin #{ Using LoFirst } if State4 then begin if low < BoxBtm then begin BoxBtm = low; State1 = true; State4 = false; CurrState = 1; end else begin if high > BoxTop then begin State3 = true; State4 = false; BoxTop = high; CurrState = 3; end else begin State4 = false; State5 = true; CurrState = 5; end; end; end; if State3 then begin if low < BoxBtm then begin BoxBtm = low; State1 = true; State3 = false; CurrState = 1; end else begin if high > BoxTop then begin State3 = true; BoxTop = high; CurrState = 3; end else begin State3 = false; State4 = true; CurrState = 4; end; end; end; if State2 then begin if low < BoxBtm then begin Boxbtm = low; State1 = true; State2 = false; CurrState = 1; end else begin State2 = false; State3 = true; BoxTop = high; CurrState = 3; end; end; if State1 then begin if low < BoxBtm then begin BoxBtm = low; State1 = true; CurrState = 1; end else begin State1 = false; State2 = true; CurrState = 2; end; end; end; #{ END IF HIFIRST OR LOFIRST } if State5 then begin DrawBox = true; EBD = date; EBT = time; end; if DrawBox then begin TopIdP = TopId; BtmIdP = BtmId; LSIdP = LSId; TopId = TL_New(BBD, BBT, BoxTop, EBD, EBT, BoxTop); BtmId = TL_New(BBD, BBT, BoxBtm, EBD, EBT, BoxBtm); LSId = TL_New(BBD, BBT, BoxBtm, BBD, BBT, BoxTop); if ShowAll == false then begin if TopIdP <> -1 then TL_Delete(TopIdP); if BtmIdP <> -1 then TL_Delete(BtmIdP); if LSIdP <> -1 then TL_Delete(LSidP); end; if HiFirst then begin TL_SetColor(TopId, yellow); TL_SetColor(BtmId, yellow); TL_SetColor(LSId, yellow); end else begin TL_SetColor(TopId, magenta); TL_SetColor(BtmId, magenta); TL_SetColor(LSId, magenta); end; State1 = false; State2 = false; State3 = false; State4 = false; State5 = false; DrawBox = false; ValidBox = true; end; if ValidBox then begin UpBand = BoxTop; DnBand = BoxBtm; ValidBox = false; NewBox = true; BoxTop = high; BoxBtm = low; end; if HiFirst then TextId = Text_New(date, time, high * 1.0005, NumToStr(CurrState, 0)); else TextId = Text_New(date, time, low * 0.9995, NumToStr(CurrState, 0)); 2 아래식 검색식으로 상단돌파시 및 하단터치시 검색되게 부탁드립니다 input : P1(10),P2(20); var : LT1(0),HT1(0),NewH1(0),idx1(0),box1(false),TOP1(0),BTM1(0); var : LT2(0),HT2(0),NewH2(0),idx2(0),box2(false),TOP2(0),BTM2(0); LT1 = LOWEST(L,P1); HT1 = HIGHEST(H,P1); if H > HT1[1] Then{ NewH1 = H; idx1 = 0; } idx1 = idx1+1; box1 = HIGHEST(H,P1-2) < HIGHEST(H,P1-1); if /*idx1 == P1-2 and*/ box1 Then{ TOP1 = NewH1; BTM1 = LT1; } LT2 = LOWEST(L,P2); HT2 = HIGHEST(H,P2); if H > HT2[1] Then{ NewH2 = H; idx2 = 0; } idx2 = idx2+1; box2 = HIGHEST(H,P2-2) < HIGHEST(H,P2-1); if /*idx2 == P2-2 and*/ box2 Then{ TOP2 = NewH2; BTM2 = LT2; } plot1(TOP1); plot2(BTM1); plot3(TOP2); plot4(BTM2);
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2016-07-14 16:16:18

안녕하세요 예스스탁입니다. 1. 기간변수 추가라고만 하시면 어떤 내용인지 알수가 없습니다. 지정일 이후부터 계산되기를 원하신다면 아래와 같습니다. inputs : ShowAll(true),날짜(20160501); var : BoxTop(0), BoxBtm(0), Ctr(0), BBD(0), BBT(0), EBD(0), EBT(0), UpBand(0), DnBand(0), CurrState(1), TextId(-1), TopId(-1), TopIdP(-1), BtmId(-1), BtmIdP(-1), LSId(-1), LSIdP(-1), RSId(-1), RSIdP(-1), HiFirst(true), LoFirst(false), State1(false), State2(false), State3(false), State4(false), State5(false), DrawBox(false), ValidBox(false), HadBreak(false), NewBox(false); var : idx(0); if sdate >= 날짜 Then idx = idx+1; if idx == 1 then begin BoxTop = high; BoxBtm = low; State1 = true; BBD = date; BBT = time; end; if idx > 1 then{ if NewBox and high > UpBand then begin BBD = date; BBT = time; TL_SetEnd(TopId, BBD, BBT, UpBand); TL_SetEnd(BtmId, BBD, BBt, DnBand); RSIdP = RSId ; RSId = TL_New(BBD, BBT, DnBand, BBD, BBT, UpBand); if ShowAll == false and RSIdP <> -1 then TL_Delete( RSIdP ) ; if HiFirst then TL_SetColor(RSId, yellow); else TL_SetColor(RSId, magenta); NewBox = false; State1 = true; LoFirst = false; HiFirst = true; end; if NewBox and low < DnBand then begin BBD = date; BBT = time; TL_SetEnd(TopId, BBD, BBT, UpBand); TL_SetEnd(BtmId, BBD, BBt, DnBand); RSIdP = RSId; RSId = TL_New(BBD, BBT, DnBand, BBD, BBT, UpBand); if ShowAll == false and RSIdP <> -1 then TL_Delete(RSIdP); if HiFirst then TL_SetColor(RSId, yellow) ; else TL_SetColor(RSId, magenta); NewBox = false; State1 = true; HiFirst = false; LoFirst = true; end; if HiFirst then begin if State4 then begin if high > BoxTop then begin BoxTop = high; State1 = true; State4 = false; CurrState = 1; end else begin if low < BoxBtm then begin State4 = false; State3 = true; BoxBtm = low; CurrState = 3; end else begin State4 = false; State5 = true; CurrState = 5; end; end; end; if State3 then begin if high > BoxTop then begin BoxTop = high; State1 = true; State3 = false; CurrState = 1; end else begin if low < BoxBtm then begin State3 = true; BoxBtm = low; CurrState = 3; end else begin State3 = false; State4 = true; CurrState = 4; end; end; end; if State2 then begin if high > BoxTop then begin BoxTop = high; State1 = true; State2 = false; CurrState = 1; end else begin State2 = false; State3 = true; BoxBtm = low; CurrState = 3; end; end; if State1 then begin if high > BoxTop then begin BoxTop = high; State1 = true; CurrState = 1; end else begin State1 = false; State2 = true; CurrState = 2; end; end; end else begin #{ Using LoFirst } if State4 then begin if low < BoxBtm then begin BoxBtm = low; State1 = true; State4 = false; CurrState = 1; end else begin if high > BoxTop then begin State3 = true; State4 = false; BoxTop = high; CurrState = 3; end else begin State4 = false; State5 = true; CurrState = 5; end; end; end; if State3 then begin if low < BoxBtm then begin BoxBtm = low; State1 = true; State3 = false; CurrState = 1; end else begin if high > BoxTop then begin State3 = true; BoxTop = high; CurrState = 3; end else begin State3 = false; State4 = true; CurrState = 4; end; end; end; if State2 then begin if low < BoxBtm then begin Boxbtm = low; State1 = true; State2 = false; CurrState = 1; end else begin State2 = false; State3 = true; BoxTop = high; CurrState = 3; end; end; if State1 then begin if low < BoxBtm then begin BoxBtm = low; State1 = true; CurrState = 1; end else begin State1 = false; State2 = true; CurrState = 2; end; end; end; #{ END IF HIFIRST OR LOFIRST } if State5 then begin DrawBox = true; EBD = date; EBT = time; end; if DrawBox then begin TopIdP = TopId; BtmIdP = BtmId; LSIdP = LSId; TopId = TL_New(BBD, BBT, BoxTop, EBD, EBT, BoxTop); BtmId = TL_New(BBD, BBT, BoxBtm, EBD, EBT, BoxBtm); LSId = TL_New(BBD, BBT, BoxBtm, BBD, BBT, BoxTop); if ShowAll == false then begin if TopIdP <> -1 then TL_Delete(TopIdP); if BtmIdP <> -1 then TL_Delete(BtmIdP); if LSIdP <> -1 then TL_Delete(LSidP); end; if HiFirst then begin TL_SetColor(TopId, yellow); TL_SetColor(BtmId, yellow); TL_SetColor(LSId, yellow); end else begin TL_SetColor(TopId, magenta); TL_SetColor(BtmId, magenta); TL_SetColor(LSId, magenta); end; State1 = false; State2 = false; State3 = false; State4 = false; State5 = false; DrawBox = false; ValidBox = true; end; if ValidBox then begin UpBand = BoxTop; DnBand = BoxBtm; ValidBox = false; NewBox = true; BoxTop = high; BoxBtm = low; end; if HiFirst then TextId = Text_New(date, time, high * 1.0005, NumToStr(CurrState, 0)); else TextId = Text_New(date, time, low * 0.9995, NumToStr(CurrState, 0)); } 2 해당지표 상단이 2개 ,하단이 2개입니다. TOP1과 BTM1로 작성해 드립니다. 2-1 상단돌파 input : P1(10),P2(20); var : LT1(0),HT1(0),NewH1(0),idx1(0),box1(false),TOP1(0),BTM1(0); var : LT2(0),HT2(0),NewH2(0),idx2(0),box2(false),TOP2(0),BTM2(0); LT1 = LOWEST(L,P1); HT1 = HIGHEST(H,P1); if H > HT1[1] Then{ NewH1 = H; idx1 = 0; } idx1 = idx1+1; box1 = HIGHEST(H,P1-2) < HIGHEST(H,P1-1); if /*idx1 == P1-2 and*/ box1 Then{ TOP1 = NewH1; BTM1 = LT1; } LT2 = LOWEST(L,P2); HT2 = HIGHEST(H,P2); if H > HT2[1] Then{ NewH2 = H; idx2 = 0; } idx2 = idx2+1; box2 = HIGHEST(H,P2-2) < HIGHEST(H,P2-1); if /*idx2 == P2-2 and*/ box2 Then{ TOP2 = NewH2; BTM2 = LT2; } if crossup(C,top1) Then find(1); 2-2 하단돌파 input : P1(10),P2(20); var : LT1(0),HT1(0),NewH1(0),idx1(0),box1(false),TOP1(0),BTM1(0); var : LT2(0),HT2(0),NewH2(0),idx2(0),box2(false),TOP2(0),BTM2(0); LT1 = LOWEST(L,P1); HT1 = HIGHEST(H,P1); if H > HT1[1] Then{ NewH1 = H; idx1 = 0; } idx1 = idx1+1; box1 = HIGHEST(H,P1-2) < HIGHEST(H,P1-1); if /*idx1 == P1-2 and*/ box1 Then{ TOP1 = NewH1; BTM1 = LT1; } LT2 = LOWEST(L,P2); HT2 = HIGHEST(H,P2); if H > HT2[1] Then{ NewH2 = H; idx2 = 0; } idx2 = idx2+1; box2 = HIGHEST(H,P2-2) < HIGHEST(H,P2-1); if /*idx2 == P2-2 and*/ box2 Then{ TOP2 = NewH2; BTM2 = LT2; } if crossdown(C,BTM1) Then find(1); 즐거운 하루되세요 > 코기코기 님이 쓴 글입니다. > 제목 : 수식부탁드립니다 > 수고 많으십니다 1. 아래식 기간 변수 넣을수 있게 변경가능할까요? inputs : ShowAll(true); var : BoxTop(0), BoxBtm(0), Ctr(0), BBD(0), BBT(0), EBD(0), EBT(0), UpBand(0), DnBand(0), CurrState(1), TextId(-1), TopId(-1), TopIdP(-1), BtmId(-1), BtmIdP(-1), LSId(-1), LSIdP(-1), RSId(-1), RSIdP(-1), HiFirst(true), LoFirst(false), State1(false), State2(false), State3(false), State4(false), State5(false), DrawBox(false), ValidBox(false), HadBreak(false), NewBox(false); if index == 1 then begin BoxTop = high; BoxBtm = low; State1 = true; BBD = date; BBT = time; end; if NewBox and high > UpBand then begin BBD = date; BBT = time; TL_SetEnd(TopId, BBD, BBT, UpBand); TL_SetEnd(BtmId, BBD, BBt, DnBand); RSIdP = RSId ; RSId = TL_New(BBD, BBT, DnBand, BBD, BBT, UpBand); if ShowAll == false and RSIdP <> -1 then TL_Delete( RSIdP ) ; if HiFirst then TL_SetColor(RSId, yellow); else TL_SetColor(RSId, magenta); NewBox = false; State1 = true; LoFirst = false; HiFirst = true; end; if NewBox and low < DnBand then begin BBD = date; BBT = time; TL_SetEnd(TopId, BBD, BBT, UpBand); TL_SetEnd(BtmId, BBD, BBt, DnBand); RSIdP = RSId; RSId = TL_New(BBD, BBT, DnBand, BBD, BBT, UpBand); if ShowAll == false and RSIdP <> -1 then TL_Delete(RSIdP); if HiFirst then TL_SetColor(RSId, yellow) ; else TL_SetColor(RSId, magenta); NewBox = false; State1 = true; HiFirst = false; LoFirst = true; end; if HiFirst then begin if State4 then begin if high > BoxTop then begin BoxTop = high; State1 = true; State4 = false; CurrState = 1; end else begin if low < BoxBtm then begin State4 = false; State3 = true; BoxBtm = low; CurrState = 3; end else begin State4 = false; State5 = true; CurrState = 5; end; end; end; if State3 then begin if high > BoxTop then begin BoxTop = high; State1 = true; State3 = false; CurrState = 1; end else begin if low < BoxBtm then begin State3 = true; BoxBtm = low; CurrState = 3; end else begin State3 = false; State4 = true; CurrState = 4; end; end; end; if State2 then begin if high > BoxTop then begin BoxTop = high; State1 = true; State2 = false; CurrState = 1; end else begin State2 = false; State3 = true; BoxBtm = low; CurrState = 3; end; end; if State1 then begin if high > BoxTop then begin BoxTop = high; State1 = true; CurrState = 1; end else begin State1 = false; State2 = true; CurrState = 2; end; end; end else begin #{ Using LoFirst } if State4 then begin if low < BoxBtm then begin BoxBtm = low; State1 = true; State4 = false; CurrState = 1; end else begin if high > BoxTop then begin State3 = true; State4 = false; BoxTop = high; CurrState = 3; end else begin State4 = false; State5 = true; CurrState = 5; end; end; end; if State3 then begin if low < BoxBtm then begin BoxBtm = low; State1 = true; State3 = false; CurrState = 1; end else begin if high > BoxTop then begin State3 = true; BoxTop = high; CurrState = 3; end else begin State3 = false; State4 = true; CurrState = 4; end; end; end; if State2 then begin if low < BoxBtm then begin Boxbtm = low; State1 = true; State2 = false; CurrState = 1; end else begin State2 = false; State3 = true; BoxTop = high; CurrState = 3; end; end; if State1 then begin if low < BoxBtm then begin BoxBtm = low; State1 = true; CurrState = 1; end else begin State1 = false; State2 = true; CurrState = 2; end; end; end; #{ END IF HIFIRST OR LOFIRST } if State5 then begin DrawBox = true; EBD = date; EBT = time; end; if DrawBox then begin TopIdP = TopId; BtmIdP = BtmId; LSIdP = LSId; TopId = TL_New(BBD, BBT, BoxTop, EBD, EBT, BoxTop); BtmId = TL_New(BBD, BBT, BoxBtm, EBD, EBT, BoxBtm); LSId = TL_New(BBD, BBT, BoxBtm, BBD, BBT, BoxTop); if ShowAll == false then begin if TopIdP <> -1 then TL_Delete(TopIdP); if BtmIdP <> -1 then TL_Delete(BtmIdP); if LSIdP <> -1 then TL_Delete(LSidP); end; if HiFirst then begin TL_SetColor(TopId, yellow); TL_SetColor(BtmId, yellow); TL_SetColor(LSId, yellow); end else begin TL_SetColor(TopId, magenta); TL_SetColor(BtmId, magenta); TL_SetColor(LSId, magenta); end; State1 = false; State2 = false; State3 = false; State4 = false; State5 = false; DrawBox = false; ValidBox = true; end; if ValidBox then begin UpBand = BoxTop; DnBand = BoxBtm; ValidBox = false; NewBox = true; BoxTop = high; BoxBtm = low; end; if HiFirst then TextId = Text_New(date, time, high * 1.0005, NumToStr(CurrState, 0)); else TextId = Text_New(date, time, low * 0.9995, NumToStr(CurrState, 0)); 2 아래식 검색식으로 상단돌파시 및 하단터치시 검색되게 부탁드립니다 input : P1(10),P2(20); var : LT1(0),HT1(0),NewH1(0),idx1(0),box1(false),TOP1(0),BTM1(0); var : LT2(0),HT2(0),NewH2(0),idx2(0),box2(false),TOP2(0),BTM2(0); LT1 = LOWEST(L,P1); HT1 = HIGHEST(H,P1); if H > HT1[1] Then{ NewH1 = H; idx1 = 0; } idx1 = idx1+1; box1 = HIGHEST(H,P1-2) < HIGHEST(H,P1-1); if /*idx1 == P1-2 and*/ box1 Then{ TOP1 = NewH1; BTM1 = LT1; } LT2 = LOWEST(L,P2); HT2 = HIGHEST(H,P2); if H > HT2[1] Then{ NewH2 = H; idx2 = 0; } idx2 = idx2+1; box2 = HIGHEST(H,P2-2) < HIGHEST(H,P2-1); if /*idx2 == P2-2 and*/ box2 Then{ TOP2 = NewH2; BTM2 = LT2; } plot1(TOP1); plot2(BTM1); plot3(TOP2); plot4(BTM2);