The Big Four Chart SetUp For ThinkOrSwim

Thanks for taking interest in this strategy! I think this part of the script I posted in my previous post would allow you to adjust how many parts you want to agree for a buy/sell signal:

input Confirmation_Factor=3
def Agreement level = condition 1+condition 2+condition 3+condition 4
def Agreement level = condition 1+condition 2+condition 3+condition 4

I'll work on a draft script over the weekend to see if my idea of creating the script would actually work or not. @MerryDay thanks for creating a new thread for this. I guess the name for this could be "The Big 4 Indicator". If @TradingNumbers or anyone else wants a different name, feel free to call it whatever you want.
Yep, sorry, didn’t pay attention there. That would do it.
 

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

First version...Let me know your thoughts @GiantBull. Setting confirmation to 4 eliminates some of the chop.

Code:
# The Big Four Indicator
# https://usethinkscript.com/threads/the-big-four-chart-setup.14711/
# v1.0 - GiantBull and TradingNumbers

# AK Trend

input aktrend_input1 = 3;
input aktrend_input2 = 8;
input aktrend_price = close;

def aktrend_fastmaa = MovAvgExponential(aktrend_price, aktrend_input1);
def aktrend_fastmab = MovAvgExponential(aktrend_price, aktrend_input2);
def aktrend_bspread = (aktrend_fastmaa - aktrend_fastmab) * 1.001;

def cond1_UP = if aktrend_bspread > 0 then 1 else 0;
def cond1_DN = if aktrend_bspread <= 0 then -1 else 0;

# ZSCORE

input zscore_price = close;
input zscore_length = 20;
input zscore_ZavgLength = 20;

def zscore_oneSD = StDev(zscore_price, zscore_length);
def zscore_avgClose = SimpleMovingAvg(zscore_price, zscore_length);
def zscore_ofoneSD = zscore_oneSD * zscore_price[1];
def zscore_Zscorevalue = ((zscore_price - zscore_avgClose) / zscore_oneSD);
def zscore_avgZv = Average(zscore_Zscorevalue, 20);
def zscore_Zscore = ((zscore_price - zscore_avgClose) / zscore_oneSD);
def zscore_avgZscore = Average(zscore_Zscorevalue, zscore_ZavgLength);

def cond2_UP = if zscore_Zscore > 0 then 1 else 0;
def cond2_DN = if zscore_Zscore <= 0 then -1 else 0;

# Ehlers

input ehlers_length = 34;

def ehlers_price = (high + low) / 2;
def ehlers_coeff = ehlers_length * ehlers_price * ehlers_price - 2 * ehlers_price * Sum(ehlers_price, ehlers_length)[1] + Sum(ehlers_price * ehlers_price, ehlers_length)[1];
def ehlers_Ehlers = Sum(ehlers_coeff * ehlers_price, ehlers_length) / Sum(ehlers_coeff, ehlers_length);

def cond3_UP = if close > ehlers_Ehlers then 1 else 0;
def cond3_DN = if close <= ehlers_Ehlers then -1 else 0;

# Anchored Momentum

input amom_src = close;
input amom_MomentumPeriod = 10;
input amom_SignalPeriod = 8;
input amom_SmoothMomentum = no;
input amom_SmoothingPeriod = 7;

def amom_p = 2 * amom_MomentumPeriod + 1;
def amom_t_amom = if amom_SmoothMomentum == yes then ExpAverage(amom_src, amom_SmoothingPeriod) else amom_src;
def amom_amom = 100 * ( (amom_t_amom / ( Average(amom_src, amom_p)) - 1));
def amom_amoms = Average(amom_amom, amom_SignalPeriod);


def cond4_UP = if amom_amom > 0 then 1 else 0;
def cond4_DN = if amom_amom <= 0 then -1 else 0;

# Strategy

input Strategy_Confirmation_Factor = 3;
input Strategy_ColoredCandlesOn = yes;
input Strategy_VerticalLinesOn = yes;

def cond_UP = cond1_UP + cond2_UP + cond3_UP + cond4_UP;
def cond_DN = cond1_DN + cond2_DN + cond3_DN + cond4_DN;

def direction = if cond_UP >= Strategy_Confirmation_Factor then 1 else if cond_DN <= -Strategy_Confirmation_Factor then -1 else direction[1];
def signal_up = direction == 1 and direction[1] < 1;
def signal_dn = direction == -1 and direction[1] > -1;

AssignPriceColor(if Strategy_ColoredCandlesOn then if direction == 1 then Color.LIGHT_GREEN else if direction == -1 then Color.RED else Color.GRAY else Color.CURRENT);

AddVerticalLine(Strategy_VerticalLinesOn and signal_up, "Buy", Color.LIGHT_GREEN);
AddVerticalLine(Strategy_VerticalLinesOn and signal_dn, "Sell", Color.RED);

Alert(signal_up, "Buy", Alert.BAR, Sound.DING);
Alert(signal_dn, "Sell", Alert.BAR, Sound.DING);

21keYPg.png
 
Hiding the vertical lines by default and added arrows.

Code:
# The Big Four Indicator
# https://usethinkscript.com/threads/the-big-four-chart-setup.14711/
# v1.0 - GiantBull and TradingNumbers
# v1.1 - TradingNumbers - hiding vertical lines by ddefault and added arrows

# AK Trend

input aktrend_input1 = 3;
input aktrend_input2 = 8;
input aktrend_price = close;

def aktrend_fastmaa = MovAvgExponential(aktrend_price, aktrend_input1);
def aktrend_fastmab = MovAvgExponential(aktrend_price, aktrend_input2);
def aktrend_bspread = (aktrend_fastmaa - aktrend_fastmab) * 1.001;

