Auto trade start up
Author: M635
Creation Date: 3/16/2009 8:35 PM
profile picture

M635

#1
New user here and trying to get up to speed. Many hours invested so far and becoming more knowledgeable.

Created a strategy with the rules builder and trading it in a paper account on auto trade, it is an intra-day using 3 minute time periods. Also running with the strategy opened in its own window so I can follow the action. Have all the appropriate buttons turned on to enable auto trade and place, in both the strategy monitor and orders window. I am running in a virgin paper account with no activity or existing positions, also enabled single open position in the rules.

Have run into a problem today on start up at market open. When the strategy fired up at the open it generated a sell signal based on a buy from the previous days data. Since no previous activity in the account or positions, no alert was generated, at least this is what I surmised.

So I waited for the first buy signal to be generated assuming when it did I would get a buy alert and it would fill. Well I got the buy signal but no alert or order was generated.

So now the question:

A. What am I missing here?
B. What do you do to sync. the account with previous days activities so if you are not running the previous day you start fresh and are not looking to close previous days positions?

Have searched the user guide and looked over the forum but have not come up with the rules of the road for enabling auto trade. Any and all help appreciated!
profile picture

Eugene

#2
QUOTE:
Well I got the buy signal but no alert or order was generated.

Could well be due to your position sizing. By the way, how is it set up? (Checklist)
profile picture

M635

#3
Used raw profit mode with a number of shares specified well below account cash available. Had other strategy's running as well and trades were being generated in same account.

QUOTE:
Could well be due to your position sizing. By the way, how is it set up? (Checklist)


I have had the thought as well, but using same setup as I have used before, and as noted in my first post.

Have had this happen before with a buy signal before the previous close and a sell at open the next day. My real question is how do you avoid these conflicts with previous days signals that bleed over when you have not run the strategy the previous day? Is this whole thing based on a single position parameter vs. a multiple position?


profile picture

Cone

#4
QUOTE:
Since no previous activity in the account or positions, no alert was generated, at least this is what I surmised.
Actually, this should work like it does for live accounts: Alerts should be generated (seen in the Alerts window of the tool that created it), but they'll be filtered from being staged or placed to Orders if an offsetting position does not exist.

QUOTE:
Well I got the buy signal but no alert or order was generated.
If an Alert didn't occur, how did you determine that you got a buy signal? These are one in the same.

QUOTE:
What do you do to sync. the account with previous days activities
Synch doesn't exist on this level. See User Guide: Orders > Portfolio Synch; read the whole topic.



profile picture

M635

#5
QUOTE:
If an Alert didn't occur, how did you determine that you got a buy signal? These are one in the same.


I followed the action with the strategy open in another workspace window. The strategy definitely created a buy signal shown on it's chart, but no alert or order was placed in the strategy monitor for the same strategy that was enabled.

QUOTE:
Synch doesn't exist on this level. See User Guide: Orders > Portfolio Synch; read the whole topic.


Ok have read the guide. Yes what I have read does agree with what I have typically observed running strategy's in auto trade. My experience has been using single position enabled strategy's and they always seem to wait for an offsetting signal before they execute new signals.

Most of my testing has been done not running sequential complete days but instead interrupted days do to some crashing issues. With the interrupted days I get many bleed over signals with out the offsetting positions having been created. So, with single position enabled how do I ignore the bleed overs and create the next signal regardless of prior signal history?
profile picture

Eugene

#6
QUOTE:
The strategy definitely created a buy signal shown on it's chart, but no alert or order was placed in the strategy monitor for the same strategy that was enabled.

How did you find that? That looked like a signal, or there was a trade arrow. I guess we need to take a look at the Strategy for possible peeking.
profile picture

Cone

#7
First, please let's see your strategy (use the CODE button) so we can clear you up on the Alert issue. We suspect you're using AtClose orders (see WealthScript Language Guide: Programming Trading Strategies > Alerts > How to: Alert for AtClose Signals), or, you're mistakenly passing bar instead of bar + 1 to your trading signals, or, you've made another programming error.


QUOTE:
with single position enabled how do I ignore the bleed overs and create the next signal regardless of prior signal history?
You could, for example, close all positions at the end of the day.
profile picture

M635

#8
For the record,,,,

I have an instance of the problem occurring at the moment.

Running the strategy in single position mode with a pure rules built strategy.

The strategy generated a buy towards the end of yesterday, the strategy was not running at the time so no buy was made. I started the strategy at the open today in a brand new clean paper account with nothing in it. Around 9:54 the conditions for a buy were met, as of 12.39 no buy had been issued. I did see a couple of sell alerts generated based on the phantom buy from the previous day but they never showed in the orders window which as I understand is what you would see if the system did not find the shares in the account.

At 12:36 a sell signal showed up on the strategy as I am monitor it in a separate window. This sell is tied to the phantom buy of yesterday.

So to sum it up I had no shares in the account did not run the strategy yesterday when a buy signal was generated. Started the strategy this morning in a clean new account. Met the conditions to make a buy but none created. And now have met the sell criteria for yesterdays phantom buy with alerts generated but no order placed.

Do you need the code or is the short answer single vs. multiple position in the rules?

profile picture

Cone

#9
QUOTE:
pure rules built strategy.
Does it use AtClose orders? If it does, then you won't get Alerts.

If that's not it, you can keep making us guess (I'll get tired of it very quickly), or you can just show us the code and we'll tell you what's wrong.
profile picture

M635

#10
No at close orders just market and a bracketed exit. Code inserted!

CODE:
Please log in to see this code.
profile picture

Cone

#11
I don't see anything wrong with the code; all the trading signals are coded properly and will produce Alerts. Let's start over. I just re-read your previous description and it's operating normally. Reviewing:

QUOTE:
The strategy generated a buy towards the end of yesterday, the strategy was not running at the time so no buy was made. I started the strategy at the open today in a brand new clean paper account with nothing in it. Around 9:54 the conditions for a buy were met, as of 12.39 no buy had been issued. I did see a couple of sell alerts generated based on the phantom buy from the previous day but they never showed in the orders window which as I understand is what you would see if the system did not find the shares in the account.
Exactly right. In Version 5, Strategies always operate in a theoretical mode. Since a theoretical Position was created, the Strategy executes the exit logic for that Position. Since the account didn't have an offsetting Position, those sell Alerts are not staged or placed.

Furthermore, even though the buy conditions were such that a Position could have been purchased, the Strategy cannot detect that if it's executing only the exit logic. On the other hand, if this were set up to be a multi-Position strategy, then a second (or third, ...) Position could be added whenever the buy condition(s) triggered.

QUOTE:
So to sum it up I had no shares in the account did not run the strategy yesterday when a buy signal was generated. Started the strategy this morning in a clean new account. Met the conditions to make a buy but none created.
You probably know that the script you posted is for a single position - so it's either buying or selling a Position, theoretically. If you want to start fresh every day, then you need the Strategy to exit any open Positions at the end of the day.

profile picture

M635

#12
OK,,, I think we have finally gotten somewhere.

I have been saying from the start that I am running it in single position mode.

So based on your last post the answer is either run multiple positions (given there is enough funds available) or code in an EOD parameter, true?

I am new to this and not a coder so my ability to insert parameters into code is very limited at this time. The folks on this site have been very helpful and I know I can post code and get them to insert for me. I do want to get to the point where I am self sufficient.

Since I am new, I am creating many rules built scripts,and testing and observing. Once I have arrived at a couple that I feel comfortable with I do want to tune up the rules built code before I run them for real. Please bear with me while I go through the learning process. This is a journey, you just don't wake up one morning and decide to run Wealth lab. So far the journey has been very informative and I shudder at the thought of trying to just flip a switch and run the program. Best way I can think of to lose a lot of money!!!

So,, I think I have my answer, if not please respond with more comments and questions.

Thanks!!!
profile picture

Cone

#13
QUOTE:
either run multiple positions (given there is enough funds available) or code in an EOD parameter, true?
Well, those are two completely different strategies. In Raw Profit sizing mode, you'll see all instances of entry triggers with multi-position logic (assuming that the logic doesn't limit the number of positions). Exiting at EOD and using single-positon logic would work for you to see the first entry trigger of the day, or more generally, any trigger if the strategy is not holding a position.
profile picture

M635

#14
OK, I think it will be EOD for me.

Thanks to you and Eugene for holding my hand on this!

I'm sure I'll be back with more questions as I continue the journey.