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

heech

#1
Hi,

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

Cone

#2
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.