def cond1_UP = if aktrend_bspread > 0 then 1 else 0;
def cond1_DN = if aktrend_bspread <= 0 then -1 else 0;

# ZSCORE

input zscore_price = close;
input zscore_length = 20;
input zscore_ZavgLength = 20;

def zscore_oneSD = StDev(zscore_price, zscore_length);
def zscore_avgClose = SimpleMovingAvg(zscore_price, zscore_length);
def zscore_ofoneSD = zscore_oneSD * zscore_price[1];
def zscore_Zscorevalue = ((zscore_price - zscore_avgClose) / zscore_oneSD);
def zscore_avgZv = Average(zscore_Zscorevalue, 20);
def zscore_Zscore = ((zscore_price - zscore_avgClose) / zscore_oneSD);
def zscore_avgZscore = Average(zscore_Zscorevalue, zscore_ZavgLength);

def cond2_UP = if zscore_Zscore > 0 then 1 else 0;
def cond2_DN = if zscore_Zscore <= 0 then -1 else 0;

# Ehlers

input ehlers_length = 34;

def ehlers_price = (high + low) / 2;
def ehlers_coeff = ehlers_length * ehlers_price * ehlers_price - 2 * ehlers_price * Sum(ehlers_price, ehlers_length)[1] + Sum(ehlers_price * ehlers_price, ehlers_length)[1];
def ehlers_Ehlers = Sum(ehlers_coeff * ehlers_price, ehlers_length) / Sum(ehlers_coeff, ehlers_length);

def cond3_UP = if close > ehlers_Ehlers then 1 else 0;
def cond3_DN = if close <= ehlers_Ehlers then -1 else 0;

# Anchored Momentum

input amom_src = close;
input amom_MomentumPeriod = 10;
input amom_SignalPeriod = 8;
input amom_SmoothMomentum = no;
input amom_SmoothingPeriod = 7;

def amom_p = 2 * amom_MomentumPeriod + 1;
def amom_t_amom = if amom_SmoothMomentum == yes then ExpAverage(amom_src, amom_SmoothingPeriod) else amom_src;
def amom_amom = 100 * ( (amom_t_amom / ( Average(amom_src, amom_p)) - 1));
def amom_amoms = Average(amom_amom, amom_SignalPeriod);


def cond4_UP = if amom_amom > 0 then 1 else 0;
def cond4_DN = if amom_amom <= 0 then -1 else 0;

# Strategy

input Strategy_Confirmation_Factor = 3;
input Strategy_ColoredCandlesOn = yes;
input Strategy_VerticalLinesOn = no;

def cond_UP = cond1_UP + cond2_UP + cond3_UP + cond4_UP;
def cond_DN = cond1_DN + cond2_DN + cond3_DN + cond4_DN;

def direction = if cond_UP >= Strategy_Confirmation_Factor then 1 else if cond_DN <= -Strategy_Confirmation_Factor then -1 else direction[1];

plot signal_up = direction == 1 and direction[1] < 1;
signal_up.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
signal_up.SetDefaultColor(Color.WHITE);
signal_up.Hide();
signal_up.HideBubble();
signal_up.HideTitle();

plot signal_dn = direction == -1 and direction[1] > -1;
signal_dn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
signal_dn.SetDefaultColor(Color.WHITE);
signal_dn.Hide();
signal_dn.HideBubble();
signal_dn.HideTitle();

AssignPriceColor(if Strategy_ColoredCandlesOn then if direction == 1 then Color.LIGHT_GREEN else if direction == -1 then Color.RED else Color.GRAY else Color.CURRENT);

AddVerticalLine(Strategy_VerticalLinesOn and signal_up, "Buy", Color.LIGHT_GREEN);
AddVerticalLine(Strategy_VerticalLinesOn and signal_dn, "Sell", Color.RED);

Alert(signal_up, "Buy", Alert.BAR, Sound.DING);
Alert(signal_dn, "Sell", Alert.BAR, Sound.DING);
 
Hiding the vertical lines by default and added arrows.

Code:
# The Big Four Indicator
# https://usethinkscript.com/threads/the-big-four-chart-setup.14711/
# v1.0 - GiantBull and TradingNumbers
# v1.1 - TradingNumbers - hiding vertical lines by ddefault and added arrows

# AK Trend

input aktrend_input1 = 3;
input aktrend_input2 = 8;
input aktrend_price = close;

def aktrend_fastmaa = MovAvgExponential(aktrend_price, aktrend_input1);
def aktrend_fastmab = MovAvgExponential(aktrend_price, aktrend_input2);
def aktrend_bspread = (aktrend_fastmaa - aktrend_fastmab) * 1.001;

def cond1_UP = if aktrend_bspread > 0 then 1 else 0;
def cond1_DN = if aktrend_bspread <= 0 then -1 else 0;

# ZSCORE

input zscore_price = close;
input zscore_length = 20;
input zscore_ZavgLength = 20;

def zscore_oneSD = StDev(zscore_price, zscore_length);
def zscore_avgClose = SimpleMovingAvg(zscore_price, zscore_length);
def zscore_ofoneSD = zscore_oneSD * zscore_price[1];
def zscore_Zscorevalue = ((zscore_price - zscore_avgClose) / zscore_oneSD);
def zscore_avgZv = Average(zscore_Zscorevalue, 20);
def zscore_Zscore = ((zscore_price - zscore_avgClose) / zscore_oneSD);
def zscore_avgZscore = Average(zscore_Zscorevalue, zscore_ZavgLength);

def cond2_UP = if zscore_Zscore > 0 then 1 else 0;
def cond2_DN = if zscore_Zscore <= 0 then -1 else 0;

# Ehlers

input ehlers_length = 34;

def ehlers_price = (high + low) / 2;
def ehlers_coeff = ehlers_length * ehlers_price * ehlers_price - 2 * ehlers_price * Sum(ehlers_price, ehlers_length)[1] + Sum(ehlers_price * ehlers_price, ehlers_length)[1];
def ehlers_Ehlers = Sum(ehlers_coeff * ehlers_price, ehlers_length) / Sum(ehlers_coeff, ehlers_length);

def cond3_UP = if close > ehlers_Ehlers then 1 else 0;
def cond3_DN = if close <= ehlers_Ehlers then -1 else 0;

# Anchored Momentum

input amom_src = close;
input amom_MomentumPeriod = 10;
input amom_SignalPeriod = 8;
input amom_SmoothMomentum = no;
input amom_SmoothingPeriod = 7;

def amom_p = 2 * amom_MomentumPeriod + 1;
def amom_t_amom = if amom_SmoothMomentum == yes then ExpAverage(amom_src, amom_SmoothingPeriod) else amom_src;
def amom_amom = 100 * ( (amom_t_amom / ( Average(amom_src, amom_p)) - 1));
def amom_amoms = Average(amom_amom, amom_SignalPeriod);


def cond4_UP = if amom_amom > 0 then 1 else 0;
def cond4_DN = if amom_amom <= 0 then -1 else 0;

# Strategy

input Strategy_Confirmation_Factor = 3;
input Strategy_ColoredCandlesOn = yes;
input Strategy_VerticalLinesOn = no;

def cond_UP = cond1_UP + cond2_UP + cond3_UP + cond4_UP;
def cond_DN = cond1_DN + cond2_DN + cond3_DN + cond4_DN;

def direction = if cond_UP >= Strategy_Confirmation_Factor then 1 else if cond_DN <= -Strategy_Confirmation_Factor then -1 else direction[1];

plot signal_up = direction == 1 and direction[1] < 1;
signal_up.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
signal_up.SetDefaultColor(Color.WHITE);
signal_up.Hide();
signal_up.HideBubble();
signal_up.HideTitle();

plot signal_dn = direction == -1 and direction[1] > -1;
signal_dn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
signal_dn.SetDefaultColor(Color.WHITE);
signal_dn.Hide();
signal_dn.HideBubble();
signal_dn.HideTitle();

AssignPriceColor(if Strategy_ColoredCandlesOn then if direction == 1 then Color.LIGHT_GREEN else if direction == -1 then Color.RED else Color.GRAY else Color.CURRENT);

AddVerticalLine(Strategy_VerticalLinesOn and signal_up, "Buy", Color.LIGHT_GREEN);
AddVerticalLine(Strategy_VerticalLinesOn and signal_dn, "Sell", Color.RED);

Alert(signal_up, "Buy", Alert.BAR, Sound.DING);
Alert(signal_dn, "Sell", Alert.BAR, Sound.DING);
Wow that was fast! Thanks! Now the secret to almost any indicator is finding its optimal parameters. I back tested each indicator individually a while ago to find the optimal parameters for it and using those combined in this one study along with the TMO my win rate was exactly 70%. I just tested it and overall, I would say that this isn't bad at all. Here were the detailed results:

Days Tested: 30
Timeframe: 3 min
Total Trades: 85
Lose Trades: 26
Win Trades: 59
Win Percentage: 70%
Confirmation Factor: 4

So, let's say you made $500 on each win trade and lost $300 on each losing trade you would come out with (59*$500) $29,500. Minus the losing trades (26*$300) $7,800. Your total would come out to $21,700. Not bad at all in my opinion. What makes this so unique is that alternating one indicators parameters can lead to completely different results so there's a wide range of parameters that can be tested. I also noticed that when all 4 indicators fire a buy/sell signal its much accurate than 3 or 2 so I would recommend keeping the confirmation factor to 4. @TradingNumbers great job on making this indicator!
 
Wow that was fast! Thanks! Now the secret to almost any indicator is finding its optimal parameters. I back tested each indicator individually a while ago to find the optimal parameters for it and using those combined in this one study along with the TMO my win rate was exactly 70%. I just tested it and overall, I would say that this isn't bad at all. Here were the detailed results:

Days Tested: 30
Timeframe: 3 min
Total Trades: 85
Lose Trades: 26
Win Trades: 59
Win Percentage: 70%
Confirmation Factor: 4

So, let's say you made $500 on each win trade and lost $300 on each losing trade you would come out with (59*$500) $29,500. Minus the losing trades (26*$300) $7,800. Your total would come out to $21,700. Not bad at all in my opinion. What makes this so unique is that alternating one indicators parameters can lead to completely different results so there's a wide range of parameters that can be tested. I also noticed that when all 4 indicators fire a buy/sell signal its much accurate than 3 or 2 so I would recommend keeping the confirmation factor to 4. @TradingNumbers great job on making this indicator!
Excellent results. Do you use TMO to agree with entries for the backtesting? Small we also integrate TMO as a fifth parameter?
 
Excellent results. Do you use TMO to agree with entries for the backtesting? Small we also integrate TMO as a fifth parameter?
Dear all,
Thank you for your contribution,
Could you clarify if this indicator is repainting?
I think I saw an oscillator as part of original pack.
Thanks again
 
there are single bar signals and sometimes reverses from there. We should look for reasons why not to take those entries.

There has been ranging days this month even. We should be able to backtest this. It’s mostly moving averages, so yeah, it is lagging but keeps the trend until enough change happens.
 
