Larry Williams Oops
Author: kguclu
Creation Date: 11/26/2010 11:30 AM
profile picture

kguclu

#1
Hi,

I tried to implement a variation of Larry Williams Oops pattern.
when do i have to use bar or bar+1 when i buy or sell a stock.
i find it confusing. The system below has avg. 80% winning trades last 5 years for QQQQ.
Is the script correct? Do i use sell and buy orders with correct "bar" or "bar+1" indices?
Could you please check the script below?

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

Cone

#2
QUOTE:
when do i have to use bar or bar+1 when i buy or sell a stock.
If bar is the loop index and treated as the current bar (the most-recent complete bar) then you should use bar+1 for all orders except possibly AtClose orders, which are a special case. It's actually very easy, but using the Open on the trade bar complicates matters because the Open price isn't directly accessible by the script when generating orders for the next bar (because the Open occurs on that bar). There's no problem backtesting it, but to trade it, you need to invent a real-time filter for the stop entry order.

If you want to BuyAtStop if the Low of the "current" bar is above the Open of the trade bar, here's how I'd write it:

CODE:
Please log in to see this code.
I don't follow what you're trying to accomplish in the exit logic. Exiting at stop on the Open of the same bar pretty much will guarantee that you stop out on the open. Got a link to Larry Williams Oops pattern?
profile picture

Eugene

#3
Alternative code employing PartialValue of the open price:
CODE:
Please log in to see this code.
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).