Creating a condition based on time
Author: arthurdent84
Creation Date: 4/9/2009 5:29 PM
profile picture

arthurdent84

#1
hey guys,

the condition list in WL5 for Date/Time only includes conditions for dates.

I'm trying to create a script that buys the high-of-day or shorts the low-of-day only AFTER A certain time of the day (say 10 or 11am), with a trailing stop loss, and always closes out the trade at close of market.

any ideas/help would be apprecaited!
thanks
profile picture

Eugene

#2
You will need to use a code-based Strategy to do that. Use the Hour/Minute properties of the standard .NET DateTime object. Here's a wrapper function that makes coding a little more straightforward:

Time based strategies

I'll stress this in the WL5 Wiki FAQ.
profile picture

arthurdent84

#3
hi eugene.

thanks for the help and pointing me to that link. the code looks simple enough.


would you suggest learning WL4 syntax and using the converter code , or just to just straight into C#?

i only ask because the WL4 community still seems very large comapred to WL5.. hopefully people will switch over soon ;)

cheers!
profile picture

arthurdent84

#4
hey one more thing. i cant seem to find a pdf for documentation on C# / WL5 syntax?

I just see Wealth Script 4 documentation under the 'products' tab. Am i missing something ;)


cheers!
profile picture

Eugene

#5
QUOTE:
would you suggest learning WL4 syntax and using the converter code , or just to just straight into C#?

I'd strongly suggest starting with C# syntax to save the learning curve.
QUOTE:
i cant seem to find a pdf for documentation on C# / WL5 syntax?

To be precise, "WL5 syntax" equals "C# syntax". You'll find the V5 WealthScript methods and properties documented in the QuickRef, along with many examples. There's no PDF version, as well as no plans to create one. The QuickRef tool is designed to serve as a handy online reference that comes with sample code ready to run.
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).