# NEOTICKER DATA BEGIN ScriptType=Indicator Description=alanbox Name=alanbox Language=DelphiScript Links=1 MinBars=0 TimerInterval=100 MetaStyle=Normal ValueRange=Same as Source Placement=Smart Multiplot_num_plots=1 Multiplot_color_0=255 Multiplot_style_0=Line Multiplot_width_0=1 Multiplot_enabled_0=0 Multiplot_breakstyle_0=0 UpdateByTick=0 TradingSystemUI=0 PrimaryLinkOnly=0 NotifyOnRemoval=0 Param_count=22 Param_name_0=boxlow Param_inuse_0=1 Param_type_0=real Param_default_0=0 Param_name_1=boxhigh Param_inuse_1=1 Param_type_1=real Param_default_1=0 Param_name_2=highlowdetection Param_inuse_2=1 Param_type_2=string Param_default_2=day|week|month|year|ym8to8 Param_name_3=boxstarttime Param_inuse_3=1 Param_type_3=datetime Param_default_3=2005/11/29 8:30:0 Param_name_4=boxstoptime Param_inuse_4=1 Param_type_4=datetime Param_default_4=2005/11/29 16:30:0 Param_name_5=upangularcolor Param_inuse_5=1 Param_type_5=color Param_default_5=clGreen Param_name_6=downangularcolor Param_inuse_6=1 Param_type_6=color Param_default_6=clRed Param_name_7=verticalcolor Param_inuse_7=1 Param_type_7=color Param_default_7=16744576 Param_name_8=previoushighcolor Param_inuse_8=1 Param_type_8=color Param_default_8=255 Param_name_9=previouslowcolor Param_inuse_9=1 Param_type_9=color Param_default_9=65280 Param_name_10=horizontalcolor Param_inuse_10=1 Param_type_10=color Param_default_10=16744576 Param_name_11=box1up Param_inuse_11=1 Param_type_11=string Param_default_11=On|Off Param_name_12=box1down Param_inuse_12=1 Param_type_12=string Param_default_12=On|Off Param_name_13=box2up Param_inuse_13=1 Param_type_13=string Param_default_13=Off|On Param_name_14=box2down Param_inuse_14=1 Param_type_14=string Param_default_14=Off|On Param_name_15=angular_style Param_inuse_15=1 Param_type_15=string Param_default_15=solid|dash|dot Param_name_16=midpoint_style Param_inuse_16=1 Param_type_16=string Param_default_16=dash|solid|dot Param_name_17=quarter_style Param_inuse_17=1 Param_type_17=string Param_default_17=dot|dash|solid Param_name_18=txcolor Param_inuse_18=1 Param_type_18=color Param_default_18=65535 Param_name_19=txbg Param_inuse_19=1 Param_type_19=color Param_default_19=0 Param_name_20=txsize Param_inuse_20=1 Param_type_20=integer Param_default_20=8 Param_name_21=txfont Param_inuse_21=1 Param_type_21=string Param_default_21=Arial Explanation_Lines=25 Explanation0=This indicator draws the AlanBox on your chart. Explanation2=User parameters: Explanation3=boxlow: value for the bottom horizontal line of the box. set to 0 to try autodetection Explanation4=boxtop: value for the top horizontal line of the box. set to 0 to try autodetection Explanation6=highlowdetection: lookback range for autodetection of high/low. ym8to8 experimental setting for a YM chart1 type daily box. note: allthough autodetection works fine most of the time there are known issues. allways verify the results. Explanation8=boxstarttime: date/time to start your box Explanation9=boxstoptime: date/time to stop your box Explanation11=box1up, box2up etc: Switch on/off the +100%, +200%, -100% boxes. Explanation13=Troubleshooting: If the box is not drawn try setting your time frame to 7 days 24 hours or make sure your chosen chart timeframe contains the box start/top times. Also make sure you have loaded enough bars/days for auto-detection of high/low or set high and low manual. Explanation15=Thanks to Alan Kelland for sharing this method. Explanation16=For more information about the AlanBox method visit http://www.versaluna.com/daManual/ (thank you amg) # NEOTICKER DATA END // copyright (c) 2005 // part of the Selling Low of Day Project // written by udo@comtron.net // Dez 10, 2005 // // This is my first attempt in creating an indicator for neoticker/delphi // it's a wonder it works sometimes // i learned a lot. next version i'll start from scratch and do it right. // No bytes were harmed in the making of this indicator function alanbox : double; var i : integer; ind_reftime, ind_reftime2, lowvariant, highvariant : variant; ang_style, quart_style, mid_style, teststr : str; pvh, pvl, pvh2, pvl2, datum, datum2, apex1, apex2, apex3, boxrange : double; begin if not data1.islastbar then begin itself.success := false; exit; end; // check if already updated // must use pheap here as the indicator could be used in real time // tick by tick checking scenerio if pheap.size = 0 then begin pheap.allocate (1); pheap.value [0] := 0; end; // do not proceed if processed once at the first tick of the bar if tq_trunc (pheap.value [0]) = tq_trunc (itself.currentbar [0]) then begin itself.success := false; exit; end; // save the update bar data pheap.value [0] := itself.currentbar [0]; result := data1.close [0]; // erase previously drawn drawing object manually drawingobjects.deleteall; // low detection if (params.items['boxlow'].real > 0) then pvl := params.items['boxlow'].real else begin if (params.items['highlowdetection'].str = 'year') then begin itself.makeindicator('lowvariant', 'fml', ['1'], ['prevylow(data1)']); pvl := itself.indicator('lowvariant').value[0]; end; if (params.items['highlowdetection'].str = 'month') then begin itself.makeindicator('lowvariant', 'fml', ['1'], ['prevmlow(data1)']); pvl := itself.indicator('lowvariant').value[0]; end; if (params.items['highlowdetection'].str = 'week') then begin itself.makeindicator('lowvariant', 'fml', ['1'], ['prevwlow(data1)']); pvl := itself.indicator('lowvariant').value[0]; end; if (params.items['highlowdetection'].str = 'day') then begin itself.makeindicator('lowvariant', 'fml', ['1'], ['prevdlow(data1)']); pvl := itself.indicator('lowvariant').value[0]; end; if (params.items['highlowdetection'].str = 'ym8to8') then begin itself.makeindicator('ind_reftime', 'fml', ['1'], ['prevdclose(reftimeex.plot3(0,data1,"08:10:0","08:00:0","No"))']); itself.makeindicator('ind_reftime', 'fml', ['1'], ['reftimeex.plot3(0,data1,"08:10:0","08:00:0","No")']); pvl := itself.indicator('ind_reftime').value[0]; end; end; // high detection if params.items['boxhigh'].real > 0 then pvh := params.items['boxhigh'].real else begin if (params.items['highlowdetection'].str = 'year') then begin itself.makeindicator('highvariant', 'fml', ['1'], ['prevyhigh(data1)']); pvh := itself.indicator('highvariant').value[0]; end; if (params.items['highlowdetection'].str = 'month') then begin itself.makeindicator('highvariant', 'fml', ['1'], ['prevmhigh(data1)']); pvh := itself.indicator('highvariant').value[0]; end; if (params.items['highlowdetection'].str = 'week') then begin itself.makeindicator('highvariant', 'fml', ['1'], ['prevwhigh(data1)']); pvh := itself.indicator('highvariant').value[0]; end; if (params.items['highlowdetection'].str = 'day') then begin itself.makeindicator('highvariant', 'fml', ['1'], ['prevdhigh(data1)']); pvh := itself.indicator('highvariant').value[0]; end; if (params.items['highlowdetection'].str = 'ym8to8') then begin itself.makeindicator('ind_reftime2', 'fml', ['1'], ['prevdclose(reftimeex.plot2(0,data1,"08:10:0","08:00:0","No"))']); itself.makeindicator('ind_reftime2', 'fml', ['1'], ['reftimeex.plot2(0,data1,"08:10:0","08:00:0","No")']); pvh := itself.indicator('ind_reftime2').value[0]; end; end; if (params.items['angular_style'].str = 'dot') then begin ang_style := dsDot end; if params.items['angular_style'].str = 'dash' then begin ang_style := dsDash end; if params.items['angular_style'].str = 'solid' then begin ang_style := dsSolid end; if params.items['midpoint_style'].str = 'dot' then begin mid_style := dsDot end; if params.items['midpoint_style'].str = 'dash' then begin mid_style := dsDash end; if params.items['midpoint_style'].str = 'solid' then begin mid_style := dsSolid end; if params.items['quarter_style'].str = 'dot' then begin quart_style := dsDot end; if params.items['quarter_style'].str = 'dash' then begin quart_style := dsDash end; if params.items['quarter_style'].str = 'solid' then begin quart_style := dsSolid end; // main box ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (pvl > 0) and (pvh > 0) then begin boxrange := pvh - pvl; if params.items['boxstarttime'].real > 0 then datum := params.items ['boxstarttime'].datetime else begin itself.makeindicator ('datum', 'fml', ['1'], ['makedatetime(year(NTnow),month(NTnow),day(NTnow),8,30,0)']); datum := itself.indicator('datum').value [0]; end; if params.items['boxstoptime'].real > 0 then datum2 := params.items ['boxstoptime'].datetime else begin itself.makeindicator ('datum2', 'fml', ['1'], ['makedatetime(year(NTnow),month(NTnow),day(NTnow),16,30,0)']); datum2 := itself.indicator('datum2').value [0]; end; apex2 := datum + (datum2-datum)/2; // Verticals i := drawingobjects.add (cotTrendLine); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['verticalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvh); setpoint (i, 1, datum, pvl); visible [i] := true; end; i := drawingobjects.add (cotTrendLine); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['verticalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum2, pvh); setpoint (i, 1, datum2, pvl); visible [i] := true; end; // up-angulars i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['upangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvl); setpoint (i, 1, datum2, pvh); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['upangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvl+boxrange/2); setpoint (i, 1, apex2, pvh); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['upangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum2, pvh-boxrange/2); setpoint (i, 1, apex2, pvl); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['downangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvh); setpoint (i, 1, datum2, pvl); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['downangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, apex2, pvh); setpoint (i, 1, datum2, pvh - boxrange/2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['downangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvh - boxrange/2); setpoint (i, 1, apex2, pvl); visible [i] := true; end; // YL horizontal i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['previouslowcolor'].str); penwidth [i] := 3; extendright [i] := false; setpoint (i, 0, datum, pvl); setpoint (i, 1, datum2, pvl); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpslefttop; setpoint (i, 0, datum2, pvl); setpoint (i, 1, datum2, pvl); text [i] := 'Low ' + NTlib.double2str (pvl); visible [i] := true; end; // YH horizontal i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['previoushighcolor'].str); penwidth [i] := 3; extendright [i] := false; setpoint (i, 0, datum, pvh); setpoint (i, 1, datum2, pvh); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpslefttop; setpoint (i, 0, datum2, pvh); setpoint (i, 1, datum2, pvh); text [i] := 'High ' + NTlib.double2str(pvh); visible [i] := true; end; // Midpoint i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := mid_style; extendright [i] := false; setpoint (i, 0, datum, pvh-boxrange/2); setpoint (i, 1, datum2, pvh-boxrange/2); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpslefttop; setpoint (i, 0, datum2, pvh-boxrange/2); setpoint (i, 1, datum2, pvh-boxrange/2); text [i] := 'midpoint ' + NTlib.double2str (pvh-boxrange/2); visible [i] := true; end; // Quarter Horizontal i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := quart_style; extendright [i] := false; setpoint (i, 0, datum, pvh-boxrange/4); setpoint (i, 1, datum2, pvh-boxrange/4); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpslefttop; setpoint (i, 0, datum2, pvh-boxrange/4); setpoint (i, 1, datum2, pvh-boxrange/4); text [i] := '75% ' + NTlib.double2str (pvh-boxrange/4); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := quart_style; extendright [i] := false; setpoint (i, 0, datum, pvl+boxrange/4); setpoint (i, 1, datum2, pvl+boxrange/4); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpslefttop; setpoint (i, 0, datum2, pvl+boxrange/4); setpoint (i, 1, datum2, pvl+boxrange/4); text [i] := '25% ' + NTlib.double2str (pvl+boxrange/4); visible [i] := true; end; // box 1-up ///////////////////////////////////////////////////////////////////////////////////////////////////////////// if (params.items ['box1up'].str = 'On') then begin pvl2 := pvh; pvh2 := pvh + boxrange; // Verticals i := drawingobjects.add (cotTrendLine); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['verticalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvh2); setpoint (i, 1, datum, pvl2); visible [i] := true; end; i := drawingobjects.add (cotTrendLine); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['verticalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum2, pvh2); setpoint (i, 1, datum2, pvl2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['upangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvl2); setpoint (i, 1, datum2, pvh2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['upangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvl2+boxrange/2); setpoint (i, 1, apex2, pvh2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['upangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum2, pvh2-boxrange/2); setpoint (i, 1, apex2, pvl2); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpsLeftTop; setpoint (i, 0, datum2, pvh2); setpoint (i, 1, datum2 + 2, pvh2); text [i] := '+100% ' + NTlib.double2str (pvh2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['downangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvh2); setpoint (i, 1, datum2, pvl2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['downangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, apex2, pvh2); setpoint (i, 1, datum2, pvh2 - boxrange/2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['downangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvh2 - boxrange/2); setpoint (i, 1, apex2, pvl2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 3; extendright [i] := false; setpoint (i, 0, datum, pvh2); setpoint (i, 1, datum2, pvh2); visible [i] := true; end; // box 1 up midpoint i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := mid_style; extendright [i] := false; setpoint (i, 0, datum, pvh2-boxrange/2); setpoint (i, 1, datum2, pvh2-boxrange/2); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpslefttop; setpoint (i, 0, datum2, pvh2-boxrange/2); setpoint (i, 1, datum2, pvh2-boxrange/2); text [i] := '+50% ' + NTlib.double2str (pvh2-boxrange/2); visible [i] := true; end; // quarter hor box 1 up i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := quart_style; extendright [i] := false; setpoint (i, 0, datum, pvh2-boxrange/4); setpoint (i, 1, datum2, pvh2-boxrange/4); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpslefttop; setpoint (i, 0, datum2, pvh2-boxrange/4); setpoint (i, 1, datum2, pvh2-boxrange/4); text [i] := '+75% ' + NTlib.double2str (pvh2-boxrange/4); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := quart_style; extendright [i] := false; setpoint (i, 0, datum, pvl2+boxrange/4); setpoint (i, 1, datum2, pvl2+boxrange/4); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpslefttop; setpoint (i, 0, datum2, pvl2+boxrange/4); setpoint (i, 1, datum2, pvl2+boxrange/4); text [i] := '+25% ' + NTlib.double2str (pvl2+boxrange/4); visible [i] := true; end; end; // box 1 up // box 2-up ///////////////////////////////////////////////////////////////////////////////////////////////////////////// if (params.items ['box2up'].str = 'On') then begin pvl2 := pvh + boxrange; pvh2 := pvh + 2*boxrange; // Verticals i := drawingobjects.add (cotTrendLine); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['verticalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvh2); setpoint (i, 1, datum, pvl2); visible [i] := true; end; i := drawingobjects.add (cotTrendLine); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['verticalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum2, pvh2); setpoint (i, 1, datum2, pvl2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['upangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvl2); setpoint (i, 1, datum2, pvh2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['upangularcolor'].str); DrawingStyle[i] := ang_style; penwidth [i] := 1; extendright [i] := false; setpoint (i, 0, datum, pvl2+boxrange/2); setpoint (i, 1, apex2, pvh2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['upangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum2, pvh2-boxrange/2); setpoint (i, 1, apex2, pvl2); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpsLeftTop; setpoint (i, 0, datum2, pvh2); setpoint (i, 1, datum2 + 2, pvh2); text [i] := '+200% ' + NTlib.double2str (pvh2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['downangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvh2); setpoint (i, 1, datum2, pvl2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['downangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, apex2, pvh2); setpoint (i, 1, datum2, pvh2 - boxrange/2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['downangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvh2 - boxrange/2); setpoint (i, 1, apex2, pvl2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 3; extendright [i] := false; setpoint (i, 0, datum, pvh2); setpoint (i, 1, datum2, pvh2); visible [i] := true; end; // box 2 up midpoint i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := mid_style; extendright [i] := false; setpoint (i, 0, datum, pvh2-boxrange/2); setpoint (i, 1, datum2, pvh2-boxrange/2); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpslefttop; setpoint (i, 0, datum2, pvh2-boxrange/2); setpoint (i, 1, datum2, pvh2-boxrange/2); text [i] := '+150% ' + NTlib.double2str (pvh2-boxrange/2); visible [i] := true; end; // quarter hor box 2 up i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := quart_style; extendright [i] := false; setpoint (i, 0, datum, pvh2-boxrange/4); setpoint (i, 1, datum2, pvh2-boxrange/4); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpslefttop; setpoint (i, 0, datum2, pvh2-boxrange/4); setpoint (i, 1, datum2, pvh2-boxrange/4); text [i] := '+175% ' + NTlib.double2str (pvh2-boxrange/4); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := quart_style; extendright [i] := false; setpoint (i, 0, datum, pvl2+boxrange/4); setpoint (i, 1, datum2, pvl2+boxrange/4); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpslefttop; setpoint (i, 0, datum2, pvl2+boxrange/4); setpoint (i, 1, datum2, pvl2+boxrange/4); text [i] := '+125% ' + NTlib.double2str (pvl2+boxrange/4); visible [i] := true; end; end; // box 2 up // box 1-down ///////////////////////////////////////////////////////////////////////////////////////////////////////////// if (params.items ['box1down'].str = 'On') then begin pvh2 := pvl; pvl2 := pvl - boxrange; // Verticals i := drawingobjects.add (cotTrendLine); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['verticalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvh2); setpoint (i, 1, datum, pvl2); visible [i] := true; end; i := drawingobjects.add (cotTrendLine); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['verticalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum2, pvh2); setpoint (i, 1, datum2, pvl2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['upangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvl2); setpoint (i, 1, datum2, pvh2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['upangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvl2+boxrange/2); setpoint (i, 1, apex2, pvh2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['upangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum2, pvh2-boxrange/2); setpoint (i, 1, apex2, pvl2); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpsLeftTop; setpoint (i, 0, datum2, pvl2); setpoint (i, 1, datum2 + 2, pvl2); text [i] := '-100% ' + NTlib.double2str (pvh2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['downangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvh2); setpoint (i, 1, datum2, pvl2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['downangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, apex2, pvh2); setpoint (i, 1, datum2, pvh2 - boxrange/2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['downangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvh2 - boxrange/2); setpoint (i, 1, apex2, pvl2); visible [i] := true; end; // low box 1 down i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 3; extendright [i] := false; setpoint (i, 0, datum, pvl2); setpoint (i, 1, datum2, pvl2); visible [i] := true; end; // mid box 1 down i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := mid_style; extendright [i] := false; setpoint (i, 0, datum, pvh2-boxrange/2); setpoint (i, 1, datum2, pvh2-boxrange/2); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpslefttop; setpoint (i, 0, datum2, pvh2-boxrange/2); setpoint (i, 1, datum2, pvh2-boxrange/2); text [i] := '-50% ' + NTlib.double2str (pvh2-boxrange/2); visible [i] := true; end; // quarter hor box 1 down i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := quart_style; extendright [i] := false; setpoint (i, 0, datum, pvh2-boxrange/4); setpoint (i, 1, datum2, pvh2-boxrange/4); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpslefttop; setpoint (i, 0, datum2, pvh2-boxrange/4); setpoint (i, 1, datum2, pvh2-boxrange/4); text [i] := '-25% ' + NTlib.double2str (pvh2-boxrange/4); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := quart_style; extendright [i] := false; setpoint (i, 0, datum, pvl2+boxrange/4); setpoint (i, 1, datum2, pvl2+boxrange/4); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpslefttop; setpoint (i, 0, datum2, pvl2+boxrange/4); setpoint (i, 1, datum2, pvl2+boxrange/4); text [i] := '-75% ' + NTlib.double2str (pvl2+boxrange/4); visible [i] := true; end; end; // box 1 down // box 2-down ///////////////////////////////////////////////////////////////////////////////////////////////////////////// if (params.items ['box2down'].str = 'On') then begin pvh2 := pvl - boxrange; pvl2 := pvl - boxrange*2; // Verticals i := drawingobjects.add (cotTrendLine); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['verticalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvh2); setpoint (i, 1, datum, pvl2); visible [i] := true; end; i := drawingobjects.add (cotTrendLine); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['verticalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum2, pvh2); setpoint (i, 1, datum2, pvl2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['upangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvl2); setpoint (i, 1, datum2, pvh2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['upangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvl2+boxrange/2); setpoint (i, 1, apex2, pvh2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['upangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum2, pvh2-boxrange/2); setpoint (i, 1, apex2, pvl2); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpsLeftBottom; setpoint (i, 0, datum2, pvl2); setpoint (i, 1, datum2 + 2, pvl2); text [i] := '-200% ' + NTlib.double2str (pvh2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['downangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvh2); setpoint (i, 1, datum2, pvl2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['downangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, apex2, pvh2); setpoint (i, 1, datum2, pvh2 - boxrange/2); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['downangularcolor'].str); penwidth [i] := 1; DrawingStyle[i] := ang_style; extendright [i] := false; setpoint (i, 0, datum, pvh2 - boxrange/2); setpoint (i, 1, apex2, pvl2); visible [i] := true; end; // low box 2 down i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 3; extendright [i] := false; setpoint (i, 0, datum, pvl2); setpoint (i, 1, datum2, pvl2); visible [i] := true; end; // mid box 2 down i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := mid_style; extendright [i] := false; setpoint (i, 0, datum, pvh2-boxrange/2); setpoint (i, 1, datum2, pvh2-boxrange/2); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpslefttop; setpoint (i, 0, datum2, pvh2-boxrange/2); setpoint (i, 1, datum2, pvh2-boxrange/2); text [i] := '-150% ' + NTlib.double2str (pvh2-boxrange/2); visible [i] := true; end; // quarter hor box 2 down i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := quart_style; extendright [i] := false; setpoint (i, 0, datum, pvh2-boxrange/4); setpoint (i, 1, datum2, pvh2-boxrange/4); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpslefttop; setpoint (i, 0, datum2, pvh2-boxrange/4); setpoint (i, 1, datum2, pvh2-boxrange/4); text [i] := '-125% ' + NTlib.double2str (pvh2-boxrange/4); visible [i] := true; end; i := drawingobjects.add (cotTrendline); with drawingobjects do begin autoremoveonupdatebytick [i] := false; color [i] := tq_str2color (params.items ['horizontalcolor'].str); penwidth [i] := 1; DrawingStyle[i] := quart_style; extendright [i] := false; setpoint (i, 0, datum, pvl2+boxrange/4); setpoint (i, 1, datum2, pvl2+boxrange/4); visible [i] := true; end; i := drawingobjects.add (cotText); with drawingobjects do begin autoremoveonupdatebytick [i] := false; font[i] := params.items ['txfont'].str; fontsize [i] := params.items ['txsize'].int; fontcolor [i] := tq_str2color (params.items ['txcolor'].str); border [i] := 0; fillcolor[i] := tq_str2color (params.items ['txbg'].str); posstyle [i] := tpslefttop; setpoint (i, 0, datum2, pvl2+boxrange/4); setpoint (i, 1, datum2, pvl2+boxrange/4); text [i] := '-175% ' + NTlib.double2str (pvl2+boxrange/4); visible [i] := true; end; end; // box 2 down end; end;