# NEOTICKER DATA BEGIN ScriptType=Indicator Description=Example Delphi Volume Profile Name=ex_del_volprof Language=DelphiScript Links=1 MinBars=0 TimerInterval=100 EarlyBinding=0 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=1 Multiplot_breakstyle_0=0 UpdateByTick=1 FloatMarker=1 DepthData=0 TradingSystemUI=0 PrimaryLinkOnly=0 NotifyOnRemoval=0 Param_count=4 Param_name_0=slot size Param_inuse_0=1 Param_type_0=real Param_default_0=0.25 Param_name_1=from price Param_inuse_1=1 Param_type_1=real Param_default_1=1050 Param_name_2=to price Param_inuse_2=1 Param_type_2=real Param_default_2=1130 Param_name_3=report window Param_inuse_3=1 Param_type_3=string Param_default_3=myreport Explanation_Lines=3 Explanation0=This indicator print out bid/ask trades in a report window. Explanation2=This indicator require a chart and a report window, result print to report window. # NEOTICKER DATA END function ex_del_volprof : double; Const TStore = 10; BTrades = 0; ATrades = 1; CurrBN = 2; var i : integer; s : string; tvol, slotsize : double; ppprice, bvol, avol : double; begin slotsize := param1.real; if itself.firstcall then begin pheap.allocatepriceprofile('TAB', slotsize, param2.real, param3.real); pheap.allocatepriceprofile('TAA', slotsize, param2.real, param3.real); pheap.allocate(TStore); end; // reset price profile at start of day if data1.date [0] <> data1.date [1] then begin pheap.clearpriceprofile('TAB', param2.real, param3.real); pheap.clearpriceprofile('TAA', param2.real, param3.real); end; if data1.haslasttrade then // a new tick arrive begin // first tick of new bar print result if data1.barsnum [0] <> pheap.value [CurrBN] then begin report.clear(param4.str); report.addline (param4.str, 'Price BidTrades AskTrades Total'); for i := 0 to pheap.priceprofileslotcount('TAB')-1 do begin pheap.priceprofileslotinfo('TAB', i, ppprice, bvol); pheap.priceprofileslotinfo('TAA', i, ppprice, avol); if (avol > 0) or (bvol > 0) then begin tvol := bvol+avol; s := format( '%6.2f %8.0f %8.0f %8.0f', [ppprice, bvol, avol, tvol]); report.addline (param4.str, s); end; end; end; if data1.daytotalbidtrades > pheap.value [BTrades] then pheap.priceprofileaddprice ( 'TAB', data1.lasttradeprice, data1.lasttradesize); if data1.daytotalasktrades > pheap.value [ATrades] then pheap.priceprofileaddprice ( 'TAA', data1.lasttradeprice, data1.lasttradesize); end; pheap.value [BTrades] := data1.daytotalbidtrades; pheap.value [ATrades] := data1.daytotalasktrades; pheap.value [CurrBN] := data1.barsnum [0]; result := Data1.Value [0]; end;