Gap-Up Sell Rule

I was working with support and we were unable to come up with a solution to this problem. I was wondering if anyone else has hacked something together that would do something similar to what I’m aiming for.

I’m hoping to build a sell rule that would sell a position if it closed 1% below the low of the gap day - This is Gil Morales’s rule. (I’m defining gap day as 120% inc in volume, and 5 % gap up in price). I’d hope to use this rule on a gap buying strategy I’m building.

Thanks.

Can you try something like this? I’m just thinking out loud, but think something like this might work to get the maximum gap day sell price in the last 30 days. I don’t know how gapday is calculated, but if it’s an open price of greater than previous day close you might try custom field something like:

gapselllevel_30d = loopmax(“((open(CTR)/close(CTR+1) > 1.05) AND (vol(CTR)>1.2*Vol3MoAvg)) *low(CTR)*0.99”,30,0,1)

the

  • (open(CTR)/close(CTR+1) > 1.05 part should generating a 0 or 1 if gap day price criteria is satisfied
  • vol(CTR)>1.2*Vol3MoAvg) part should generate 0 or 1 satisfy the 120% volume criteria
  • multiplying by low(CTR)*0.99 should transform a binary of 1 into a price level of 1% below the low price on a gap day
  • the loopmax should grab the highest value of any gapday (if any) in the past 30 bars

I don’t know it’ll work, but it seems like something like this would give you the appropriate sell level

For a sell rule, this may work;

SetVar(@GapUpBar,LoopSum("Eval(GapUp(5,120,1,CTR),CTR,0)",30))
Eval(@GapUpBar!=0,Close(0)<Low(@GapUpBar)*0.99,False)

If there are multiple gap-ups, this may not work as expected. Perhaps FlipFlop() could be used to find the first gap-up occurrence.

Walter

EDIT: A nice addition would be GapUpBar. It would return the gap-up bar from 0 to the max range or NA if no gap-ups are found.

Thanks guys I’ll see if I can get either to work and let you both know.

SpacemanJones your rule worked! just added a “>close(0)” to the end. Thanks for your help. Unfortunately my gap strategy doesnt seem to be generating much alpha. Anyway I’ll keep tweaking.

Cool, glad that helped.

One pattern I’ve seen that your post brought to mind is one I’ve seen often following earnings release where a stock will pop up quite a bit, but will begin to decay back downward for a while, sometimes completely filling the gap back to where it was pre-earnings. I don’t know if you’ve tried the rule in combination with earnings release, but I seem to see that pattern often enough that it’s made an impression on me. For examples: see recent charts of MTRN Materion or KELYA Kelly Services. I think AUDC Audiocodes did this several times over the past few years. There are others, but I seem to see this behavior alot. I don’t know alot about technicals, but I’d be interested in your thoughts on this type of behavior if it seems familiar.

These gaps often do happen on earnings releases. The most powerful of these gap ups will not be filled. FB on 7/25/2013 is a perfect example of this.

I think one issue with the strategy is that the gap ups on these powerful days should be bought at the open and not the next day.

I use a sinusoidal function to over weight price momentum near earnings releases. It’s a bit hokey, but its rally just a reflection of a belief that short term price momentum is a contrarian indicator except near information releases.

In my models I’m using volume to validate the short term price moves. If it occurs without volume it’s probably to be ignored