Potential Breakout Arrow Plots Indicator for ThinkorSwim

What should I focus on making next

  • an exit indicator

    Votes: 37 39.4%
  • improving signals

    Votes: 39 41.5%
  • making new signals

    Votes: 10 10.6%
  • a sell calls plot

    Votes: 8 8.5%

  • Total voters
    94
Wednesday night I will release a watchlist to test this. It will be stocks that scanned as breaking out as well as considering other ta. After they all receive sell signals I'll check back in. It could be 1-2 weeks out. Unfortunately it is a weird market environment to test a buy side indicator in but hopefully it should still prevail.
 
Here is the code for the Arrows, so you don't have to keep sharing your entire chart.


#_____________________________________________________________________________________
comboupstrongstrongstrong.setPaintingStrategy(paintingstrategy.BOOLEAN_ARROW_UP);
comboupstrongstrongstrong.setdefaultColor(createcolor(255,255,255));
comboupstrongstrongstrong.SetLineWeight(5);
comboupstrongstrong.setPaintingStrategy(paintingstrategy.BOOLEAN_ARROW_UP);
comboupstrongstrong.setdefaultColor(createcolor(255,255,255));
comboupstrongstrong.SetLineWeight(2);
midcrossgapup.setPaintingStrategy(paintingstrategy.BOOLEAN_ARROW_UP);
midcrossgapup.setdefaultColor(createcolor(72,71,135));
midcrossgapup.SetLineWeight(1);
midcrossgapdown.setPaintingStrategy(paintingstrategy.BOOLEAN_ARROW_DOWN);
midcrossgapdown.setdefaultColor(createcolor(72,71,135));
midcrossgapdown.SetLineWeight(1);
comboupstrong.setPaintingStrategy(paintingstrategy.BOOLEAN_ARROW_UP);
comboupstrong.setdefaultColor(createcolor(230,190,0));
comboupstrong.SetLineWeight(1);
goodsetup.setPaintingStrategy(paintingstrategy.BOOLEAN_ARROW_UP);
goodsetup.setdefaultColor(createcolor(255,126,0));
goodsetup.SetLineWeight(5);
#____________________________________________________________________________________
 
Here is the code for the Arrows, so you don't have to keep sharing your entire chart.


#_____________________________________________________________________________________
comboupstrongstrongstrong.setPaintingStrategy(paintingstrategy.BOOLEAN_ARROW_UP);
comboupstrongstrongstrong.setdefaultColor(createcolor(255,255,255));
comboupstrongstrongstrong.SetLineWeight(5);
comboupstrongstrong.setPaintingStrategy(paintingstrategy.BOOLEAN_ARROW_UP);
comboupstrongstrong.setdefaultColor(createcolor(255,255,255));
comboupstrongstrong.SetLineWeight(2);
midcrossgapup.setPaintingStrategy(paintingstrategy.BOOLEAN_ARROW_UP);
midcrossgapup.setdefaultColor(createcolor(72,71,135));
midcrossgapup.SetLineWeight(1);
midcrossgapdown.setPaintingStrategy(paintingstrategy.BOOLEAN_ARROW_DOWN);
midcrossgapdown.setdefaultColor(createcolor(72,71,135));
midcrossgapdown.SetLineWeight(1);
comboupstrong.setPaintingStrategy(paintingstrategy.BOOLEAN_ARROW_UP);
comboupstrong.setdefaultColor(createcolor(230,190,0));
comboupstrong.SetLineWeight(1);
goodsetup.setPaintingStrategy(paintingstrategy.BOOLEAN_ARROW_UP);
goodsetup.setdefaultColor(createcolor(255,126,0));
goodsetup.SetLineWeight(5);
#____________________________________________________________________________________

Thanks except the chart I shared was plotting using a different indicator. I'll add this to the breakout arrow code.
 
Would love to test this but for some reason I can only get it to pull up a separate chart with the arrows. When I put the codebase into my studies as a new indicator I only see the upper and lower red and blue bands show up. Anybody know what I might be missing? @YungTraderFromMontana @horserider
 
