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.
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
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.
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.
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.