It has backtested profitably on all markets I have tested it on.
Basically it looks for stocks that are trading in a reduced range compared to the previous period. For stocks that are trading at recent highs it will buy when the stock moves up within this range, it shorts when the stock moves lower within this range. For exits it either sells into increasing strength or if when the price pulls back (opposite for shorts).
When run as an exploration it will produce a -1 for short, 1 for buy, -99 for sell, 99 for cover and 0 for hold.
PosQty = 1000; // You can define here how many open positions you want
SetOption("MaxOpenPositions", PosQty);
//PositionSize = 1000/PosQty; // invest 100% of portfolio equity divided by Max. position count
SetPositionSize( 1, spsShares );
///////////////////////////////////////////////////////////////////////////////
// Range Constriction
// Finds stocks that are trading in a reduced range compared to previous period.
// Buys when in the reduced range at a recent high price, Shorts when in the reducred range at a recent low price.
// Sells when the stock slows or it makes a sharp move up, Covers when the stock rises or makes a sharp move down
H5 = HHV(H,5); L5 = LLV(L,5);
H10 = HHV(H,10); L10 = LLV(L,10);
H20 = HHV(H,20); L20 = LLV(L,20);
H30 = HHV(H,30); L30 = LLV(L,30);
Range1 = H5-L5 < (Ref(H5,-5)-Ref(L5,-5))*0.5; Range2 = H10-L10 < (Ref(H10,-10)-Ref(L10,-10))*0.5; Range3 = H20-L20 < (Ref(H20,-20)-Ref(L20,-20))*0.5; Range4 = H30-L30 < (Ref(H30,-30)-Ref(L30,-30))*0.5; Consolidation = Ref(Range1,-1) OR Ref(range2,-1) OR Ref(range3,-1) OR Ref(range4,-1) ; Top = C == HHV(C,5); Bottom = C == LLV(C,5); Buy = top AND Consolidation AND C>1 AND C*MA(V,30)>10000000 AND V>1000000 AND C>Ref(C,-1)*1.015
AND C>O AND C>MA(C,50) AND C>LLV(C,200)*2 AND Trix(12)>0;
Sell = C
InLong = Flip(Buy, Sell);
Short = bottom AND Consolidation AND C>5 AND V>1000000 AND C*MA(V,30)>10000000 AND C