Thanks except the chart I shared was plotting using a different indicator. I'll add this to the breakout arrow code.
hi
Do we've any scanner option to pick Cyan / Magenta candle stocks only? or else any option to add into watch list for that day candle colour Cyan as 0 & Magenta as 1 & rest no value kind.

@BenTen Any chance to update this query?
 
Last edited:
Hi, coming to this study late now but it seems incredible from what I've used it for so far -- one thing I noticed is that there are multiple combo up "levels", or varying strength signals for long plays, but not for shorting. Is there a reason for this? Or would this be easy to update for?
 
So, answering my own question from the last post with an update -- I've made a few changes to the original code, adding a moving average option for the inertia calculation and also adding levels to the signal strength for the downside, like the upside signals have. I personally trade SPY/SPX options on the 3 minute time frame, and tinkered enough until I found the settings that work best for me. Here's how it performed on SPX today:
u7GL3h2.png


Note that I've also hidden the midline and upper/lower bands as a personal preference, but they are certainly still there; I just don't like too many things covering my candles. Here are the settings that I personally use for this as well -- I assume that different time frames will need different sensitivities, but I honestly haven't checked since I only trade scalps and short intraday swings.

a3UYdVY.png


And here is the code! If anyone is inspired to make any further edits or improvements, please let me know -- I've been impressed with this indicator from when I first saw it, huge props to @YungTraderFromMontana for his work.

Code:
## Edit to the gap study code from thinkscript.com
## Originally made by yungtraderfrommontana
## Edited by Chemmy

input conso = .02;
input outo = .01;
input coc = close;
input linRegLength = 21;
input smLength = 3;
input displace2 = 0;
input length = 10;
def bn = BarNumber();
def lastBar = HighestAll(if IsNaN(close) then 0 else bn);
def offset = Min(length - 1, lastBar - bn);
def swingLow = low < Lowest(low[1], length - 1) and low == GetValue(Lowest(low, length), -offset);
# identify the very last swing low point
def lowPointOneBarNumber = HighestAll(if swingLow then bn else 0);
def lowPointOneValue = if bn == lowPointOneBarNumber then low else lowPointOneValue[1];
plot low1 = if bn < lowPointOneBarNumber then Double.NaN else lowPointOneValue;
low1.SetDefaultColor(Color.LIGHT_RED);

# SWING HIGH
# define swing high points
def swingHigh = high > Highest(high[1], length - 1) and high == GetValue(Highest(high, length), -offset);
# identify the very last swing high point
def highPointOneBarNumber = HighestAll(if swingHigh then bn else 0);
def highPointOneValue = if bn == highPointOneBarNumber then high else highPointOneValue[1];
plot high1 = if bn < highPointOneBarNumber then Double.NaN else highPointOneValue;
high1.SetDefaultColor(Color.CYAN);


# ADJUST CANDLE COLORS
# change candle colors just to make it easier to see what we are working with
#AssignPriceColor(if swingLow then Color.cyan else if swingHigh then Color.mageNTA else Color.current);
# End Swing High and Swing Low
 

def value = Average(Inertia(coc[-displace2], linRegLength), smLength);
def error = Average(sterr(coc[-displace2], linRegLength), smLength);
def MiddleLine = value;
def total = if close < open then (high + 2 * low + close) / 2 else if close > open then (2 * high + low + close) / 2 else (high + low + 2 * close) / 2;
def UpperPr = total[1] - low[1];
def LowerPr = total[1] - high[1];

def price = close;
def length4 = 10;
def displace = 0;
def AvgExp = ExpAverage(price[-displace], length4);
def length6 = 48.5;
def AvgExp2 = ExpAverage(price[-displace], length6);
def c = close;

def length2 = 30;
def calclength2 = 5;
def smoothlength2 = 3;
input agg = AggregationPeriod.DAY;

def o10 = open(period = agg);
def c10 = close(period = agg);
def data = fold i = 0 to length2
           with s
           do s + (if c10 > GetValue(o10, i)
                   then 1
                   else if c10 < GetValue(o10, i)
                        then - 1
                        else 0);

input averagetype = AverageType.EXPONENTIAL;

