Automating strategy execution with AutoIT
Author: kazuna
Creation Date: 7/20/2011 2:38 PM
profile picture

kazuna

#1
I'm trying to automate the strategy to re-run in case of thread abort exception.
I wrote an AutoIt script below but it doesn't work very well as chart windows are MDI child window.
CODE:
Please log in to see this code.

I confirmed this title/text/controlID to work if the chart window has a focus but regardless of the "ID".
I tried ControlFocus but it doesn't activate the chart window.
Does anyone know how to activate the chart window in order to send a key to that chart window?
profile picture

kazuna

#2
CODE:
Please log in to see this code.
This one works a little better. The chart window gets activated and the strategy executes but only when "Editor" tab is opened. Why doesn't it activate the chart window when other tab (e.g. "Chart" tab) is opened?

Also somehow executing the strategy (hitting F5 key) while opening "Editor" tab takes much longer time than while opening other tab (e.g. "Chart" tab). Why is that?
profile picture

Cone

#3
The time is the same for me, but if it's different for you, then there's a chance you're invoking the "Run the Strategy" button in the Editor view, which compiles first and then executes.
profile picture

Jinye

#4
I need to do similar thing. I have a strategy that runs on a dataset daily to generate alerts for the next day orders. Currently, I have to press either the "Run Stragegy" button or the "Go" button manually. I would like to shedule a time, like 4:30 ET, to run my script automatically. Kazuna or Cone, would you please give a little bit details about your method ?
profile picture

Eugene

#5
Use Strategy Monitor to schedule a time like 4:30 ET.
profile picture

jalalfeghhi1

#6
Eugene,
I have written a script that runs in the strategy monitor. I want the script to run @ 6:45 am (once a day) to email me a market update, say the current price of .DJI, among other things. In order that I can specify the execution time of 6:45, I have assigned "daily" for time frame. Now the issue is that b/c the timer scale is daily, the script emails me the closing price of the .DJI of the previous day. I am not sure how to proceed. And advice?

-Best, J
profile picture

Cone

#7
The script emails you the closing price of the last bar. If the Daily update for .DJI is not available by the provider by 6:45, then you get the last bar available. Point the strategy at a different provider, like Y!, which should have ^DJI updated by that time.

Edit: Y! doesn't necessarily reliably update all market data early.. in fact, just this morning there was a problem updating "T".. I had to try several times to get the update for the previous day. Long story short, data is everything, and there are many providers out there with different arrangements.
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).