Autotrading with SetScaleCompressed
Author: heech
Creation Date: 11/9/2008 10:09 PM
profile picture



My goal is to trade at 60 minute time frames throughout the day, except for the first bar... which I'd like to run at 10 AM.

I'm thinking about running with 30 minute bars, except with SetCompressed() to 60 minute bars for most of the day. I think that will give me the logic I want... but I don't know how to handle the autotrading aspect.

Any suggestions on how to make it work? The problem is that if I put in an order on the 60 minute bar, how do I make it last all 60 minutes... rather than automatically canceling after the first 30?
profile picture


There no difference betweeing backtesting and Auto-Trading. You must trade in the timeframe of the base scale. Create indicators from other scales, but restore the base scale for the trading loop. Just as in backtesting, if the order is to be live for 60 minutes, then it needs to be executed on two 30-min intervals. It's a natural fallout of the way you code it, and you shouldn't even have to think about it.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).