# NEOTICKER DATA BEGIN ScriptType=Indicator Description=Relative Strength Multiple Source Name=rs_multi_source Language=DelphiScript Links=1 MinBars=0 TimerInterval=100 MetaStyle=Normal ValueRange=Same as Source Placement=New Pane Multiplot_num_plots=10 Multiplot_color_0=255 Multiplot_style_0=Line Multiplot_width_0=1 Multiplot_enabled_0=1 Multiplot_name_0=RS1 Multiplot_breakstyle_0=0 Multiplot_color_1=33654015 Multiplot_style_1=Line Multiplot_width_1=1 Multiplot_enabled_1=1 Multiplot_name_1=RS2 Multiplot_breakstyle_1=0 Multiplot_color_2=33619967 Multiplot_style_2=Line Multiplot_width_2=1 Multiplot_enabled_2=1 Multiplot_name_2=RS3 Multiplot_breakstyle_2=0 Multiplot_color_3=130996 Multiplot_style_3=Line Multiplot_width_3=1 Multiplot_enabled_3=1 Multiplot_name_3=RS4 Multiplot_breakstyle_3=0 Multiplot_color_4=33619712 Multiplot_style_4=Line Multiplot_width_4=1 Multiplot_enabled_4=1 Multiplot_name_4=RS5 Multiplot_breakstyle_4=0 Multiplot_color_5=43450113 Multiplot_style_5=Line Multiplot_width_5=1 Multiplot_enabled_5=1 Multiplot_name_5=RS6 Multiplot_breakstyle_5=0 Multiplot_color_6=33554560 Multiplot_style_6=Line Multiplot_width_6=1 Multiplot_enabled_6=1 Multiplot_name_6=RS7 Multiplot_breakstyle_6=0 Multiplot_color_7=50331392 Multiplot_style_7=Line Multiplot_width_7=1 Multiplot_enabled_7=1 Multiplot_name_7=RS8 Multiplot_breakstyle_7=0 Multiplot_color_8=33587290 Multiplot_style_8=Line Multiplot_width_8=1 Multiplot_enabled_8=1 Multiplot_name_8=RS9 Multiplot_breakstyle_8=0 Multiplot_color_9=50266112 Multiplot_style_9=Line Multiplot_width_9=1 Multiplot_enabled_9=1 Multiplot_name_9=RS10 Multiplot_breakstyle_9=0 UpdateByTick=0 TradingSystemUI=0 PrimaryLinkOnly=0 NotifyOnRemoval=0 Param_count=5 Param_name_0=First Series Param_inuse_0=1 Param_type_0=integer.gt.0 Param_default_0=1 Param_name_1=Type Param_inuse_1=1 Param_type_1=string Param_default_1=Percent|Absolute Param_name_2=Ref DateTime Param_inuse_2=1 Param_type_2=datetime Param_default_2=2001/1/1 12:0:0 Param_name_3=Ref Price Param_inuse_3=1 Param_type_3=string Param_default_3=Open|Close Param_name_4=Labels Param_inuse_4=1 Param_type_4=string Param_default_4=ON|OFF Explanation_Lines=0 # NEOTICKER DATA END function rs_multi_source : double; const CALCTYPE = 0; REFTYPE = 1; REFDATE = 2; LABELON = 3; DATADATE = 4; DATAMARKED = 14; DRAWINGOBJ = 0; var s, rtype : string; dt : TDatetime; i, j, k, m, p, d, o : integer; ok : boolean; v : double; begin if heap.size = 0 then begin heap.allocate (24); heap.fill (0, 23, 0); pheap.allocate (10); pheap.fill (0, 9, -1); rtype := param2.str; // type percent or absolute s := TRIM (rtype); s := UPPERCASE (s); s := copy (s, 1, 1); if s = 'P' then heap.value [CALCTYPE] := 1 else if s = 'A' then heap.value [CALCTYPE] := -1 else heap.value [CALCTYPE] := 0; rtype := param4.str; // open or close price s := TRIM (rtype); s := uppercase (s); s := copy (s, 1, 1); if s = 'O' then heap.value [REFTYPE] := 1 else heap.value [REFTYPE] := 0; heap.value [REFDATE] := param3.datetime; rtype := param5.str; // label on or off s := TRIM (rtype); s := uppercase (s); if s = 'ON' then heap.value [LABELON] := 1 else heap.value [LABELON] := 0; DrawingObjects.DeleteAll; end; if heap.value [CALCTYPE] = 0 then begin for i := 1 to 10 do itself.successex [i] := false; exit; end; j := param1.int; // the first data series to work with if j < 1 then begin for i := 1 to 10 do itself.successex [i] := false; exit; end; for i := j to j + 9 do begin k := i - j + DATADATE; m := i - j + DATAMARKED; o := i - j + DRAWINGOBJ; p := i - j + 1; // data correctness if (i > dataseries.count) or (not dataseries.items [i].valid [0]) then begin itself.successex [p] := false; end else begin // data computation ok := true; if heap.value [CALCTYPE] > 0 then // percent begin if heap.value [m] > 0 then // already marked begin v := dataseries.items [i].close [0] / heap.value [k] * 100; end else // not marked yet begin if (dataseries.items [i].value [0] <> 0) and (dataseries.items [i].datetime [0] > heap.value [REFDATE]) then begin heap.value [m] := 1; if heap.value [REFTYPE] = 0 then heap.value [k] := dataseries.items [i].close [0] else heap.value [k] := dataseries.items [i].open [0]; v := 100; end else ok := false; end; end else // absolute value begin if heap.value [m] > 0 then // already marked begin v := dataseries.items [i].value [0] - heap.value [k]; end else // not marked yet begin if dataseries.items [i].datetime [0] > heap.value [REFDATE] then begin heap.value [m] := 1; if heap.value [REFTYPE] = 0 then heap.value [k] := dataseries.items [i].close [0] else heap.value [k] := dataseries.items [i].open [0]; v := 0; end else ok := false; end; end; if not ok then itself.successex [p] := false else begin itself.plot [p] := v; if dataseries.items [i].islastbar and (heap.value [LABELON] <> 0) then begin d := trunc (pheap.value [o]); if d < 0 then // create object begin d := drawingobjects.add (cotText); pheap.value [o] := d; with drawingobjects do begin AutoRemoveOnUpdateByTick [d] := false; font [d] := 'Arial'; fontsize [d] := 10; fontcolor [d] := clBlack; posstyle [d] := tpsRightTop; border [d] := true; penwidth [d] := 1; color [d] := clNavy; fill [d] := false; xstyle [d] := cocPercent; setpoint (d, 0, 0.95, v * 0.9); setpoint (d, 1, 1, v); text [d] := dataseries.items [i].symbol; visible [d] := true; end; end else begin with drawingobjects do begin setpoint (d, 0, 0.95, v * 0.9); setpoint (d, 1, 1, v); end; end; end; end; end; end; RTYPE := ''; end;