def EMA5 = MovingAverage(averagetype, data, calclength2);
def Main = MovingAverage(averagetype, EMA5, smoothLength2);
def Signal = MovingAverage(averagetype, Main, smoothLength2);

def  ob3 = if IsNaN(c10) then Double.NaN else Round(length2 * .7);

input BuyEntry = 3;
input SellEntry = 3;

plot QB = Highest(high, BuyEntry);
plot QS = Lowest(low, SellEntry);

plot midline = (qs[1]+qb[1])/2;

plot differencechange = ((main-signal) < 1) and ((main - signal) > -1)  and (main < ob3);
 

plot comboupstrongest = (close > qb[1]) and (c[1] < qb[2]) and (((open - qb[1])/100) < outo) and (((qb[1] - Avgexp)/100) < conso) and (close < midline[1]);

#AddVerticalLine(comboupstrongest, "", Color.Green, curve.SHORT_DASH);

plot comboupstrong = (close > qb[1]) and (c[1] < qb[2]) and (((open - qb[1])/100) < outo) and (((qb[1] - Avgexp)/100) < conso) and (open[1] or open[2] or open[3] < midline) and comboupstrongest is false and (open < qb[1]) and (open[1] > Qs[2]) and (close[1] < midline[2]);

plot comboupweak = (close > qb[1]) and (close[1] < qb[2]) and (((open - qb[1])/100) < outo) and (((qb[1] - Avgexp)/100) < conso)  and comboupstrongest is false and comboupstrong is false and (close > open) and (low < middleline) and (close > open);

plot midcrossgapup = (((open < midline) and ((close > midline)) or ((close[1] < midline[2])) and (open > midline[1]))) and (close > open) and (differencechange) and (close[1] < qb[2]) and (close > upperpr);

plot combodownstrongest = (qs[1] > qs[2]) and (close < qs[1]) and (c[1] > qs[2]) and (((qs[1] - open)/100) < outo) and (((Avgexp - qs[1])/100) < conso);

plot combodownstrong = (close < qs[1]) and (c[1] > qs[2]) and (((qs[1] - open)/100) < outo) and (((Avgexp - qs[1])/100) < conso) and (open[1] or open[2] or open[3] > midline) and combodownstrongest is false and (close < qs[1]) and (close[1] < QB[2]) and (close[1] > midline[2]);

plot combodownweak = (close < qs[1]) and (c[1] > qs[2]) and (((qs[1] - open)/100) < outo) and (((Avgexp - qs[1])/100) < conso)  and combodownstrong is false and combodownstrongest is false and (close < open) and (low > middleline);

plot midcrossgapdown = (((open > midline) and ((close < midline)) or ((close[1] > midline[2])) and (open < midline[1]))) and (close < open) and (close[1] > qs[2]) and (close < lowerpr);

plot goodsetup =((swinglow or swinglow[1] or swinglow[2])) and ((comboupstrong or comboupstrongest or midcrossgapup));

plot sellputs = (lowerpr < QS);

Shareable link: http://tos.mx/PeA2NQk
 
So, answering my own question from the last post with an update -- I've made a few changes to the original code, adding a moving average option for the inertia calculation and also adding levels to the signal strength for the downside, like the upside signals have. I personally trade SPY/SPX options on the 3 minute time frame, and tinkered enough until I found the settings that work best for me. Here's how it performed on SPX today:
u7GL3h2.png


Note that I've also hidden the midline and upper/lower bands as a personal preference, but they are certainly still there; I just don't like too many things covering my candles. Here are the settings that I personally use for this as well -- I assume that different time frames will need different sensitivities, but I honestly haven't checked since I only trade scalps and short intraday swings.

a3UYdVY.png


And here is the code! If anyone is inspired to make any further edits or improvements, please let me know -- I've been impressed with this indicator from when I first saw it, huge props to @YungTraderFromMontana for his work.

Code:
## Edit to the gap study code from thinkscript.com
## Originally made by yungtraderfrommontana
## Edited by Chemmy

