CODE:
Please log in to see this code.
How can this cheeting code be changed to Buy at the Low [bar] and sell the next day at the High [bar]?
Size:
Color:
Size:
Color:
I had a look at your link but it is way beyond my reach.
CODE:
Please log in to see this code.
EnterAtPrice is not defined.
Your assistance will be appreciated.
Size:
Color:
Right, it errors out because Cone gave you links with code examples but your code doesn't follow the guidelines. Here's how to extend your reach:
1. Since
EnterAtPrice and
ExitAtPrice are parts of
Community Components library, don't forget to install/update the extension and restart Wealth-Lab if it's not installed.
2. Then review the examples. Feel free to choose any programming style, "extension methods" or "legacy syntax", both will work. My vote goes for extension methods which are terse and don't require a "
using" directive (which usually gets overlooked when copying and pasting from the examples), therefore it's easier.
Size:
Color:
I'm now back to what the wizard could do...it could not buy today and sell the very next day
It needs buy today and sell the very next day...every time.
I had the AtPriceDemo trading like this (every day) but I could not get it to buy at low and sell at high. To do that I replaced the Close with a High and the Open with a Low...
More assistance please.
CODE:
Please log in to see this code.
Size:
Color:
Comment this line out:
CODE:
Please log in to see this code.
Size:
Color:
I could not figure this one out.
CODE:
Please log in to see this code.
Size:
Color:
Was that a question or assertion?
Now everything works exactly as you asked.
Size:
Color:
That was an assertion...as it stands now it is not trading at all and I would appreciate more help please.
It should buy today at the lowest price on today's bar (after the EOD) and sell tomorrow at the highest price on the bar (after the EOD)
From my first post.
QUOTE:
How can this cheeting code be changed to Buy at the Low [bar] and sell the next day at the High [bar]
I'm have done this on WL4 but I can't get this done on WL 6 where I wish to work.
Size:
Color:
I think that this implies having
two open positions, so let's get rid of
IsLastPositionActive():
CODE:
Please log in to see this code.
Size:
Color:
Irratic trading days/dates with many buys standing open.
Size:
Color:
All trades are closed strictly on the 2nd bar regardless of the position sizing used and/or backtest mode (SSB/MSB).
Anyway, please feel free to explore WealthScript and experiment with your code yourself. This subject is no rocket science, and I'm sure you'll find lots of guidance and examples in the well-written WealthScript Programming Guide, QuickRef, and the Wiki. I'm through with this, as spending more time on the topic of intentional peeking doesn't make sense to me while real bugs and tasks are waiting.
Size:
Color:
I find it strange that we could not so far get a simple code to run correctly.
Anyway, thank you for your help.
For what it’s worth, this code (on WL4) provides outstanding statistics (I’m not referring to profits) with high probability for manually (unfortunately) trading/predicting the market the next day.
This was the statistics I was looking for (on WL6)...the next step is to code this into a strategy for trading. (Not cheating but relying on the statistics)
Thanks.
Size:
Color:
For me, the code runs exactly as you asked for.
Please consider that an essential (and pretty evident) element of successful troubleshooting is providing thoughtful, thorough problem descriptions which include the Wealth-Lab tool in use, position sizing, backtest mode, data loading settings, related options and symbol/data provider. We technicians can not see what's happening on users' monitors, but they can help us help them.
Glad to have helped.
Size:
Color:
Please accept my apology. I don’t often work on code. But I’m sure most of your customers can see your brilliance and often get the Idea that you can see through most statements and questions.
As you have stated your time is required elsewhere so I won’t mind if you don’t respond to the following.
I normally just run a strategy (where my other strategies run on the home page) with no special settings besides date and position size of 10% and look at the chart. In this case I have also tried Raw mode but it makes no difference.
What I have noticed now is that the first buy of a backtest only takes place on some dates...on other dates, say the next day, I would get a Runtime error and it would not compile This happens on different symbols and on different dates.
If it compiles and it triggers the first buy then it only exits a few days later and trading becomes random after that.
I had to apologise and that got me going again. Sorry and thanks.
Edit: Bloomberg and Google data works fine. My local supplier use METASTOCK data which is causing the problem. I'm routing this data from WL4.
Size:
Color:
QUOTE:
Edit: Bloomberg and Google data works fine. My local supplier use METASTOCK data which is causing the problem. I'm routing this data from WL4.
That's an interesting observation. If by "routing" you mean using the WL4 Files provider to read Metastock data, then what's the point in doing that? The new Metastock provider that comes with WL 6.6 is an advancement compared to WL4, working in 64-bit WL6 (no more COM legacy) and supporting new formats as well as providing bug fixes. Try upgrading to 6.6 and using the new MS provider.
Also, am I correct to assume that your MS DataSet contains symbols with 0 bars or those that stopped trading long ago?
Size:
Color:
QUOTE:
. If by "routing" you mean using the WL4 Files provider to read Metastock data, then what's the point in doing that? The new Metastock provider that comes with WL 6.6 is an advancement compared to WL4, working in 64-bit WL6 (no more COM legacy) and supporting new formats as well as providing bug fixes. Try upgrading to 6.6 and using the new MS provider.
You are correct and that is on my to-do list.
QUOTE:
Also, am I correct to assume that your MS DataSet contains symbols with 0 bars or those that stopped trading long ago?
I assume you are referring to “No Data Available" on a symbol. That I have been getting for years, even before using WL6. It never bothered me because it has never happened to symbols which I have been using. But during scans etc I always notice the list of “No Data Available"...about 6% of the list of symbols I start with. Just note that in above posts I was using symbols that was running well on other strategies.
Results of a systematic check on Runtime errors on data using the code in question and another working code using a year's data...same starting date on all. 40 symbols randomly selected from each of the three suppliers from my existing lists. (120 symbols in total)
Working code: Google, Bloomberg and Metastock (local) no problems at all.
Code in question:
Google.........15% of symbols indicates runtime errors.
Bloomberg... 0% of symbols indicates runtime errors.
Metastock.....78% of symbols indicate runtime errors.
I am thankful that you are walking the extra mile again.
Size:
Color:
Thanks for the clarification. So as I thought, the zero-bars/delisted symbols are probably the reason behind the erratic trading dates and possibly the buys standing open.
Size:
Color:
Thanks.
Season's Greetings to you and the rest of the WL staff.
Regards
Ernst
Size:
Color: