Hello-
I am trying to edit my strategy by stating that the 90-Day Low is BEFORE the 90-Day High. In other words, if we look at the past 90-Day range, the low of that range happens before the High. I see some Date functionality in the user guide but can not figure out how to code this.
Any help would be appreciated.
THANKS.
Size:
Color:
You won't find that
Date functionality in the User Guide roughly for the same reason why the multiplication table shouldn't be looked for in a Math 202 course. Working with dates (strings etc.) is a basic primitive explained in more general C# resources like
MSDN or the sites like
Dotnetperls, because WealthScript is based on pure C#.
CODE:
Please log in to see this code.
Size:
Color:
Note how working with DateTime isn't required when solving tasks like yours, thanks to the built-in HighestBar and LowestBar indicators. Check them out in the Wealth-Lab Wiki:
Standard Indicators.
Size:
Color:
Thanks Eugene, and I realize my coding needs a lot of work as I am just a beginner and trying to learn this stuff as fast as possible. However, I am still a little confused. I am using the Indicators you discussed, but am obviously doing something very wrong.
Here is the code I am using:
DateTime date = new DateTime(Highest.Value(bar,High,90));
if ((Lowest.Value(bar,Low,90)).Date[bar] < date)
Any modifications to this to make it work would be greatly appreciated. All I want to do is say that the lowest value of the last 90 days comes before the highest value of the last 90 days.
Thanks for your help.
Size:
Color:
What's bad about using the code above i.e.
if( h > l )...? It's ready. Just try it.
h is the bar when the 90-bar highest high was recorded
l is the bar when the 90-bar lowest low was recorded
CODE:
Please log in to see this code.
means that the bar of the event on the left (h) is greater than the event on the right side (l).
Size:
Color:
Thanks for your help. Unfortunately I do not really understand the code above and can not figure out how to incorporate it into the code I already have (w/o screwing it up). I think I need to teach myself a lot more of the programming language so I can better understand. Thanks for trying.
Size:
Color:
If it's OK to post the strategy here, I could take a look at incorporating this code. Later the code could be removed if that matters.
Size:
Color:
Sure that is fine. Here it is - just very basic as it's in the beginning stages. But it's looking for stocks who had a decent up run and have pulled back ~50%. Which is why I want the low of the 90d range to come before the high. Thanks for help.
CODE:
Please log in to see this code.
Size:
Color:
When posting code, please always wrap it in
CODE tags. (Click the CODE button to see what I mean.)
Based on your words from the starting post:
"I am trying to edit my strategy by stating that the 90-Day Low is BEFORE the 90-Day High.", here's my take at it:
CODE:
Please log in to see this code.
Size:
Color:
Thanks Eugene. This is great. I have signed up for a programming class so hopefully my knowledge will increase signifcantly and I can ask less 'basic' questions.
Thanks for help and patience.
Size:
Color: