Timeframe accessibility

Is there a way (direct way) to get access to any timeframes (function or event function for timeframe) in Cloudquant Elite such as 1h or 4h timeframe?. Or do we have to use only on_minute_bar event function? Or should we customize it ourselves? if yes how?
Thanks for your reply.



  • ptunneyptunney Posts: 246

    Can you give me a little more detail as to what you are trying to do.
    Do you longer bars.. Or are you wanting some kind of callback every hour?

  • My setup is on daily time where I identify the trend (for example daily price above 50 daily moving average).
    But my entry (trigger) trade is on lower timeframe like on 4h timeframe where if 3 EMA crosses above 21 EMA .
    So how to identify 4h timeframe like you can find on the chart

  • ptunneyptunney Posts: 246
    edited February 2018

    So the setup (above 50 day MA) is easy, I would pop that into your is_symbol_qualified so that your universe contains only of those symbols that meet your PRIMARY condition (plus any for which you already have a position , if it is a multiday hold!!).

    Your SECONDARY decision, from what I understand, is at a higher time resolution but not so high that you need tick by tick.

    You could run it in CQLITE mode if you are an ELITE user by checking ENABLE FAST SIMULATION when you submit the backtest as you can check that secondary decision in the on_minute_bar.

    If you are literally re-calculating hourly, you could set a timer for 10am, do your work then set another timer for 1 hour later

    You could clear unused event triggers which will also speed it up a little (this does not clear timers). So clear then choose which events to reactivate. Do this in ON_START (I do it at the beginning of ON_START!)

    #1        service.add_event_trigger([md.symbol], [Event.TRADE, Event.FILL, Event.CANCEL, Event.REJECT, Event.NBBO_PRICE])
    #2        service.add_event_trigger([md.symbol], [Event.TRADE, Event.NBBO_PRICE])
    #3        service.add_event_trigger([md.symbol], [Event.NBBO_PRICE])
    #4        service.add_event_trigger([md.symbol], [Event.TRADE])
    #5        service.add_event_trigger([md.symbol], [Event.MINUTE_BAR])

    If your question is, how do I get bars for a timescale between 1 day and 1 minute...
    I have not tried this personally, but I beleive you have two options..
    1. If it is only a few symbols and only re-calculated once an hour then you could roll your own
    2. The minute bars have a feature to do this for you called bar_size but it can get complicated...

    I hope that has answered your question. If not, post again or you can PM me by clicking on my name and clicking on MESSAGE.


Sign In or Register to comment.