Last edited by a moderator:
@armybender
I totally agree with you. I don't think this is meant to be a standalone indicator to follow. With anything, if you disregard the price action in your charts and try to convert everything to mechanical decisions, you will not have consistent results in the long run. At least, this has been my experience. Indicators are mostly for increasing confidence and not for signals to enter for me.

That being said, there are certain combination of indicators that work better than others. I don't think anyone is claiming that this is the holly grail of indicators. It is just a nice combination that worked for one of the members. Use at your own risk.
 
Last edited by a moderator:
@armybender
I totally agree with you. I don't think this is meant to be a standalone indicator to follow. With anything, if you disregard the price action in your charts and try to convert everything to mechanical decisions, you will not have consistent results in the long run. At least, this has been my experience. Indicators are mostly for increasing confidence and not for signals to enter for me.

That being said, there are certain combination of indicators that work better than others. I don't think anyone is claiming that this is the holly grail of indicators. It is just a nice combination that worked for one of the members. Use at your own risk.

Yeah, I agree. This combination of 4 seems to do really well in trends compared to a lot of others I've seen Perhaps the warning is: hey, this is designed for trends, so if it's not in a trend, sit back and wait until you think it is. Then use this indicator to get some size on and get heavy in the trend. Something like that.
 
Excellent results. Do you use TMO to agree with entries for the backtesting? Small we also integrate TMO as a fifth parameter?
Yes, when back testing this I noticed that it is better to take long entries only when TMO is below 0 and go short when TMO is above 0. I did not wait for TMO to reach over bought/oversold territories as many times it did not reach those levels however, the trend reversed, and you would have missed a big move. My settings for TMO were 30,6,6. Try this out and let me know what you think. Using the TMO will give you less false signals so adding this into the indicator would be great. I haven't seen that being done in other scripts so not sure if it would work. I added clouds to help me visualize the levels below and above 0 better.

# TMO ((T)rue (M)omentum (O)scilator)
# Mobius
# V01.05.2018
# hint: TMO calculates momentum using the delta of price. Giving a much better picture of trend, tend reversals and divergence than momentum oscillators using price.

declare lower;

input length = 14;
input calcLength = 5;
input smoothLength = 3;

def o = open;
def c = close;
def data = fold i = 0 to length
with s
do s + (if c > GetValue(o, i)
then 1
else if c < GetValue(o, i)
then - 1
else 0);
def EMA5 = ExpAverage(data, calcLength);
plot Main = ExpAverage(EMA5, smoothLength);
plot Signal = ExpAverage(Main, smoothLength);
Main.AssignValueColor(if Main > Signal
then Color.GREEN
else Color.RED);
Signal.AssignValueColor(if Main > Signal
then Color.GREEN
else Color.RED);
Signal.HideBubble();
Signal.HideTitle();
AddCloud(Main, Signal, Color.GREEN, Color.RED);
plot zero = if IsNaN(c) then Double.NaN else 0;
zero.SetDefaultColor(Color.GRAY);
zero.HideBubble();
zero.HideTitle();
plot ob = if IsNaN(c) then Double.NaN else Round(length * .7);
ob.SetDefaultColor(Color.GRAY);
ob.HideBubble();
ob.HideTitle();
plot os = if IsNaN(c) then Double.NaN else -Round(length * .7);
os.SetDefaultColor(Color.GRAY);
os.HideBubble();
os.HideTitle();
AddCloud(0, length, Color.LIGHT_RED, Color.LIGHT_RED, no);
AddCloud(ob, length, Color.GRAY, Color.GRAY, no);
AddCloud(0, -length, Color.LIGHT_GREEN, Color.LIGHT_GREEN);
AddCloud(os, -length, Color.GRAY, Color.GRAY);
# End Code TMO
 
Last edited:
Yes, when back testing this I noticed that it is better to take long entries only when TMO is below 0 and go short when TMO is above 0. I did not wait for TMO to reach over bought/oversold territories as many times it did not reach those levels however, the trend reversed, and you would have missed a big move. My settings for TMO were 30,6,6. Try this out and let me know what you think. Using the TMO will give you less false signals so adding this into the indicator would be great. I haven't seen that being done in other scripts so not sure if it would work. I added clouds to help me visualize the levels below and above 0 better.

# TMO ((T)rue (M)omentum (O)scilator)
# Mobius
# V01.05.2018
# hint: TMO calculates momentum using the delta of price. Giving a much better picture of trend, tend reversals and divergence than momentum oscillators using price.

declare lower;

input length = 14;
input calcLength = 5;
input smoothLength = 3;

def o = open;
def c = close;
def data = fold i = 0 to length
with s
do s + (if c > GetValue(o, i)
then 1
else if c < GetValue(o, i)
then - 1
else 0);
def EMA5 = ExpAverage(data, calcLength);
plot Main = ExpAverage(EMA5, smoothLength);
plot Signal = ExpAverage(Main, smoothLength);
Main.AssignValueColor(if Main > Signal
then Color.GREEN
else Color.RED);
Signal.AssignValueColor(if Main > Signal
then Color.GREEN
else Color.RED);
Signal.HideBubble();
Signal.HideTitle();
AddCloud(Main, Signal, Color.GREEN, Color.RED);
plot zero = if IsNaN(c) then Double.NaN else 0;
zero.SetDefaultColor(Color.GRAY);
zero.HideBubble();
zero.HideTitle();
plot ob = if IsNaN(c) then Double.NaN else Round(length * .7);
ob.SetDefaultColor(Color.GRAY);
ob.HideBubble();
ob.HideTitle();
plot os = if IsNaN(c) then Double.NaN else -Round(length * .7);
os.SetDefaultColor(Color.GRAY);
os.HideBubble();
os.HideTitle();
AddCloud(0, length, Color.LIGHT_RED, Color.LIGHT_RED, no);
AddCloud(ob, length, Color.GRAY, Color.GRAY, no);
AddCloud(0, -length, Color.LIGHT_GREEN, Color.LIGHT_GREEN);
AddCloud(os, -length, Color.GRAY, Color.GRAY);
# End Code TMO
Thanks. I'll add this and post an update later tonight. Do you change the default settings of the other 4 indicators for 3 minute chart?
 
