# NEOTICKER DATA BEGIN ScriptType=Indicator Description=Example Formula Research 00005 Name=ex_for_r00005 Language=Formula Links=1 MinBars=0 TimerInterval=100 EarlyBinding=0 MetaStyle=Normal ValueRange=Same as Source Placement=New Pane 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=0 FloatMarker=1 DepthData=0 TradingSystemUI=1 PrimaryLinkOnly=0 NotifyOnRemoval=0 Param_count=0 Explanation_Lines=6 Explanation0=This is a research on behavior of daily and weekly time frame price action. Explanation2=Percentage of inside bar on daily level. Explanation3=Percentage of inside bar on weekly level. Explanation5=Underlying data series is daily cash index ^HSI # NEOTICKER DATA END compressseries(wb, data1, ppWeekly, 1); $percentage_week := if($total_week <> 0, $insidebar_week/$total_week*100, 0); $percentage_day := if($total_day <> 0, $insidebar_day/$total_day*100, 0); ' print summary at beginning of each year reportformat("myreport", year(date(1)) <> year(date(0)), "year %4.0f", year(date(1)), " inside weeks number %3.0f", $insidebar_week, " percentage %3.2f", $percentage_week); reportformat("myreport", year(date(1)) <> year(date(0)), "year %4.0f", year(date(1)), " inside days number %3.0f", $insidebar_day, " percentage %3.2f", $percentage_day); ' reset counters at change of year $insidebar_day := if(year(date(1)) <> year(date(0)), 0, $insidebar_day); $insidebar_week := if(year(date(1)) <> year(date(0)), 0, $insidebar_week); ' count total days and weeks $total_day := if(year(date(1)) <> year(date(0)), 1, $total_day+1); $total_week := choose(year(date(1)) <> year(date(0)), 1, wb.barsnum(0) <> $currentweek, $total_week+1, $total_week); ' count inside day $insidebar_day := if(h(1) > h and l(1) < l, $insidebar_day+1, $insidebar_day); ' count inside week $insidebar_week := if((wb.h(2) > wb.h(1) and wb.l(2) < wb.l(1)) and (wb.barsnum(0) <> $currentweek), $insidebar_week+1, $insidebar_week); $currentweek := if(wb.barsnum(0) <> wb.barsnum(1), wb.barsnum(0), $currentweek); plot1 := wb.high-wb.low;