Very first code line is "Buy at Limit". Backtest buys from assigned Data Manager list up to
the $300,000 starting capital. Real-time run doesn't buy any stock at all (not even one).
What am I doing wrong?
Size:
Color:
Hello,
QUOTE:
What am I doing wrong?
Not making available some essential details, as per this checklist:
How to report a Problem?Two key items are:
* Strategy code
* Position size
Size:
Color:
Thanks. Here are the details:
Wealth-Lab Version 6.0.55.0
Win 7 Ultimate, Intel Core i7 Quad 2.67GHz, 12 GB RAM
Strategy from Code
Dow30 (AA AXP BA BAC CAT CSCO CVX DD DIS GE HD HPQ IBM INTC JNJ JPM KO KFT MCD MMM MRK MSFT PFE PG T TRV UTX VZ WMT XOM )
Data Provider: Fidelity Investments
I've created a zip file with picture of Strategy Code and Strategy Activation Settings> How do I attach to post?
Size:
Color:
You can copy the code using Ctrl-C and paste it here, in between a pair of CODE tags ("Bold, Italic... CODE, IMG" below "Add a new Post").
Size:
Color:
If you're doing a "backtest", you should do it in a Strategy Window. Just click the "CODE" button, and then copy and paste the code between the tags. If you've never worked with image hosting, let's forget about that for now.
Size:
Color:
CODE:
Please log in to see this code.
Using Portfolio Simulation Mode: Starting Capital 300,000 Fixed Dollar 8000
Data Range 3130 bars Position Size 8,000 Scale 30 minutes Automatically Stage Orders from Strategy Alerts
Size:
Color:
The code doesn't seem to have issues.
Since you mentioned "Automatically stage...", you must be running it in Strategy Monitor. Please upload your screenshot to any image hosting service (like imageshack.us or tinypic.com) and just paste the direct link (disregard the IMG tag for now) when replying. I'd like to see what you mean by saying "not even one trade in RT run", or perhaps there's a message in the Actions column that may help us.
Size:
Color:
http://yfrog.com/3zverysimpletestqjTo clarify, the Strategy Monitor does indicate 111 trades but the Local Trade History in Account Balances and Positions screen is blank. No positions. 0 Alerts in Strategy Monitor.
Size:
Color:
This is expected. These are historical trades, Local Trade History shouldn't reflect them until they become Alerts, then taken trades and history.
0 Alerts means zero alerts for the current bar. As a rough estimate, 3130 bars and 111 trades is 1 trade each 30 bars i.e. once every week.
Size:
Color:
But why won't the program execute an order that results in a long position? The first line of code is simply to buy at limit, limit being the price at the close of the first(or previous) bar. What am I missing?
Size:
Color:
QUOTE:
But why won't the program execute an order that results in a long position?
For example, if it is already holding a (historical) position in a stock, and your exit condition has not been met yet. Double-click the SM entry to open a new strategy window and verify.
Size:
Color:
I was able to get into the Optimization window but could not verify historical trades. Anyway, my essential question is how do I prevent historical trades from disrupting execution of orders for current bar. I obviously don't want to wait till an historical trade is eliminated by meeting exit conditions. I'm using a data range of 3100 bars in case I want to use a 200
day moving average in my code.
Size:
Color:
Not the Optimization but just a regular Strategy window. You should be able to verify historical trades or their absense. This effectively should clear your essential question.
Size:
Color:
"Double click the SM entry"
I have double clicked the "Oct4 10SMA X 50SMA" entry in my Strategy Monitor which causes the Strategy Activation Settings window to appear. How do I bring up historical trades window?
Size:
Color:
My previous comment was misleading: double-click works for Alerts produced by a SM strategy (N/A in your case), opening a Strategy window.
Just open a strategy window for "Oct4 10SMA X 50SMA" with the data loading and position sizing settings completely identical to your SM. Is there an open position in a stock? If not, is there an alert triggered in the strategy window but missing in the SM window?
Size:
Color:
I think you're asking me to run a backtest on "Oct4 10SMA X 50SMA" in a new strategy window with identical data loading and position sizing settings to my Strategy Monitor. (I couldn't find "works" for Alerts; I opened a strategy window using
"open strategy" in tool bar--3rd line down from top of master WL window). I ran a backtest which resulted in 111 trades, no alerts; open orders in some of exit trades. It looks as though the SM runs just like its a backtest.
Do I need to carefully craft a code strategy so that it will result in a buy at a future bars but doesn't generate any open exit positions (from historical buys) that will block any new buys?
Size:
Color:
Yes, that's right. Based on your description, there's no discrepancy in results (OK).
Re: question - sure, you can force a strategy to exit all historical positions if the current bar's date is at or after some date where trading starts for real or in a paper trading account.
Size:
Color: