Saturday, April 16, 2016

Widget THINKSCRIPT - BBC (flawed but current)

#bbcsignal but flawed because it gives NaN many times...except for during market hours. wanted to fix it but couldn't

input MAlength = 50;
input averageType = AverageType.EXPONENTIAL;
input vsstock = "spx";

def X = TotalSum (close - close [1]) / (ATR(10, AverageType.WILDERS));

def PPA = TotalSum (close - close [1]) / (ATR(10, AverageType.WILDERS));

def PPAMA = MovingAverage (averageType, X, MAlength);

def StockvsMA = ((close() - movingaverage(averagetype,close(), malength)) / movingaverage(averagetype,close(), malength));
def SPYvsMA = ((close(vsstock) - movingaverage(averagetype,close(vsstock), malength)) / movingaverage(averagetype,close(vsstock), malength));

def VSbull = StockvsMA > SPYvsMA;
def VSbear = StockvsMA < SPYvsMA;

def PPAhistBull = PPA > PPAMA;
def PPAhistBear = PPA < PPAMA;

def BullTRUE = if vsbull ==1 then 1 else 0;
def PPABullTrue = if PPAhistbull ==1 then 1 else 0;
def Bull2x = if vsbull ==1 and ppahistbull ==1 then 2 else 0;
def Bear2x = if vsbear ==1 and ppahistbear ==1 then -2 else 0;

def score = Bear2x+Bull2x;
plot S = score;

s.AssignValueColor(if bull2x== 2 then color.green else if bear2x ==-2 then Color.red else color.dark_gray);

THINKSCRIPT - BBCsignal (flawed but current)

#BBCsignal with 2 signals only but FLAWED because different values from StockWidget...could not fix it

declare lower;

input vsstock = "spx";
input MAlength = 50;
input averageType = AverageType.EXPONENTIAL;
input lineweight = 2;

input atraveragetype = averageType.WILDERS;
input atrlength = 10;

#Price as ATR indicator (study of the real move of the stock) because the most important move is the move size vs how it moved recently...percentage and dollar amount is an incomplete picture

def X = TotalSum (close - close [1]) / (ATR(atrlength, atraveragetype));

def PPA = TotalSum (close - close [1]) / (ATR(atrlength, atraveragetype));

def PPAMA = MovingAverage (averageType, X, MAlength);

def PPAhistBull = PPA > PPAMA;
def PPAhistBear = PPA < PPAMA;


#Stock vs SPX (study of relative strength vs SPX) because only want to buy strong stocks who can lead

def StockvsMA = ((close() - MovingAverage(averageType, close(), MAlength)) / MovingAverage(averageType, close(), MAlength));
def SPYvsMA = ((close(vsstock) - MovingAverage(averageType, close(vsstock), MAlength)) / MovingAverage(averageType, close(vsstock), MAlength));

def VSbull = StockvsMA > SPYvsMA;
def VSbear = StockvsMA < SPYvsMA;


#plot BBC indicator

plot BBCsignal = if VSbull + PPAhistBull == 2 then 1 else if VSbear + PPAhistBear == 2 then -1 else 0;

plot zeroline = 0;



BBCsignal.SetPaintingStrategy(paintingstrategy=PaintingStrategy.line_vs_POINTS);

BBCsignal.AssignValueColor(if BBCsignal == 1 then Color.GREEN else if BBCsignal == -1 then Color.RED else Color.white);

zeroline.SetDefaultColor(Color.light_gray);
zeroline.SetLineWeight(1);
BBCsignal.SetLineWeight(lineweight);

Widget THINKSCRIPT: PPAHist

#PPAHist (new and fixed) on 4/17/16 for watchlist widget...now is the same as the chart's PriceAsATRtrendHist

input MAlength = 50;
input averageType = AverageType.wilders;

def PPA = sum ((close - close [1]) / (ATR(10, averagetype)),999);


def PPAMA = MovingAverage (averageType, PPA, MAlength);


plot PPAhist = PPA - PPAMA;

PPAhist.SetPaintingStrategy(paintingStrategy = PaintingStrategy.HISTOGRAM);

PPAhist.AssignValueColor(if PPA >= PPAMA then Color.GREEN else Color.RED);