Well, I lied. Here is the new version that includes the TMO. Default has been changed to include 5 conditions and TMO defaults are changed to match @GiantBull recommendation.

Code:
# The Big Four Indicator
# https://usethinkscript.com/threads/the-big-four-chart-setup.14711/
# v1.0 - GiantBull and TradingNumbers
# v1.1 - TradingNumbers - hiding vertical lines by ddefault and added arrows
# v1.2 - TradingNumbers - added TMO

# AK Trend

input aktrend_input1 = 3;
input aktrend_input2 = 8;
input aktrend_price = close;

def aktrend_fastmaa = MovAvgExponential(aktrend_price, aktrend_input1);
def aktrend_fastmab = MovAvgExponential(aktrend_price, aktrend_input2);
def aktrend_bspread = (aktrend_fastmaa - aktrend_fastmab) * 1.001;

def cond1_UP = if aktrend_bspread > 0 then 1 else 0;
def cond1_DN = if aktrend_bspread <= 0 then -1 else 0;

# ZSCORE

input zscore_price = close;
input zscore_length = 20;
input zscore_ZavgLength = 20;

def zscore_oneSD = StDev(zscore_price, zscore_length);
def zscore_avgClose = SimpleMovingAvg(zscore_price, zscore_length);
def zscore_ofoneSD = zscore_oneSD * zscore_price[1];
def zscore_Zscorevalue = ((zscore_price - zscore_avgClose) / zscore_oneSD);
def zscore_avgZv = Average(zscore_Zscorevalue, 20);
def zscore_Zscore = ((zscore_price - zscore_avgClose) / zscore_oneSD);
def zscore_avgZscore = Average(zscore_Zscorevalue, zscore_ZavgLength);

def cond2_UP = if zscore_Zscore > 0 then 1 else 0;
def cond2_DN = if zscore_Zscore <= 0 then -1 else 0;

# Ehlers

input ehlers_length = 34;

def ehlers_price = (high + low) / 2;
def ehlers_coeff = ehlers_length * ehlers_price * ehlers_price - 2 * ehlers_price * Sum(ehlers_price, ehlers_length)[1] + Sum(ehlers_price * ehlers_price, ehlers_length)[1];
def ehlers_Ehlers = Sum(ehlers_coeff * ehlers_price, ehlers_length) / Sum(ehlers_coeff, ehlers_length);

def cond3_UP = if close > ehlers_Ehlers then 1 else 0;
def cond3_DN = if close <= ehlers_Ehlers then -1 else 0;

# Anchored Momentum

input amom_src = close;
input amom_MomentumPeriod = 10;
input amom_SignalPeriod = 8;
input amom_SmoothMomentum = no;
input amom_SmoothingPeriod = 7;

def amom_p = 2 * amom_MomentumPeriod + 1;
def amom_t_amom = if amom_SmoothMomentum == yes then ExpAverage(amom_src, amom_SmoothingPeriod) else amom_src;
def amom_amom = 100 * ( (amom_t_amom / ( Average(amom_src, amom_p)) - 1));
def amom_amoms = Average(amom_amom, amom_SignalPeriod);


def cond4_UP = if amom_amom > 0 then 1 else 0;
def cond4_DN = if amom_amom <= 0 then -1 else 0;

# TMO

input tmo_length = 30; #def 14
input tmo_calcLength = 6; #def 5
input tmo_smoothLength = 6; #def 3

def tmo_data = fold i = 0 to tmo_length with s do s + (if close > GetValue(open, i) then 1 else if close < GetValue(open, i) then - 1 else 0);
def tmo_EMA5 = ExpAverage(tmo_data, tmo_calcLength);
def tmo_Main = ExpAverage(tmo_EMA5, tmo_smoothLength);
def tmo_Signal = ExpAverage(tmo_Main, tmo_smoothLength);
def tmo_color = if tmo_Main > tmo_Signal then 1 else -1;

def cond5_UP = if tmo_color > 0 and tmo_Main >= 0 then 1 else 0;
def cond5_DN = if tmo_color <= 0 and tmo_Main <= 0 then -1 else 0;

# Strategy

input Strategy_Confirmation_Factor = 5;
input Strategy_ColoredCandlesOn = yes;
input Strategy_VerticalLinesOn = no;

def cond_UP = cond1_UP + cond2_UP + cond3_UP + cond4_UP + cond5_UP;
def cond_DN = cond1_DN + cond2_DN + cond3_DN + cond4_DN + cond5_DN;

def direction = if cond_UP >= Strategy_Confirmation_Factor then 1 else if cond_DN <= -Strategy_Confirmation_Factor then -1 else direction[1];

plot signal_up = direction == 1 and direction[1] < 1;
signal_up.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
signal_up.SetDefaultColor(Color.WHITE);
signal_up.Hide();
signal_up.HideBubble();
signal_up.HideTitle();

plot signal_dn = direction == -1 and direction[1] > -1;
signal_dn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
signal_dn.SetDefaultColor(Color.WHITE);
signal_dn.Hide();
signal_dn.HideBubble();
signal_dn.HideTitle();

