Looking to implement a gap strategy
Author: Vegaswarrior
Creation Date: 12/13/2011 1:24 PM
profile picture

Vegaswarrior

#1
Hi Everyone!

I am new to WL and was looking to implement and back-test a very simple strategy.

My intentions are as follows:

If stock "A" closes at $50 a share and then opens the next day at $51 a difference of 2% or more, then you would trigger a buy at market open that day. At the end of the trading day you would sell at market close.

I would also like to put in a stop loss for a single day at 10% if possible

I would like to do the opposite thing if the stock drops 2% from close to open, then short it that morning etc, exactly inverse of the long strategy above.

I have been trying to get this to work using the "overnight price change of a previous day" condition but I can't tell if its working or not? Any help would be much appreciated!!
profile picture

Eugene

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

Cone

#3
I ran the code Eugene, and it's taking trades that it shouldn't.

Here's my take on it. It includes a parameter that you can use to "trade live". For details, strike F11 for the QuickRef and look up GetSessionOpen.

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

Vegaswarrior

#4
Thanks Guys, I will try it out!