input conso = .02;
input outo = .01;
input coc = close;
input linRegLength = 21;
input smLength = 3;
input displace2 = 0;
input length = 10;
def bn = BarNumber();
def lastBar = HighestAll(if IsNaN(close) then 0 else bn);
def offset = Min(length - 1, lastBar - bn);
def swingLow = low < Lowest(low[1], length - 1) and low == GetValue(Lowest(low, length), -offset);
# identify the very last swing low point
def lowPointOneBarNumber = HighestAll(if swingLow then bn else 0);
def lowPointOneValue = if bn == lowPointOneBarNumber then low else lowPointOneValue[1];
plot low1 = if bn < lowPointOneBarNumber then Double.NaN else lowPointOneValue;
low1.SetDefaultColor(Color.LIGHT_RED);

# SWING HIGH
# define swing high points
def swingHigh = high > Highest(high[1], length - 1) and high == GetValue(Highest(high, length), -offset);
# identify the very last swing high point
def highPointOneBarNumber = HighestAll(if swingHigh then bn else 0);
def highPointOneValue = if bn == highPointOneBarNumber then high else highPointOneValue[1];
plot high1 = if bn < highPointOneBarNumber then Double.NaN else highPointOneValue;
high1.SetDefaultColor(Color.CYAN);


# ADJUST CANDLE COLORS
# change candle colors just to make it easier to see what we are working with
#AssignPriceColor(if swingLow then Color.cyan else if swingHigh then Color.mageNTA else Color.current);
# End Swing High and Swing Low
 

def value = Average(Inertia(coc[-displace2], linRegLength), smLength);
def error = Average(sterr(coc[-displace2], linRegLength), smLength);
def MiddleLine = value;
def total = if close < open then (high + 2 * low + close) / 2 else if close > open then (2 * high + low + close) / 2 else (high + low + 2 * close) / 2;
def UpperPr = total[1] - low[1];
def LowerPr = total[1] - high[1];

def price = close;
def length4 = 10;
def displace = 0;
def AvgExp = ExpAverage(price[-displace], length4);
def length6 = 48.5;
def AvgExp2 = ExpAverage(price[-displace], length6);
def c = close;

def length2 = 30;
def calclength2 = 5;
def smoothlength2 = 3;
input agg = AggregationPeriod.DAY;

def o10 = open(period = agg);
def c10 = close(period = agg);
def data = fold i = 0 to length2
           with s
           do s + (if c10 > GetValue(o10, i)
                   then 1
                   else if c10 < GetValue(o10, i)
                        then - 1
                        else 0);

input averagetype = AverageType.EXPONENTIAL;

def EMA5 = MovingAverage(averagetype, data, calclength2);
def Main = MovingAverage(averagetype, EMA5, smoothLength2);
def Signal = MovingAverage(averagetype, Main, smoothLength2);

def  ob3 = if IsNaN(c10) then Double.NaN else Round(length2 * .7);

input BuyEntry = 3;
input SellEntry = 3;

plot QB = Highest(high, BuyEntry);
plot QS = Lowest(low, SellEntry);

plot midline = (qs[1]+qb[1])/2;

plot differencechange = ((main-signal) < 1) and ((main - signal) > -1)  and (main < ob3);
 

plot comboupstrongest = (close > qb[1]) and (c[1] < qb[2]) and (((open - qb[1])/100) < outo) and (((qb[1] - Avgexp)/100) < conso) and (close < midline[1]);

#AddVerticalLine(comboupstrongest, "", Color.Green, curve.SHORT_DASH);

plot comboupstrong = (close > qb[1]) and (c[1] < qb[2]) and (((open - qb[1])/100) < outo) and (((qb[1] - Avgexp)/100) < conso) and (open[1] or open[2] or open[3] < midline) and comboupstrongest is false and (open < qb[1]) and (open[1] > Qs[2]) and (close[1] < midline[2]);

plot comboupweak = (close > qb[1]) and (close[1] < qb[2]) and (((open - qb[1])/100) < outo) and (((qb[1] - Avgexp)/100) < conso)  and comboupstrongest is false and comboupstrong is false and (close > open) and (low < middleline) and (close > open);

plot midcrossgapup = (((open < midline) and ((close > midline)) or ((close[1] < midline[2])) and (open > midline[1]))) and (close > open) and (differencechange) and (close[1] < qb[2]) and (close > upperpr);

