Not being a C programmer and just trying to learn the Wealth Lab programming language, I would like some help with the subject matter. I have included a snippet of code that I am trying to develop.
As well as other compiler errors, I am getting 'the name highbar does not exist in the current context' for the code 'if (highbar < lowbar)'. Of course, I am getting the same error for lowbar.
What do I need to do to rectify this?
Thank you
Rick
CODE:
Please log in to see this code.
Size:
Color:
There may be a more efficient pattern for your task but first please tell the forum what you're trying to accomplish, i.e. the rules in plain English.
Size:
Color:
I heard about a supposedly good trading system that works with, among other factors, the following 2 formulae.
(# periods - # periods since highest high) / # periods
(#periods - # periods since lowest low) / # periods
When the first formula crosses the second formula upwards, BUY
When the first formula crosses the second formula downwards, SELL
I have reduced these formulae (I hope correctly) to just # periods since HH (LL).
My code snippet was just a rudimentary attempt to start learning the Wealth Lab language and to start coding the system. As my language knowledge increases, I intended to use crossover() and crossunder() as well as an array for the high and low # of periods. In that way, I could grow both the trading system and my programming skills concurrently. Then I could quickly test concepts I read or hear about in my research.
I hope this helps.
Rick
Size:
Color:
Thanks. Hopefully I understood your idea - feel free to correct me if I'm wrong:
CODE:
Please log in to see this code.
Size:
Color:
Eugene
That looks fantastic. On the surface it looks like it does the trick, but now I have to REALLY look at it in detail to understand the code.
Thank you very much
Rick
Size:
Color:
I do not understand the following line of code.
CODE:
Please log in to see this code.
I understand the DataSeries h,l which sets up an array for each. But I do not understand why there is Close*0 for each of them. My first guess is that you are initializing both arrays to 0, but if my guess is correct, then why in this manner.
Thanks again.
Rick
Size:
Color:
It's one of the ways to initialize a DataSeries. For example, please see the WealthScript Programming Guide > DataSeries > Filling a Custom DataSeries > How to: Create a DataSeries filled with zeroes.
Size:
Color:
Thank you
Size:
Color: