Fast Moving Average
Author: jhohman8010
Creation Date: 9/2/2009 8:29 PM
profile picture

jhohman8010

#1
Hi, I'm new to this and I have been trying to run a simple strategy of buying when the fast moving average is below the slow moving average and crosses through. I've run a backtest on the WLP 100 and for some reason I'm not always getting a buy signal when the averages cross. HPQ is one of the stocks I was looking at. Any suggestions?
profile picture

Eugene

#2
What's your position sizing? On a portfolio of 100 stocks, how many trades were not taken due to insufficient capital?

P.S. Please see: How to report a Problem?
profile picture

jhohman8010

#3
I was using $1000 raw profit mode and back testing for all data. Some of the charts do not show a buy signal when the fast moving average crosses upward through the slow moving average. I think when I ran the back test I had 2 with errors for insufficient capital.
profile picture

Cone

#4
Where's the script and what are the symbols?
profile picture

Eugene

#5
In RP mode, trades are not skipped due to insufficient funds - that was probably a different option.

Please revisit the link above and be more explicit about the strategy rules, the date when you think a signal should be generated (also specifying the bar scale used).
profile picture

Cone

#6
There is one reason a trade can be skipped in RP mode - the dollar size must be at least large enough to buy 1 share of the instrument. So, if RP were 1,000, you'd wouldn't be able to trade any stock (or index) that was ticking over $1,000/share.
profile picture

Eugene

#7
Oh, that. Thanks.
profile picture

jhohman8010

#8
Here is the code which is just the preset codes available. I was thinking HPQ should of had a buy signal around bar 4377 on April 15th, 2009. I found others as well but this is one example. Thanks for the input.

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

Eugene

#9
Right, a crossover happened on 04/15/2009. You're trying to buy at limit [of that day's close = $34.85]. Next day, the stock gapped up (35.50) and the low of the day was 35.46. The limit order thereby doesn't have a chance to be filled. Use a market order to collect more trading signals.

Now you see that being detailed is the key in troubleshooting?

P.S. Please paste your code inside a pair of CODE tags next time. tia.
profile picture

jhohman8010

#10
Thanks, that makes more sense to me now. I don't know what the code tags are as I'm very new at this.

profile picture

Eugene

#11
The code tags is the label that reads "CODE" right above the message entry field (Bold, Italic, Underline etc.)
profile picture

jhohman8010

#12
One last question: Right now I'm getting my alerts at the end of the day. Is there a way to get them intraday as the fast moving average crosses through? Same code as above. Thanks again for all the help.
profile picture

Eugene

#13
Although Wealth-Lab currently doesn't allow that, you could try this solution and set up a limit order:

RevEngSMA_TC (Tomorrow's Close)
profile picture

Cone

#14
If you're using a SMA Crossover strategy, you should definitely check out RevEngSMA_TC. Your signals will occur 1 day earlier about 95% of the time with very few false alarms. Keep in mind, however, that can be a double-edged sword.

Also, like Eugene said, you can't currently use "partial bar" data in a script, however, you can calculate the Daily moving average on an intraday basis. The example shows you how to do it and compares it to a Daily-synched SMA. You'll notice that the two indicator averages "synch" on the last bar of the day. Also, you'll see that this doesn't buy you much in the "look ahead" department since the biggest change in a moving average occurs when the front bar slides out of the average's window.

CODE:
Please log in to see this code.


Edit 10/8/2010: Just spotted an error to this procedure, now corrected.

With this correction, there actually does seem to be an advantage to using the partial bar method... subject of an upcoming TSL.
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).