plot combodownstrongest = (qs[1] > qs[2]) and (close < qs[1]) and (c[1] > qs[2]) and (((qs[1] - open)/100) < outo) and (((Avgexp - qs[1])/100) < conso);

plot combodownstrong = (close < qs[1]) and (c[1] > qs[2]) and (((qs[1] - open)/100) < outo) and (((Avgexp - qs[1])/100) < conso) and (open[1] or open[2] or open[3] > midline) and combodownstrongest is false and (close < qs[1]) and (close[1] < QB[2]) and (close[1] > midline[2]);

plot combodownweak = (close < qs[1]) and (c[1] > qs[2]) and (((qs[1] - open)/100) < outo) and (((Avgexp - qs[1])/100) < conso)  and combodownstrong is false and combodownstrongest is false and (close < open) and (low > middleline);

plot midcrossgapdown = (((open > midline) and ((close < midline)) or ((close[1] > midline[2])) and (open < midline[1]))) and (close < open) and (close[1] > qs[2]) and (close < lowerpr);

plot goodsetup =((swinglow or swinglow[1] or swinglow[2])) and ((comboupstrong or comboupstrongest or midcrossgapup));

plot sellputs = (lowerpr < QS);

Shareable link: http://tos.mx/PeA2NQk

Hi Chemmy, where are the buy/sell arrows coming from on your post? I can't seem to see them when I use the script you posted
 
even i cannot see arrows after with the script or link
Sorry all, I've been away and busy for a bit now. These arrows never showed because the original code didn't specify for the signals to be showed as arrows, and you had to manually change the painting strategy in the settings. Here's the adjusted code, this should be what you're all looking for:

Code:
## Edit to the gap study code from thinkscript.com
## Originally made by yungtraderfrommontana
## Edited by Chemmy

input conso = .02;
input outo = .01;
input coc = close;
input linRegLength = 21;
input smLength = 3;
input displace2 = 0;
input length = 10;
def bn = BarNumber();
def lastBar = HighestAll(if IsNaN(close) then 0 else bn);
def offset = Min(length - 1, lastBar - bn);
def swingLow = low < Lowest(low[1], length - 1) and low == GetValue(Lowest(low, length), -offset);
# identify the very last swing low point
def lowPointOneBarNumber = HighestAll(if swingLow then bn else 0);
def lowPointOneValue = if bn == lowPointOneBarNumber then low else lowPointOneValue[1];
plot low1 = if bn < lowPointOneBarNumber then Double.NaN else lowPointOneValue;
low1.SetDefaultColor(Color.LIGHT_RED);

# SWING HIGH
# define swing high points
def swingHigh = high > Highest(high[1], length - 1) and high == GetValue(Highest(high, length), -offset);
# identify the very last swing high point
def highPointOneBarNumber = HighestAll(if swingHigh then bn else 0);
def highPointOneValue = if bn == highPointOneBarNumber then high else highPointOneValue[1];
plot high1 = if bn < highPointOneBarNumber then Double.NaN else highPointOneValue;
high1.SetDefaultColor(Color.CYAN);


# ADJUST CANDLE COLORS
# change candle colors just to make it easier to see what we are working with
#AssignPriceColor(if swingLow then Color.cyan else if swingHigh then Color.mageNTA else Color.current);
# End Swing High and Swing Low
 

def value = Average(Inertia(coc[-displace2], linRegLength), smLength);
def error = Average(sterr(coc[-displace2], linRegLength), smLength);
def MiddleLine = value;
def total = if close < open then (high + 2 * low + close) / 2 else if close > open then (2 * high + low + close) / 2 else (high + low + 2 * close) / 2;
def UpperPr = total[1] - low[1];
def LowerPr = total[1] - high[1];

def price = close;
def length4 = 10;
def displace = 0;
def AvgExp = ExpAverage(price[-displace], length4);
def length6 = 48.5;
def AvgExp2 = ExpAverage(price[-displace], length6);
def c = close;

def length2 = 30;
def calclength2 = 5;
def smoothlength2 = 3;
input agg = AggregationPeriod.DAY;