AssignPriceColor(if Strategy_ColoredCandlesOn then if direction == 1 then Color.LIGHT_GREEN else if direction == -1 then Color.RED else Color.GRAY else Color.CURRENT);

AddVerticalLine(Strategy_VerticalLinesOn and signal_up, "Buy", Color.LIGHT_GREEN);
AddVerticalLine(Strategy_VerticalLinesOn and signal_dn, "Sell", Color.RED);

Alert(signal_up, "Buy", Alert.BAR, Sound.DING);
Alert(signal_dn, "Sell", Alert.BAR, Sound.DING);
 
Here is another feature. "Strategy Hold Trend" is added. If you turn this off, it will switch to gray candles when the specific trend is not in effect. Essentially, you can take this as not in momentum mode in the trend direction or reversal is coming. Let's see how everyone's experience is with this latest version.

uuaxGMQ.png


H9be3Ei.png


Code:
# The Big Four Indicator
# https://usethinkscript.com/threads/the-big-four-chart-setup.14711/
# v1.0 - GiantBull and TradingNumbers
# v1.1 - TradingNumbers - hiding vertical lines by ddefault and added arrows
# v1.2 - TradingNumbers - added TMO
# v1.3 - TradingNumbers - hold trend input added

# AK Trend

input aktrend_input1 = 3;
input aktrend_input2 = 8;
input aktrend_price = close;

def aktrend_fastmaa = MovAvgExponential(aktrend_price, aktrend_input1);
def aktrend_fastmab = MovAvgExponential(aktrend_price, aktrend_input2);
def aktrend_bspread = (aktrend_fastmaa - aktrend_fastmab) * 1.001;

def cond1_UP = if aktrend_bspread > 0 then 1 else 0;
def cond1_DN = if aktrend_bspread <= 0 then -1 else 0;

# ZSCORE

input zscore_price = close;
input zscore_length = 20;
input zscore_ZavgLength = 20;

def zscore_oneSD = StDev(zscore_price, zscore_length);
def zscore_avgClose = SimpleMovingAvg(zscore_price, zscore_length);
def zscore_ofoneSD = zscore_oneSD * zscore_price[1];
def zscore_Zscorevalue = ((zscore_price - zscore_avgClose) / zscore_oneSD);
def zscore_avgZv = Average(zscore_Zscorevalue, 20);
def zscore_Zscore = ((zscore_price - zscore_avgClose) / zscore_oneSD);
def zscore_avgZscore = Average(zscore_Zscorevalue, zscore_ZavgLength);

def cond2_UP = if zscore_Zscore > 0 then 1 else 0;
def cond2_DN = if zscore_Zscore <= 0 then -1 else 0;

# Ehlers

input ehlers_length = 34;

def ehlers_price = (high + low) / 2;
def ehlers_coeff = ehlers_length * ehlers_price * ehlers_price - 2 * ehlers_price * Sum(ehlers_price, ehlers_length)[1] + Sum(ehlers_price * ehlers_price, ehlers_length)[1];
def ehlers_Ehlers = Sum(ehlers_coeff * ehlers_price, ehlers_length) / Sum(ehlers_coeff, ehlers_length);

def cond3_UP = if close > ehlers_Ehlers then 1 else 0;
def cond3_DN = if close <= ehlers_Ehlers then -1 else 0;

# Anchored Momentum

input amom_src = close;
input amom_MomentumPeriod = 10;
input amom_SignalPeriod = 8;
input amom_SmoothMomentum = no;
input amom_SmoothingPeriod = 7;

def amom_p = 2 * amom_MomentumPeriod + 1;
def amom_t_amom = if amom_SmoothMomentum == yes then ExpAverage(amom_src, amom_SmoothingPeriod) else amom_src;
def amom_amom = 100 * ( (amom_t_amom / ( Average(amom_src, amom_p)) - 1));
def amom_amoms = Average(amom_amom, amom_SignalPeriod);


def cond4_UP = if amom_amom > 0 then 1 else 0;
def cond4_DN = if amom_amom <= 0 then -1 else 0;

# TMO

input tmo_length = 30; #def 14
input tmo_calcLength = 6; #def 5
input tmo_smoothLength = 6; #def 3

def tmo_data = fold i = 0 to tmo_length with s do s + (if close > GetValue(open, i) then 1 else if close < GetValue(open, i) then - 1 else 0);
def tmo_EMA5 = ExpAverage(tmo_data, tmo_calcLength);
def tmo_Main = ExpAverage(tmo_EMA5, tmo_smoothLength);
def tmo_Signal = ExpAverage(tmo_Main, tmo_smoothLength);
def tmo_color = if tmo_Main > tmo_Signal then 1 else -1;

def cond5_UP = if tmo_color > 0 and tmo_Main >= 0 then 1 else 0;
def cond5_DN = if tmo_color <= 0 and tmo_Main <= 0 then -1 else 0;

# Strategy

input Strategy_Confirmation_Factor = 5;
input Strategy_ColoredCandlesOn = yes;
input Strategy_VerticalLinesOn = no;
input Strategy_HoldTrend = yes;

def cond_UP = cond1_UP + cond2_UP + cond3_UP + cond4_UP + cond5_UP;
def cond_DN = cond1_DN + cond2_DN + cond3_DN + cond4_DN + cond5_DN;

def direction = if cond_UP >= Strategy_Confirmation_Factor then 1
                else if cond_DN <= -Strategy_Confirmation_Factor then -1
                else if !Strategy_HoldTrend and direction[1] == 1 and cond_UP < Strategy_Confirmation_Factor and cond_DN > -Strategy_Confirmation_Factor then 0
                else if !Strategy_HoldTrend and direction[1] == -1 and cond_DN > -Strategy_Confirmation_Factor and cond_UP < Strategy_Confirmation_Factor then 0
                else direction[1];

