本帖最後由 lantis 於 13-4-11 08:39 編輯
我嘗試先寫自動畫三條線
結果線是畫了, 但一直會 update, 我已用LastBaronChart 及 initlinesdrawn boolean 變數判斷.怎麼會這樣?
我希望能只畫一次, 之後可以 user 重新拉線
- vars: line1(0), line2(0), line3(0),
- text1(0), text2(0), text3(0),
- begdate(0), begtime(0), enddate(0),endtime(0),
- initlinesdrawn(false),
- move(0), initentry(0), initsell(0), initstop(0),
- labelbarback(22);
-
- move = MinMove / PriceScale;
- if initlinesdrawn = false then
- begin
- If LastBarOnChart then
- begin
-
- initentry = C;
- initsell = C + 3 * move;
- initstop = C - 3 * move;
- begdate = Date[20];
- begtime = Time[20];
- enddate = Date[0];
- endtime = Time[0];
-
- line1 = TL_New(begdate, begtime, initentry, enddate, endtime, initentry);
- TL_SetBegin(line1, begdate , begtime, initentry);
- TL_SetEnd(line1, enddate, endtime, initentry);
- TL_SetColor(line1, Blue);
- TL_SetSize(line1, 1); // line width from 0 to 6
- text1 = Text_New(Date[labelbarback], Time[labelbarback], initentry, " Entry");
- line2 = TL_New(begdate, begtime, initsell, enddate, endtime, initsell );
- TL_SetBegin(line2, begdate , begtime, initsell );
- TL_SetEnd(line2, enddate, endtime, initsell );
- TL_SetColor(line2, Green);
- TL_SetSize(line2, 1);
- text2 = Text_New(Date[labelbarback], Time[labelbarback], initsell , "Sell Limit");
- line3 = TL_New(begdate, begtime, initstop, enddate, endtime, initstop );
- TL_SetBegin(line3, begdate , begtime, initstop );
- TL_SetEnd(line3, enddate, endtime, initstop );
- TL_SetColor(line3, Red);
- TL_SetSize(line3, 1);
- text3 = Text_New(Date[labelbarback], Time[labelbarback], initstop , "Sell Stop");
- initlinesdrawn = true;
- end;
- end;
複製代碼
|