def o10 = open(period = agg);
def c10 = close(period = agg);
def data = fold i = 0 to length2
           with s
           do s + (if c10 > GetValue(o10, i)
                   then 1
                   else if c10 < GetValue(o10, i)
                        then - 1
                        else 0);

input averagetype = AverageType.EXPONENTIAL;

def EMA5 = MovingAverage(averagetype, data, calclength2);
def Main = MovingAverage(averagetype, EMA5, smoothLength2);
def Signal = MovingAverage(averagetype, Main, smoothLength2);

def  ob3 = if IsNaN(c10) then Double.NaN else Round(length2 * .7);

input BuyEntry = 3;
input SellEntry = 3;

plot QB = Highest(high, BuyEntry);
plot QS = Lowest(low, SellEntry);

plot midline = (qs[1]+qb[1])/2;

plot differencechange = ((main-signal) < 1) and ((main - signal) > -1)  and (main < ob3);
 

plot comboupstrongest = (close > qb[1]) and (c[1] < qb[2]) and (((open - qb[1])/100) < outo) and (((qb[1] - Avgexp)/100) < conso) and (close < midline[1]);
comboupstrongest.setpaintingstrategy(paintingstrategy.boolean_arrow_up);
comboupstrongest.setdefaultcolor(color.green);
comboupstrongest.setlineweight(5);

#AddVerticalLine(comboupstrongest, "", Color.Green, curve.SHORT_DASH);

plot comboupstrong = (close > qb[1]) and (c[1] < qb[2]) and (((open - qb[1])/100) < outo) and (((qb[1] - Avgexp)/100) < conso) and (open[1] or open[2] or open[3] < midline) and comboupstrongest is false and (open < qb[1]) and (open[1] > Qs[2]) and (close[1] < midline[2]);
comboupstrong.setpaintingstrategy(paintingstrategy.boolean_arrow_up);
comboupstrong.setdefaultcolor(color.green);
comboupstrong.setlineweight(3);

plot comboupweak = (close > qb[1]) and (close[1] < qb[2]) and (((open - qb[1])/100) < outo) and (((qb[1] - Avgexp)/100) < conso)  and comboupstrongest is false and comboupstrong is false and (close > open) and (low < middleline) and (close > open);
comboupweak.setpaintingstrategy(paintingstrategy.boolean_arrow_up);
comboupweak.setdefaultcolor(color.green);
comboupweak.setlineweight(1);

plot midcrossgapup = (((open < midline) and ((close > midline)) or ((close[1] < midline[2])) and (open > midline[1]))) and (close > open) and (differencechange) and (close[1] < qb[2]) and (close > upperpr);
midcrossgapup.setpaintingstrategy(paintingstrategy.points);
midcrossgapup.setdefaultcolor(color.green);

plot combodownstrongest = (qs[1] > qs[2]) and (close < qs[1]) and (c[1] > qs[2]) and (((qs[1] - open)/100) < outo) and (((Avgexp - qs[1])/100) < conso);
combodownstrongest.setpaintingstrategy(paintingstrategy.boolean_arrow_down);
combodownstrongest.setdefaultcolor(color.magenta);
combodownstrongest.setlineweight(5);

plot combodownstrong = (close < qs[1]) and (c[1] > qs[2]) and (((qs[1] - open)/100) < outo) and (((Avgexp - qs[1])/100) < conso) and (open[1] or open[2] or open[3] > midline) and combodownstrongest is false and (close < qs[1]) and (close[1] < QB[2]) and (close[1] > midline[2]);
combodownstrong.setpaintingstrategy(paintingstrategy.boolean_arrow_down);
combodownstrong.setdefaultcolor(color.magenta);
combodownstrong.setlineweight(3);

plot combodownweak = (close < qs[1]) and (c[1] > qs[2]) and (((qs[1] - open)/100) < outo) and (((Avgexp - qs[1])/100) < conso)  and combodownstrong is false and combodownstrongest is false and (close < open) and (low > middleline);
combodownweak.setpaintingstrategy(paintingstrategy.boolean_arrow_down);
combodownweak.setdefaultcolor(color.magenta);
combodownweak.setlineweight(1);

