Prison Mike
Member
Started to post this in the "strategies" section but as you can tell from the title haven't figured it out yet. Was hoping to get some feedback and suggestion; input for if this idea is pointless.
So I love @YungTraderFromMontana breakout scan, Mobius mobile fractal pivot script and one of my own I have been using to find breakouts. But I always think "how can I catch them the day before?" A lot of afternoons, before the market closes, I look through my watchlist looking for those tickers that are close to a "entry" plot just to get idea, and by morning some of them have gapped up to the entry point.
So the thought is to use overnight ATR in relation to a breakout entry point as a measure if a ticker will gap up overnight to that plot. So If a stock is under an entry point but overnight ATR is greater than the distance between close and entry line then it would be a BUY. Think of it as a proximity filter for use on your favorite breakout. If your interested keep reading.
Here is what I have so far. Pieced together the overnight ATR script from the forum. Due to time agg the timeframe needs to be under the daily timeframe. Think that is most of my issues. The breakout portion could be changed out for any breakout script, its just what I'm using. Maybe you have another idea.
Next would be making it a strategy to see if it was pointless. But not there yet.
So I love @YungTraderFromMontana breakout scan, Mobius mobile fractal pivot script and one of my own I have been using to find breakouts. But I always think "how can I catch them the day before?" A lot of afternoons, before the market closes, I look through my watchlist looking for those tickers that are close to a "entry" plot just to get idea, and by morning some of them have gapped up to the entry point.
So the thought is to use overnight ATR in relation to a breakout entry point as a measure if a ticker will gap up overnight to that plot. So If a stock is under an entry point but overnight ATR is greater than the distance between close and entry line then it would be a BUY. Think of it as a proximity filter for use on your favorite breakout. If your interested keep reading.
Here is what I have so far. Pieced together the overnight ATR script from the forum. Due to time agg the timeframe needs to be under the daily timeframe. Think that is most of my issues. The breakout portion could be changed out for any breakout script, its just what I'm using. Maybe you have another idea.
Code:
#BYEBYE_Money Breakout
#By Prison Mke
input price = close;
input highestInXBars = 10;
input lookBackBars = 10;
def highestInBarsBack = Highest(high, highestInXBars);
def lastBar = !IsNaN(close) and IsNaN(close[-1]);
def targetHigh = if lastBar then highestInBarsBack[lookBackBars] else 0;
plot higherlevel = HighestAll(targetHigh);
input highestInXBars2 = 20;
input lookBackBars2 = 20;
def highestInBarsBack2 = Highest(high, highestInXBars2);
def lastBar2 = !IsNaN(close) and IsNaN(close[-1]);
def targetHigh2 = if lastBar2 then highestInBarsBack[lookBackBars2] else 0;
plot highestlevel = HighestAll(targetHigh2);
input lowestInXBars = 10;
input lowlookBackBars = 10;
def lowestInBarsBack = Lowest(low, lowestInXBars);
def lowlastBar = !IsNaN(close) and IsNaN(close[-1]);
def targetLow = if lowlastBar then lowestInBarsBack[lowlookBackBars] else Double.POSITIVE_INFINITY;
plot lowerlevel = LowestAll(targetLow);
input lowestInXBars1 = 20;
input lowlookBackBars1 = 20;
def lowestInBarsBack1 = Lowest(low, lowestInXBars1);
def lowlastBar1 = !IsNaN(close) and IsNaN(close[-1]);
def targetLow1 = if lowlastBar1 then lowestInBarsBack1[lowlookBackBars1] else Double.POSITIVE_INFINITY;
plot lowestlevel = LowestAll(targetLow1);
#OVER NIGHT ATR stuff
input agg = AggregationPeriod.DAY;
input length = 14;
input averageType = AverageType.WILDERS;
input PlotPreMktLinesHrsPastOpen = yes;
def bar = BarNumber();
def nan = Double.NaN;
def vHigh = high(period= agg);
def vLow = low(period= agg);
def vClose = close(period= agg);
def PMhrs = RegularTradingStart (GetYYYYMMDD()) > GetTime();
def RMhrs = RegularTradingStart (GetYYYYMMDD()) < GetTime();
def PMStart = RMhrs[1] and PMhrs;
def PMclose = CompoundValue(1, if PMStart then vHigh else if PMhrs then Max(vHigh, PMclose[1]) else PMclose[1], 0);
def PMHigh = CompoundValue(1, if PMStart then vHigh else if PMhrs then Max(vHigh, PMHigh[1]) else PMHigh[1], 0);
def PMLow = CompoundValue(1, if PMStart then vLow else if PMhrs then Min(vLow, PMLow[1]) else PMLow[1], 0);
def highBar = if PMhrs and vHigh == PMHigh then bar else nan;
def lowBar = if PMhrs and vLow == PMLow then bar else nan;
def PMHighBar = if bar == HighestAll(highBar) then PMHigh else PMHighBar[1];
def PMLowBar = if bar == HighestAll(lowBar) then PMLow else PMLowBar[1];
plot PMH = if PlotPreMktLinesHrsPastOpen and PMHighBar != 0
then PMHighBar
else nan;
plot PML = if PlotPreMktLinesHrsPastOpen and PMLowBar != 0
then PMLowBar
else nan;
plot PMMid = if PlotPreMktLinesHrsPastOpen and PMHighBar != 0 and PMLowBar != 0
then (PMHighBar + PMLowBar) / 2
else nan;
#problem solving stuff
def ONATR = MovingAverage(averageType, TrueRange(PMHigh, PMclose, PMLow), length);
AddLabel(yes,Round( ONATR )+ ": " );
def dollasaway = higherlevel - pmclose or highestlevel- pmclose;
Addlabel(yes, dollasaway+ ":");
def amount= dollasaway- onatr;
addlabel(yes, amount+ ":" );
#Signal
plot OverNite_entry = dollasaway < ONATR;
Next would be making it a strategy to see if it was pointless. But not there yet.
Last edited: