For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Moving Average on Particular time point(eg. 10 am)everyday on Intraday Data(1min)

  • I am currently developing an intraday trading strategy on 1min granularity data. The average volume at the same time over everything is a very important factor.
    Is there any way I could calculate the SMA on a particular time point every day (say a 5 days average volume at 10 am for stock A) while creating my custom indicator?
    Or I should calculate such data separately and feed into Cerebro as another data feed?

  • administrators

    Indicators are not meant to be time dependent and are not meant to be calculated at specific moments. They are (re)calculated with each iteration.

    You can always check if it's 10:00 and then act upon. Data feeds have a datetime component. Get the time

    dt =  # returns a complete datetime instance
    tm = dt.time()  # just the time of day

  • Thank you for pointing that out.
    So if I want to compare the current volume to the average volume at the same time historically. I need to store the rolling avg for 480points (8hours*60mins), then filter by dt.time() to get the right point and do the comparison?

Log in to reply