Daily vs Monthly Exploration Results

Dear all,

After sometime reading the manual, guides, new forum and old forum I am not able to find a solution to an (easy at first sight) experiment I was conducting.

I was able to nail down the problem to the following code:

// actual computation
TimeFrameSet( inMonthly );
Open_mo = O;
High_mo = H;
Low_mo = L;
Close_mo = C;
ATR14_mo = ATR(14);
WMA12_MO = WMA(C,12);
// expand data
Open_mo_to_day  = TimeFrameExpand( Open_mo , inMonthly, mode=expandLast );
High_mo_to_day  = TimeFrameExpand( High_mo , inMonthly, mode=expandLast );
Low_mo_to_day   = TimeFrameExpand( Low_mo  , inMonthly, mode=expandLast );
Close_mo_to_day = TimeFrameExpand( Close_mo, inMonthly, mode=expandLast );
WMA12_mo_to_day = TimeFrameExpand( WMA12_mo, inMonthly, mode=expandLast );
ATR14_mo_to_day_exp_last  = TimeFrameExpand( ATR14_mo, inMonthly, expandLast );
ATR14_mo_to_day_exp_first = TimeFrameExpand( ATR14_mo, inMonthly, expandFirst );
ATR14_mo_to_day_exp_point = TimeFrameExpand( ATR14_mo, inMonthly, expandPoint );

// graphical debugging
Plot( ATR14_mo_to_day_exp_last, "ATR14-last", colorWhite ); 

// show range result on exploration mode
Filter = Status( "rangefromdate" );

// highlight month changes
newMonth = Month() != Ref( Month(), 1 );
Color = IIf( newMonth, colorYellow, colorDefault );

// exploration output
AddTextColumn( FullName(), "Nombre", 1.0, 1);
AddColumn( Open_mo_to_day , "Open_mo_to_day" , 3.3, 1, Color);
AddColumn( High_mo_to_day , "High_mo_to_day" , 3.3, 1, Color);
AddColumn( Low_mo_to_day  , "Low_mo_to_day"  , 3.3, 1, Color);
AddColumn( Close_mo_to_day, "Close_mo_to_day", 3.3, 1, Color);
AddColumn( WMA12_mo_to_day, "WMA12_mo_to_day_last" , 3.3, 1, Color);
AddColumn( ATR14_mo_to_day_exp_last , "ATR14_mo_to_day_last" , 3.3, 1, Color);
AddColumn( ATR14_mo_to_day_exp_first, "ATR14_mo_to_day_first", 3.3, 1, Color);
AddColumn( ATR14_mo_to_day_exp_point, "ATR14_mo_to_day_point", 3.3, 1, Color);

The question I thought was easy to solve was:

What happened if I run an exploration on the previous code on Daily or Monthly period?

My first feeling was that the result will be the same as I am computing everything in a Monthly timebasis indistinctly of the time period (daily / monthly) set on the exploration.

Lights and shadows:

Using the Explorer as a debugger:

  1. I can verify that Open, High, Low, Close values do not change when you run a daily or monthly exploration. That´s very good.
  2. If I use a WMA() indicator or a MA() indicator the results do not change either. That´s very good.
  3. Using the ATR() indicator (the one I was interested in :slight_smile: ), the results change, when running the exploration on daily/monthly basis. That´s bad!.

Using a graphical debugger:

  1. Output does not change when you select the chart interval to daily or monthly. That´s a good point.
  2. The graphical result (daily/monthly) is equivalent as when you set the explorer to "daily" period.

So here I am wondering why the exploration results for this particular code (where the computations are mede on monthly basis) does change ¿?.

I would appreciate any help, hint or advice,

Thanks a lot in advanced,


Read carefully the text in "orange boxes", especially the very first orange box on top:

Thanks for your reply Tomasz,

Indeed I read the box more than a few times.. :nerd_face: but I still missing something ¿?, as I do not pretend to use the TimeFrameSet() as a replacement of periodicity.

I just used it to compute ATR() in a monthly basis. So I expect, in principle (devil is on the details), to give the same results using a daily or monthly periodicity.

For this reasaon I tried with Open, Close, etc and with indicators e.g. MA() or WMA() they all behave as I expetected but not ATR() :face_with_head_bandage:

Hope I explained myself better :pray:t2:

Thanks in advanced,

Unfortunately your question isn't clear enough and does not provide all necessary details to give you an answer. Please follow this advice: How to ask a good question

Saying that something 'changes' means nothing. You have to be specific. Changes from what to what, provide precise numbers, not words.

Results change if INPUTS change.

ATR uses Wilders smoothing, and Wilders is recursive IIR filter, which means that it uses infinite number of bars. Therefore you need to pay attention to how many bars you are feeding to it. ATR(14) in monthly means that you would need at least 3 x 14 months of data to be included for it to stabilise. Depending on settings (QuickAFL) you may not be feeding same data. You may need to increase required bars that your formula gets, see http://www.amibroker.com/kb/2008/07/03/quickafl/

Thanks a lot for the tips. I will read carefully the new information.


This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.