plot midcrossgapdown = (((open > midline) and ((close < midline)) or ((close[1] > midline[2])) and (open < midline[1]))) and (close < open) and (close[1] > qs[2]) and (close < lowerpr);
midcrossgapdown.setpaintingstrategy(paintingstrategy.points);
midcrossgapdown.setdefaultcolor(color.magenta);

plot goodsetup =((swinglow or swinglow[1] or swinglow[2])) and ((comboupstrong or comboupstrongest or midcrossgapup));
goodsetup.setpaintingstrategy(paintingstrategy.points);
goodsetup.setdefaultcolor(color.yellow);

plot sellputs = (lowerpr < QS);
 
Sorry all, I've been away and busy for a bit now. These arrows never showed because the original code didn't specify for the signals to be showed as arrows, and you had to manually change the painting strategy in the settings. Here's the adjusted code, this should be what you're all looking for:

Code:
## Edit to the gap study code from thinkscript.com
## Originally made by yungtraderfrommontana
## Edited by Chemmy

input conso = .02;
input outo = .01;
input coc = close;
input linRegLength = 21;
input smLength = 3;
input displace2 = 0;
input length = 10;
def bn = BarNumber();
def lastBar = HighestAll(if IsNaN(close) then 0 else bn);
def offset = Min(length - 1, lastBar - bn);
def swingLow = low < Lowest(low[1], length - 1) and low == GetValue(Lowest(low, length), -offset);
# identify the very last swing low point
def lowPointOneBarNumber = HighestAll(if swingLow then bn else 0);
def lowPointOneValue = if bn == lowPointOneBarNumber then low else lowPointOneValue[1];
plot low1 = if bn < lowPointOneBarNumber then Double.NaN else lowPointOneValue;
low1.SetDefaultColor(Color.LIGHT_RED);

# SWING HIGH
# define swing high points
def swingHigh = high > Highest(high[1], length - 1) and high == GetValue(Highest(high, length), -offset);
# identify the very last swing high point
def highPointOneBarNumber = HighestAll(if swingHigh then bn else 0);
def highPointOneValue = if bn == highPointOneBarNumber then high else highPointOneValue[1];
plot high1 = if bn < highPointOneBarNumber then Double.NaN else highPointOneValue;
high1.SetDefaultColor(Color.CYAN);


# ADJUST CANDLE COLORS
# change candle colors just to make it easier to see what we are working with
#AssignPriceColor(if swingLow then Color.cyan else if swingHigh then Color.mageNTA else Color.current);
# End Swing High and Swing Low
 

def value = Average(Inertia(coc[-displace2], linRegLength), smLength);
def error = Average(sterr(coc[-displace2], linRegLength), smLength);
def MiddleLine = value;
def total = if close < open then (high + 2 * low + close) / 2 else if close > open then (2 * high + low + close) / 2 else (high + low + 2 * close) / 2;
def UpperPr = total[1] - low[1];
def LowerPr = total[1] - high[1];

def price = close;
def length4 = 10;
def displace = 0;
def AvgExp = ExpAverage(price[-displace], length4);
def length6 = 48.5;
def AvgExp2 = ExpAverage(price[-displace], length6);
def c = close;

def length2 = 30;
def calclength2 = 5;
def smoothlength2 = 3;
input agg = AggregationPeriod.DAY;

def o10 = open(period = agg);
def c10 = close(period = agg);
def data = fold i = 0 to length2
           with s
           do s + (if c10 > GetValue(o10, i)
                   then 1
                   else if c10 < GetValue(o10, i)
                        then - 1
                        else 0);

input averagetype = AverageType.EXPONENTIAL;

def EMA5 = MovingAverage(averagetype, data, calclength2);
def Main = MovingAverage(averagetype, EMA5, smoothLength2);
def Signal = MovingAverage(averagetype, Main, smoothLength2);

def  ob3 = if IsNaN(c10) then Double.NaN else Round(length2 * .7);

input BuyEntry = 3;
input SellEntry = 3;

plot QB = Highest(high, BuyEntry);
plot QS = Lowest(low, SellEntry);