PPAhist.SetLineWeight(3);

THINKSCRIPT PriceAsATRtrend - fixed but can't use!

#PriceAsATRtrend via Histogram (new + fixed!!!) with sum=999 instead of totalsum and change to all have the same averagetype of wilders...so it is the same as the watchlist widget! BUT cannot use it because widget still cannot do it, so might as well use totalsum because gives all data

declare lower;


input MAlength = 50;

input averageType = AverageType.wilders;


def PPA = sum ((close - close [1]) / (ATR(10, averagetype)),999);


def PPAMA = MovingAverage (averageType, PPA, MAlength);


plot PPAhist = PPA - PPAMA;


plot zerobase = 0;


PPAhist.SetPaintingStrategy(paintingStrategy = PaintingStrategy.HISTOGRAM);


PPAhist.AssignValueColor(if PPA >= PPAMA then Color.GREEN else Color.RED);


PPAhist.SetLineWeight(3);

THINKSCRIPT PriceAsATRtrendHist (old and current)

#PriceAsATRtrend via Histogram (old) with flaws because different returns from when i put i to the watchlist widget

declare lower;

input MAlength = 50;
input averageType = AverageType.EXPONENTIAL;

def PPA = TotalSum (close - close [1]) / (ATR(10, AverageType.WILDERS));

def PPAMA = MovingAverage (averageType, PPA, MAlength);

plot PPAhist = PPA - PPAMA;

plot zerobase = 0;

PPAhist.SetPaintingStrategy(paintingStrategy = PaintingStrategy.HISTOGRAM);

PPAhist.AssignValueColor(if PPA >= PPAMA then Color.GREEN else Color.RED);

PPAhist.SetLineWeight(3);

Monday, April 4, 2016

Watchlist Scan Procedure

1. Widget:  BBC 2.0

2. HLP:  Current Candle at / near support > 0.70

3. Wave Volume: suggests bullish pop off support level

added 4/7

- widget - candle showing buying...usually needed an upday...but a reversal candle is also good such as a close way higher than it's low

updated 5/17/16
A) if super high volume on prior downwave but no new low, means selling climax and good time to buy, despite even no support there
B) check with PMAATR to see if a strong day....seems more important than HLP as HLP may miss the doji days even if they gave a big gain such as a gap up...
- PMAATR > 1 means it was quite bullish...out of the ordinary bullish so start the scan there ..and then > 0.7 is okay too

Widget edit - BidAsk Filter

made a custom quote of BidAsk Spread and so deleted all stocks with a bid/ask spread or $0.03 or higher

Stops

4/14/16 - 9:36 pm

using ATRSTOP3X study...when to use each..no strict 100% rule, just general rules of thumb...
** this is for new stops..usually don't even have to do this..just leave with the old stop / original stop of entry minus 1 ATR stop
*** use this to find a new stop when i see any cause for danger from the prior candle + effort / reward widget study
**** not hard rule but think unless ZigZag lines change waves, it should stay at GREEN

GREEN ATR STOP - yesterday's candle still made a gain but the candle closed off the highs...and worse if closer to the lows than the middle

YELLOW ATR STOP - yesterday's candle registers a loss and a sideways candle...

RED ATR STOP - yesterday's candle registered a loss and a very bearish candle such as closing at it's lows of the day...and even worse is if it closes way lower than the open too

 _________________________________________________

From 2/29, 5:42pm - actually me trying to fix the ATRBBC stop is good afterall..when i use daily data, not hourly...so i am trying to fix it fully...cause it would be very very useful...so let's simplify it:

if today's low is >= to today's stop price, then turn black
low [0] >= BBCstop

today's stop needs to be the same color as the BBC signal
if BBCsignal [0], then assigncolor similar


if we are going higher...aka today's low is higher than yesterday's low,
low [0] <= low [1],
then use yesterday's stop (easy version)
THEN BBCstop = BBCstop [1]

 if we are going higher...aka today's low is higher than yesterday's low
 low [0] <= low [1]
and BBCsignal is >= than yesterday's signal,
 AND bbcsignal [0] >= bbcsignal [1]
 then use highest of today or yesterday's stop (harder version)
THEN max (bbcsignal[0], bbcsignal[1])