Like to have Strategy Monitor running in 15 minute interval but only execute 15 mins before the close
Author: kelvinyip
Creation Date: 4/17/2018 11:50 PM
profile picture

kelvinyip

#1
I have strategy monitor running fine for a while. I am using 15 mins data so the code executes every 15 mins. I don't really need all it to run all that often. I don't see anything obvious for me to control it to run only at say 1pm and 2pm and don't run in between.

Is it doable ?
profile picture

Eugene

#2
This is not supported for intraday scale. You can schedule EOD strategies in the SM at any time (WL UG > Strategy Monitor > Strategy Pane: Daily Strategy Scheduling).

But there are certain workarounds:

1. In your WealthScript code, establish a time condition and a check for running in the SM using GetMode2 function from C.Components. Skip the processing of your trade logic before 3:45pm (simple and reliable)

Something like this (untested on-the-fly code):
CODE:
Please log in to see this code.


2. Use an AutoIT or other macro to close and reopen the SM window near given time (w/o code tweaking but less reliable)
profile picture

Cone

#3
No need to process every bar to skip processing in the SM.. It's more efficient just to test the time of the last bar at the beginning:

CODE:
Please log in to see this code.


profile picture

kelvinyip

#4
thx guys. I should have thought of that before....
profile picture

kelvinyip

#5
It is still using up CPU cycle. What about the macro Eugene mentioned ? Can you point me to some samples please ?
profile picture

Eugene

#6
Checking for current time in WealthScript should take some precious 1% load of your CPU a second or two once every 15 minutes. If it takes more you might want to upgrade. At any rate, its usage of CPU cycles is negligible.

AutoIt is an example of an unsupported 3rd party macro language that you would have to learn yourself to come up with a DIY solution on your own - without any warranty that it would work as expected and reliably.
profile picture

Cone

#7
What's happening (primarily, I think) is that data is being save to disk with each update for intervals 10 minutes or higher. In terms of cpu load, writes to disk are "expensive".

For less than 10 minutes intervals, data updates are not cached to disk - the file size makes those writes "unaffordable" when updating many symbols. Theoretically, you could switch to 5 minute bars, re-write the script to scale for 15-minute indicators, and ensure that the trade actions occur on the 15-minute intervals. Depending on the script, it may or may not be worth the extra complexity.

Anyway, what's the concern with the cpu load? Is it preventing you from doing other work?
profile picture

kelvinyip

#8
yeah some other stuff seems to be sort of slow. I already have i7 box with 64G ram. Have TV on, trading apps, AWS amazon stuff, some java eclipse and Wealth-Lab running. Other stuff is ok but TV seems to be losing the sound once Wealth-Lab kicks in.
profile picture

Eugene

#9
Wow, Wealth-Lab makes the source of fake news shut up. <grin>
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).