How to code "Hexensabbat" in v5?
Author: dansmo
Creation Date: 8/18/2009 3:27 AM
profile picture

dansmo

#1
In v4 I used this function to identify the Hexensabbat (the 3rd friday in March, June, September and December).
How can this be done in v5

CODE:
Please log in to see this code.

profile picture

Eugene

#2
I deliberately will not present a ready method so that you can have a chance to learn about dates in .NET straight from horse's mouth (i.e. MSDN) - everybody have to use these methods from time to time:

1 - Our Wiki FAQ tells where did the Date/Time functions go.
2 - OptionExpiryDate is now called IsOptionExpiryDate - please look that up in the QuickRef.

If you have any problems with your implementation, let us know and we'll help.
profile picture

dansmo

#3
If I understand it correct then, there is no way of not working with an IDE?
profile picture

Eugene

#4
I didn't mean to tell that. Just the opposite, the function would most likely take the same 2 or maybe 3 lines of code.

The key is: GetMonth = Bars.Date[bar].Month
profile picture

dansmo

#5
Okay, thats it:

CODE:
Please log in to see this code.


This code is derived from a translation.
Two learning questions:

Why do I get an error if I try to change the class name?
What is namespace and why does it throw an error if I change that?
Why do I get an error, when I remoce "using financtic.TL", there are no more methods used from it.
profile picture

Eugene

#6
Good try.

finantic.WL is a namespace coming from WealthScript Translator. Hence the errors.

Insert your public bool Hexensabbat in any native Strategy (they're derived from WealthScript, not WealthScriptTL as the ones created by the WSTL tool) - in the same place as you did - and it will work fine.
profile picture

dansmo

#7
Hmm, I think I dont understand what a namespace is and why the
class Strategy : WealthScriptTL cannot be named Strategy: Hexensabbat.
profile picture

Eugene

#8
You're confusing implementing an interface with renaming a strategy.

I'd recommend picking any free C# book or online resource recommended in our Wiki FAQ.
profile picture

Eugene

#9
That's it:
CODE:
Please log in to see this code.
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).