plot signal_up = direction == 1 and direction[1] < 1;
signal_up.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
signal_up.SetDefaultColor(Color.WHITE);
signal_up.Hide();
signal_up.HideBubble();
signal_up.HideTitle();

plot signal_dn = direction == -1 and direction[1] > -1;
signal_dn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
signal_dn.SetDefaultColor(Color.WHITE);
signal_dn.Hide();
signal_dn.HideBubble();
signal_dn.HideTitle();

AssignPriceColor(if Strategy_ColoredCandlesOn then if direction == 1 then Color.LIGHT_GREEN else if direction == -1 then Color.RED else Color.GRAY else Color.CURRENT);

AddVerticalLine(Strategy_VerticalLinesOn and signal_up, "Buy", Color.LIGHT_GREEN);
AddVerticalLine(Strategy_VerticalLinesOn and signal_dn, "Sell", Color.RED);

Alert(signal_up, "Buy", Alert.BAR, Sound.DING);
Alert(signal_dn, "Sell", Alert.BAR, Sound.DING);
 
Looks great! This would've stopped me from going short on SPY the last two days.. will test it out with TMO
How did I know I would find you on this thread @lolreconlol !! Short the last two days on spy? Do you not have the end all be all indicators?! But don’t worry I made the same mistake on coin a few weeks ago. Gotta wait for the confirmation.

This big four indicator looks very interesting… I will be comparing it to Triple Exhaustion for sure.
 
Well, I lied. Here is the new version that includes the TMO. Default has been changed to include 5 conditions and TMO defaults are changed to match @GiantBull recommendation.

Code:
# The Big Four Indicator
# https://usethinkscript.com/threads/the-big-four-chart-setup.14711/
# v1.0 - GiantBull and TradingNumbers
# v1.1 - TradingNumbers - hiding vertical lines by ddefault and added arrows
# v1.2 - TradingNumbers - added TMO

# AK Trend

input aktrend_input1 = 3;
input aktrend_input2 = 8;
input aktrend_price = close;

def aktrend_fastmaa = MovAvgExponential(aktrend_price, aktrend_input1);
def aktrend_fastmab = MovAvgExponential(aktrend_price, aktrend_input2);
def aktrend_bspread = (aktrend_fastmaa - aktrend_fastmab) * 1.001;

def cond1_UP = if aktrend_bspread > 0 then 1 else 0;
def cond1_DN = if aktrend_bspread <= 0 then -1 else 0;

# ZSCORE

input zscore_price = close;
input zscore_length = 20;
input zscore_ZavgLength = 20;

def zscore_oneSD = StDev(zscore_price, zscore_length);
def zscore_avgClose = SimpleMovingAvg(zscore_price, zscore_length);
def zscore_ofoneSD = zscore_oneSD * zscore_price[1];
def zscore_Zscorevalue = ((zscore_price - zscore_avgClose) / zscore_oneSD);
def zscore_avgZv = Average(zscore_Zscorevalue, 20);
def zscore_Zscore = ((zscore_price - zscore_avgClose) / zscore_oneSD);
def zscore_avgZscore = Average(zscore_Zscorevalue, zscore_ZavgLength);

def cond2_UP = if zscore_Zscore > 0 then 1 else 0;
def cond2_DN = if zscore_Zscore <= 0 then -1 else 0;

# Ehlers

input ehlers_length = 34;

def ehlers_price = (high + low) / 2;
def ehlers_coeff = ehlers_length * ehlers_price * ehlers_price - 2 * ehlers_price * Sum(ehlers_price, ehlers_length)[1] + Sum(ehlers_price * ehlers_price, ehlers_length)[1];
def ehlers_Ehlers = Sum(ehlers_coeff * ehlers_price, ehlers_length) / Sum(ehlers_coeff, ehlers_length);

def cond3_UP = if close > ehlers_Ehlers then 1 else 0;
def cond3_DN = if close <= ehlers_Ehlers then -1 else 0;

# Anchored Momentum

input amom_src = close;
input amom_MomentumPeriod = 10;
input amom_SignalPeriod = 8;
input amom_SmoothMomentum = no;
input amom_SmoothingPeriod = 7;

def amom_p = 2 * amom_MomentumPeriod + 1;
def amom_t_amom = if amom_SmoothMomentum == yes then ExpAverage(amom_src, amom_SmoothingPeriod) else amom_src;
def amom_amom = 100 * ( (amom_t_amom / ( Average(amom_src, amom_p)) - 1));
def amom_amoms = Average(amom_amom, amom_SignalPeriod);


def cond4_UP = if amom_amom > 0 then 1 else 0;
def cond4_DN = if amom_amom <= 0 then -1 else 0;

# TMO

input tmo_length = 30; #def 14
input tmo_calcLength = 6; #def 5
input tmo_smoothLength = 6; #def 3

def tmo_data = fold i = 0 to tmo_length with s do s + (if close > GetValue(open, i) then 1 else if close < GetValue(open, i) then - 1 else 0);
def tmo_EMA5 = ExpAverage(tmo_data, tmo_calcLength);
def tmo_Main = ExpAverage(tmo_EMA5, tmo_smoothLength);
def tmo_Signal = ExpAverage(tmo_Main, tmo_smoothLength);
def tmo_color = if tmo_Main > tmo_Signal then 1 else -1;

