#### BenTen

##### Administrative

**Staff**

**VIP**

**Warehouse**

Power Earnings Gappers (PEG) is a strategy shared by @traderstewie at Art of Trading. If you haven't check out the original article, you can do so here.

This scanner for ThinkorSwim just makes it easier to find potential stocks that fit the criteria. It was developed by Drew Griffith.

This scanner for ThinkorSwim just makes it easier to find potential stocks that fit the criteria. It was developed by Drew Griffith.

### PEG Scanner

Rich (BB code):

```
#hint: SCAN (only) for "PEG" stands for power earnings gap. looking for a pullback from a previous gap and the stock is in a consolidation phase.
declare upper;
input percentage = 0.5; #hint: % gap
input wthn = 30; # periods to look for gap
def x = 1 + percentage / 100;
def cl = close;
def lo = low;
def hi = high;
def op = open;
def vo = volume;
def barnumber = BarNumber();
def gapup = lo > hi[1] * x;
def sign_up = if gapup then barnumber else 0;
def cup = (barnumber - Highest(sign_up[1], wthn));
def count_up = if barnumber <= wthn then 0 else if cup > wthn then 0 else cup;
def gapdn = hi * x < lo[1];
def sign_dn = if gapdn then barnumber else 0;
def cdn = (barnumber - Highest(sign_dn[1], wthn));
def count_dn = if barnumber <= wthn then 0 else if cdn > wthn then 0 else cdn;
input ema_10 = 10;
input ema_30 = 30;
input ema_300 = 300;
def EMA10 = MovAvgExponential(cl, ema_10);
#EMA10.AssignValueColor(Color.CYAN);
#EMA10.HideBubble();
#EMA10.HideTitle();
#EMA10.SetLineWeight(1);
#EMA10.SetPaintingStrategy(PaintingStrategy.LINE);
def EMA30 = MovAvgExponential(cl, ema_30);
#EMA30.AssignValueColor(Color.MAGENTA);
#EMA30.HideBubble();
#EMA30.HideTitle();
#EMA30.SetLineWeight(1);
#EMA30.SetPaintingStrategy(PaintingStrategy.LINE);
#def EMA300 = MovAvgExponential(cl, ema_300);
#EMA300.AssignValueColor(Color.GREEN);
#EMA300.HideBubble();
#EMA300.HideTitle();
#EMA300.SetLineWeight(2);
#EMA300.SetStyle(Curve.LONG_DASH);
#EMA300.SetPaintingStrategy(PaintingStrategy.LINE);
plot signal =
if cl <= EMA10 and cl >= EMA30 and EMA10 >= EMA30 and count_up > 0 and average(vo,5) < average(vo,50) then 1 else
if cl >= EMA10 and cl <= EMA30 and EMA10 <= EMA30 and count_dn > 0 and average(vo,5) < average(vo,50) then 1 else 0;
```

Last edited: