Strategy Monitor has trades but Local Trade History is blank
Author: pemcowl
Creation Date: 10/8/2010 10:03 AM
profile picture

pemcowl

#1
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?
profile picture

Eugene

#2
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
profile picture

pemcowl

#3
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?

profile picture

Eugene

#4
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").
profile picture

Cone

#5
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.
profile picture

pemcowl

#6
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
profile picture

Eugene

#7
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.
profile picture

pemcowl

#8
http://yfrog.com/3zverysimpletestqj

To 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.

profile picture

Eugene

#9
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.
profile picture

pemcowl

#10
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?
profile picture

Eugene

#11
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.
profile picture

pemcowl

#12
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.
profile picture

Eugene

#13
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.
profile picture

pemcowl

#14
"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?
profile picture

Eugene

#15
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?
profile picture

pemcowl

#16
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?
profile picture

Eugene

#17
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.
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).