Is it possible to nest Minute Bars evaluation in Day Bars evaluation only when needed...?

Hi,
My strategy can evaluate a day bar against study criteria for interesting scenarios, and need only drill down to the minute-by-minute intra-day to evaluate entry/exit conditions. Skipping over minute bars for those uninteresting days would save a lot of CPU time. For example, I may want to look at minute bars only for those days when stock price is above 50 day ma, and 10 day ma has entered an up slope in the last bar (not my strategy, just an example). Is this possible?

It would also be interesting to have the 50dma and 10dma plotted on the report charts for reference, too. (I asked that question in a separate thread).

Thank you for any guidance!!
-Tom

Comments

  • shayneshayne Posts: 70

    Tom,

    Sounds totally possible. As I think about it, are you establishing your symbol universe in is_symbol_qualified() or is your universe more dynamic (e.g. only need to test the previous close price greater then moving average before the trading day starts ... then do it in is_symbol_qualified())? Are your moving average static from the beginning of the day or dynamic and change during the day?

    -Shayne

  • tw391819tw391819 Posts: 27

    Thank you for your reply, Shane!

    I use static MA with the last day being as of "yesterday's" close to set a threshold, then compare "today's" current price to that threshold. For instance, real time it could be useful to compare current price to the average low of the prior five days, and then perhaps trigger a trade based on how it crosses that threshold.

    For historical analysis, using the same example, if today's bar low is greater than the average of the past five day's lows, then there is nothing more to evaluate; however, if today's low is less than (or equal to) the average of the past five day's lows, then I want to drill into minute-by-minute data to further evaluate if price activity triggered a trade.

  • ed854585ed854585 Posts: 22

    @tw391819 said:
    Thank you for your reply, Shane!

    I use static MA with the last day being as of "yesterday's" close to set a threshold, then compare "today's" current price to that threshold. For instance, real time it could be useful to compare current price to the average low of the prior five days, and then perhaps trigger a trade based on how it crosses that threshold.

    For historical analysis, using the same example, if today's bar low is greater than the average of the past five day's lows, then there is nothing more to evaluate; however, if today's low is less than (or equal to) the average of the past five day's lows, then I want to drill into minute-by-minute data to further evaluate if price activity triggered a trade.

    Maybe you could do the price comparison in on_minute_bar() on market open, and call service.terminate() to skip later minute bars if the price doesn't surpass the threshold you set.

Sign In or Register to comment.