Displaying Lower TF EMA on Higher TF Chart


Is there a way to display EMA(C,1) on 5 minute Chart?
Similarly can we display OBV() 5 Ticks on 50 Ticks Chart?

Sorry if the question was asked earlier, I tried to search in forum couldn’t Find it.


Via TimeFrame functions you may look from higher granularity to lower granularity but not vice versa.
See last paragraph before "Example"
Or look here for further info and functions

Additional note (mentioned in manual too): longer interval has to be integer multiple of shorter interval.
So if you want to look at longer intervals i.e. from 5-min interval then you can look at i.e. 10-min (2x5min), 15-min (3x5min), etc. But you can not look at i.e 7-min interval (7/5 = 1.4) or 12-min interval (12/5 = 2.4) etc. from that shorter 5-min interval. Same applies to other interval examples.




Thanks for reply. I thought somebody might have given it a try.
I am using OBV as my leading indicator, OBV adds/deducts volume based on candle close, suppose O =100, H = 110. L = 109, C = 101, as close is higher than open, OBV will take it as buy volume and add the volume to previous data. Incase of large volume bar, we will get distorted OBV reading. Is it possible we can construct OBV, breaking up volume in 3 parts 1) candle body volume depending on upclose or downclose, volume can be added/deducted, 2) Volume at High - (open or close) depending on candle body, taking it as selling volume and deducting it from OBV 3) Volume at Low + (Open or close) depending on candle body, considering it as buying volume and adding it to OBV.

With respect to post# 3

Maybe there’s a bit of conceptual dissonance

There’s no ‘distortion’ in OBV, the volume is the actual recorded quantity of the underlying being traded in that timeframe

Just to paraphrase

Joseph Granville developed the OBV metric in the 1960s. He believed that, when volume increases sharply without a significant change in the stock’s price, the price will eventually jump upward, and vice versa

Ref: http://www.investopedia.com/terms/o/onbalancevolume.asp

If you still, however, wish to ‘refine’ it, then be aware that there’s nothing to add since all the volume is already being considered

You can only choose to subtract. For e.g in the condition

Cond1 = C >= Ref(C, -1) AND (H - C) > (C - L);
My_Obv =IIf(Cond1, OBV() - (((H - C) / (H - L)) * V), OBV());

You can also choose to ‘subtract’ positive volume from negative OBV. For e.g in the condition

Cond2 = C <= Ref(C, -1) AND (H - C) < (C - L);
My_Obv = IIf(Cond2, OBV() + (((C - L) / (H - L)) * V), OBV());

Combining both the conditions,

My_Obv = IIf(Cond1, OBV() - (((H - C) / (H - L)) * V), IIf(Cond2, OBV() + (((C - L) / (H - L)) * V), OBV()));

It could be that you’re trying to ‘refine’ it as some sort of accumulation/ distribution indicator, but be aware that candlestick formations are with w.r.t a timeframe. For e.g a hammer candle in a lower timeframe may turn out differently in a higher timeframe


@fxshrat clarity please. The shorter time interval is determined by base time interval set in dBase? Also, from the manual, “Interval is time frame interval in seconds”. So to get Daily interval array from a 1 Minute shorter interval, one would set 86400 as the longer interval?

Few misconceptions:

  1. 86400 minute is NOT exactly the same as 1-day interval.
    Daily interval has a constant of inDaily and that is what you should use. For weekly you should use inWeekly and so on.
    Daily interval uses user-definable day boundary which may or may not coincide with your local time zone. See http://www.amibroker.com/kb/2006/03/19/how-does-the-daily-time-compression-work/

  2. TimeFrame functions always use CURRENTLY SELECTED interval as input. So even if your database is 1-minute base time interval, it will still use the current chart/analysis interval as input for given formula so if your current chart uses 5-minute bars then TimeFrame functions that you use inside that chart formula will use 5-minute bars as input. Re-read http://www.amibroker.com/guide/h_timeframe.html - EVERY sentence counts and EVERY word is important.

1 Like