def cond5_UP = if tmo_color > 0 and tmo_Main >= 0 then 1 else 0;
def cond5_DN = if tmo_color <= 0 and tmo_Main <= 0 then -1 else 0;

# Strategy

input Strategy_Confirmation_Factor = 5;
input Strategy_ColoredCandlesOn = yes;
input Strategy_VerticalLinesOn = no;

def cond_UP = cond1_UP + cond2_UP + cond3_UP + cond4_UP + cond5_UP;
def cond_DN = cond1_DN + cond2_DN + cond3_DN + cond4_DN + cond5_DN;

def direction = if cond_UP >= Strategy_Confirmation_Factor then 1 else if cond_DN <= -Strategy_Confirmation_Factor then -1 else direction[1];

plot signal_up = direction == 1 and direction[1] < 1;
signal_up.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
signal_up.SetDefaultColor(Color.WHITE);
signal_up.Hide();
signal_up.HideBubble();
signal_up.HideTitle();

plot signal_dn = direction == -1 and direction[1] > -1;
signal_dn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
signal_dn.SetDefaultColor(Color.WHITE);
signal_dn.Hide();
signal_dn.HideBubble();
signal_dn.HideTitle();

AssignPriceColor(if Strategy_ColoredCandlesOn then if direction == 1 then Color.LIGHT_GREEN else if direction == -1 then Color.RED else Color.GRAY else Color.CURRENT);

AddVerticalLine(Strategy_VerticalLinesOn and signal_up, "Buy", Color.LIGHT_GREEN);
AddVerticalLine(Strategy_VerticalLinesOn and signal_dn, "Sell", Color.RED);

Alert(signal_up, "Buy", Alert.BAR, Sound.DING);
Alert(signal_dn, "Sell", Alert.BAR, Sound.DING);
Hmm so what the code is doing is implementing the TMO not in the way the strategy is intended to do. So, when TMO crosses below 0 the candles turn red and vice versa. What's actually supposed to happen is condition 1-4 are supposed to give you a buy/sell signal only if the TMO is below/above 0. For example, if the TMO is above zero and conditions 1-4 give you a buy signal then you wouldn't take that. If it is below 0 and conditions 1-4 are giving you a buy signal, then you would take that trade. I was thinking about adding an IF statement, but it didn’t seem to work. I first tried inputting the tmo in the def cond_Up and cond_DN part of the scripts with now success. The chart would turn out to be all gray. I also replaced the "and" to a "+" but no success.

def cond_UP = cond1_UP + cond2_UP + cond3_UP + cond4_UP and tmo_Main>0;
def cond_DN = cond1_DN + cond2_DN + cond3_DN + cond4_DN and tmo_Main<=0;

If you could figure this one out that would be impressive because I don't believe thinkscript is capable of doing these types of complex codes.
 
Hmm so what the code is doing is implementing the TMO not in the way the strategy is intended to do. So, when TMO crosses below 0 the candles turn red and vice versa. What's actually supposed to happen is condition 1-4 are supposed to give you a buy/sell signal only if the TMO is below/above 0. For example, if the TMO is above zero and conditions 1-4 give you a buy signal then you wouldn't take that. If it is below 0 and conditions 1-4 are giving you a buy signal, then you would take that trade. I was thinking about adding an IF statement, but it didn’t seem to work. I first tried inputting the tmo in the def cond_Up and cond_DN part of the scripts with now success. The chart would turn out to be all gray. I also replaced the "and" to a "+" but no success.

def cond_UP = cond1_UP + cond2_UP + cond3_UP + cond4_UP and tmo_Main>0;
def cond_DN = cond1_DN + cond2_DN + cond3_DN + cond4_DN and tmo_Main<=0;

If you could figure this one out that would be impressive because I don't believe thinkscript is capable of doing these types of complex codes.
Yep, I have it opposite. You don’t want to add another condition. We need to change cond5. I’ll post an update in a few.
 
Hmm so what the code is doing is implementing the TMO not in the way the strategy is intended to do. So, when TMO crosses below 0 the candles turn red and vice versa. What's actually supposed to happen is condition 1-4 are supposed to give you a buy/sell signal only if the TMO is below/above 0. For example, if the TMO is above zero and conditions 1-4 give you a buy signal then you wouldn't take that. If it is below 0 and conditions 1-4 are giving you a buy signal, then you would take that trade. I was thinking about adding an IF statement, but it didn’t seem to work. I first tried inputting the tmo in the def cond_Up and cond_DN part of the scripts with now success. The chart would turn out to be all gray. I also replaced the "and" to a "+" but no success.

def cond_UP = cond1_UP + cond2_UP + cond3_UP + cond4_UP and tmo_Main>0;
def cond_DN = cond1_DN + cond2_DN + cond3_DN + cond4_DN and tmo_Main<=0;

If you could figure this one out that would be impressive because I don't believe thinkscript is capable of doing these types of complex codes.
Looking at it now, it doesn't work too well with that logic. You say if the TMO is below zero, you are allowed to go long and if TMO is above zero, you are are allowed to go short. However, the cond_UP proposal above is you are allowed to go long when TMO is above zero. Opposite of your description. Also, looking at the chart, there are a lot of long opportunities here where you would be missing if you don't consider above zero TMO.

WcXLisu.png


Here is another example. You would be missing a lot of these with TMO filtering.
DeSQv2m.png


Idea in v1.2 is that if the TMO crossed above zero, there is a higher probability that it will reach overbought condition, and when it crossed below zero, it has a higher probability that it will reach oversold condition. However, there are many cases where TMO will stay above zero or below zero and never cross zero to reversal, it will only be a pullback and continuation.
 

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
383 Online
Create Post

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