plot midline = (qs[1]+qb[1])/2;

plot differencechange = ((main-signal) < 1) and ((main - signal) > -1)  and (main < ob3);
 

plot comboupstrongest = (close > qb[1]) and (c[1] < qb[2]) and (((open - qb[1])/100) < outo) and (((qb[1] - Avgexp)/100) < conso) and (close < midline[1]);
comboupstrongest.setpaintingstrategy(paintingstrategy.boolean_arrow_up);
comboupstrongest.setdefaultcolor(color.green);
comboupstrongest.setlineweight(5);

#AddVerticalLine(comboupstrongest, "", Color.Green, curve.SHORT_DASH);

plot comboupstrong = (close > qb[1]) and (c[1] < qb[2]) and (((open - qb[1])/100) < outo) and (((qb[1] - Avgexp)/100) < conso) and (open[1] or open[2] or open[3] < midline) and comboupstrongest is false and (open < qb[1]) and (open[1] > Qs[2]) and (close[1] < midline[2]);
comboupstrong.setpaintingstrategy(paintingstrategy.boolean_arrow_up);
comboupstrong.setdefaultcolor(color.green);
comboupstrong.setlineweight(3);

plot comboupweak = (close > qb[1]) and (close[1] < qb[2]) and (((open - qb[1])/100) < outo) and (((qb[1] - Avgexp)/100) < conso)  and comboupstrongest is false and comboupstrong is false and (close > open) and (low < middleline) and (close > open);
comboupweak.setpaintingstrategy(paintingstrategy.boolean_arrow_up);
comboupweak.setdefaultcolor(color.green);
comboupweak.setlineweight(1);

plot midcrossgapup = (((open < midline) and ((close > midline)) or ((close[1] < midline[2])) and (open > midline[1]))) and (close > open) and (differencechange) and (close[1] < qb[2]) and (close > upperpr);
midcrossgapup.setpaintingstrategy(paintingstrategy.points);
midcrossgapup.setdefaultcolor(color.green);

plot combodownstrongest = (qs[1] > qs[2]) and (close < qs[1]) and (c[1] > qs[2]) and (((qs[1] - open)/100) < outo) and (((Avgexp - qs[1])/100) < conso);
combodownstrongest.setpaintingstrategy(paintingstrategy.boolean_arrow_down);
combodownstrongest.setdefaultcolor(color.magenta);
combodownstrongest.setlineweight(5);

plot combodownstrong = (close < qs[1]) and (c[1] > qs[2]) and (((qs[1] - open)/100) < outo) and (((Avgexp - qs[1])/100) < conso) and (open[1] or open[2] or open[3] > midline) and combodownstrongest is false and (close < qs[1]) and (close[1] < QB[2]) and (close[1] > midline[2]);
combodownstrong.setpaintingstrategy(paintingstrategy.boolean_arrow_down);
combodownstrong.setdefaultcolor(color.magenta);
combodownstrong.setlineweight(3);

plot combodownweak = (close < qs[1]) and (c[1] > qs[2]) and (((qs[1] - open)/100) < outo) and (((Avgexp - qs[1])/100) < conso)  and combodownstrong is false and combodownstrongest is false and (close < open) and (low > middleline);
combodownweak.setpaintingstrategy(paintingstrategy.boolean_arrow_down);
combodownweak.setdefaultcolor(color.magenta);
combodownweak.setlineweight(1);

plot midcrossgapdown = (((open > midline) and ((close < midline)) or ((close[1] > midline[2])) and (open < midline[1]))) and (close < open) and (close[1] > qs[2]) and (close < lowerpr);
midcrossgapdown.setpaintingstrategy(paintingstrategy.points);
midcrossgapdown.setdefaultcolor(color.magenta);

plot goodsetup =((swinglow or swinglow[1] or swinglow[2])) and ((comboupstrong or comboupstrongest or midcrossgapup));
goodsetup.setpaintingstrategy(paintingstrategy.points);
goodsetup.setdefaultcolor(color.yellow);

plot sellputs = (lowerpr < QS);
Thanks, but do these arrows reprint at all??
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
233 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top