Thanks once to everyone who contributed to the discussion. Finally, I have been successful in eliminating the numerous signals keeping the lowest and the highest reversal signals. I am cleaning up the script and will post the final results.
Hey Floydd...am swamped with work these past few day. I will have those ready for you all soon.hi, bonbon: any updates for us? just checking!
@RickK Are you trading /ES live using this strategy?
Is there a separate code for TEMA suggested in post 112 above?
Thanks
#Custom Trend Multi Indicator Heat Map by 7of9
declare lower;
input CloseVsSmaTrendLength = 8;
input VolumeBarSensitivity = 3;
input VWapTimeFrame = {default DAY, WEEK};
#Dot Placement Code
def DotOffset1 = 1;
def DotOffset2 = 2;
def DotOffset3 = 3;
def DotOffset4 = 4;
def DotOffset5 = 5;
def DotOffset6 = 6;
def DotOffset7 = 7;
def DotOffset8 = 8;
def DotOffset9 = 9;
def DotOffset10 = 10;
def DotOffset11 = 11;
def DotOffset12 = 12;
#EMA Code
def AvgExp9 = ExpAverage(close, 9);
def AvgExp20 = ExpAverage(close, 20);
def AvgExp50 = ExpAverage(close, 50);
def AvgExp100 = ExpAverage(close, 100);
def AvgExp200 = ExpAverage(close, 200);
#EMA Trend Code
plot Up50 = if AvgExp50 > AvgExp50[1] then DotOffset1 else Double.NaN;
plot Dn50 = if AvgExp50 < AvgExp50[1] then DotOffset1 else Double.NaN;
Up50.SetDefaultColor(Color.GREEN);
Up50.SetStyle(Curve.POINTS);
Up50.SetLineWeight(1);
Dn50.SetDefaultColor(Color.RED);
Dn50.SetStyle(Curve.POINTS);
Dn50.SetLineWeight(1);
#EMA Crossover Code
plot Up9x20 = if AvgExp9 > AvgExp20 then DotOffset2 else Double.NaN;
plot Up9x50 = if AvgExp9 > AvgExp50 then DotOffset3 else Double.NaN;
plot Up9x100 = if AvgExp9 > AvgExp100 then DotOffset4 else Double.NaN;
plot Up9x200 = if AvgExp9 > AvgExp200 then DotOffset5 else Double.NaN;
plot Dn9x20 = if AvgExp9 < AvgExp20 then DotOffset2 else Double.NaN;
plot Dn9x50 = if AvgExp9 < AvgExp50 then DotOffset3 else Double.NaN;
plot Dn9x100 = if AvgExp9 < AvgExp100 then DotOffset4 else Double.NaN;
plot Dn9x200 = if AvgExp9 < AvgExp200 then DotOffset5 else Double.NaN;
Up9x20.SetDefaultColor(Color.GREEN);
Up9x20.SetStyle(Curve.POINTS);
Up9x20.SetLineWeight(1);
Up9x50.SetDefaultColor(Color.GREEN);
Up9x50.SetStyle(Curve.POINTS);
Up9x50.SetLineWeight(1);
Up9x100.SetDefaultColor(Color.GREEN);
Up9x100.SetStyle(Curve.POINTS);
Up9x100.SetLineWeight(1);
Up9x200.SetDefaultColor(Color.GREEN);
Up9x200.SetStyle(Curve.POINTS);
Up9x200.SetLineWeight(1);
Dn9x20.SetDefaultColor(Color.RED);
Dn9x20.SetStyle(Curve.POINTS);
Dn9x20.SetLineWeight(1);
Dn9x50.SetDefaultColor(Color.RED);
Dn9x50.SetStyle(Curve.POINTS);
Dn9x50.SetLineWeight(1);
Dn9x100.SetDefaultColor(Color.RED);
Dn9x100.SetStyle(Curve.POINTS);
Dn9x100.SetLineWeight(1);
Dn9x200.SetDefaultColor(Color.RED);
Dn9x200.SetStyle(Curve.POINTS);
Dn9x200.SetLineWeight(1);
#VWAP Code
def cap = GetAggregationPeriod();
def errorInAggregation =
VWapTimeFrame == VWapTimeFrame.DAY and cap >= AggregationPeriod.WEEK or
VWapTimeFrame == VWapTimeFrame.WEEK and cap >= AggregationPeriod.MONTH;
Assert(!errorInAggregation, "timeFrame should be not less than current chart aggregation period");
def yyyyMmDd = GetYYYYMMDD();
def periodIndx;
switch (VWapTimeFrame) {
case DAY:
periodIndx = yyyyMmDd;
case WEEK:
periodIndx = Floor((DaysFromDate(First(yyyyMmDd)) + GetDayOfWeek(First(yyyyMmDd))) / 7);}
def isPeriodRolled = CompoundValue(1, periodIndx != periodIndx[1], yes);
def volumeSum;
def volumeVwapSum;
def volumeVwap2Sum;
if (isPeriodRolled) {
volumeSum = volume;
volumeVwapSum = volume * vwap;
volumeVwap2Sum = volume * Sqr(vwap);
} else {
volumeSum = CompoundValue(1, volumeSum[1] + volume, volume);
volumeVwapSum = CompoundValue(1, volumeVwapSum[1] + volume * vwap, volume * vwap);
volumeVwap2Sum = CompoundValue(1, volumeVwap2Sum[1] + volume * Sqr(vwap), volume * Sqr(vwap));}
def vprice = volumeVwapSum / volumeSum;
plot UpClosexVwap = if close > vprice then DotOffset6 else Double.NaN;
plot DnClosexVwap = if close < vprice then DotOffset6 else Double.NaN;
UpClosexVwap.SetDefaultColor(Color.GREEN);
UpClosexVwap.SetStyle(Curve.POINTS);
UpClosexVwap.SetLineWeight(1);
DnClosexVwap.SetDefaultColor(Color.RED);
DnClosexVwap.SetStyle(Curve.POINTS);
DnClosexVwap.SetLineWeight(1);
#On Balance Volume Code
def OBV = TotalSum(Sign(close - close[1]) * volume);
plot UpObv = if OBV >= Obv[VolumeBarSensitivity] then DotOffset7 else Double.NaN;
plot DnObv = if OBV < Obv[VolumeBarSensitivity] then DotOffset7 else Double.NaN;
UpObv.SetDefaultColor(Color.GREEN);
UpObv.SetStyle(Curve.POINTS);
UpObv.SetLineWeight(1);
DnObv.SetDefaultColor(Color.RED);
DnObv.SetStyle(Curve.POINTS);
DnObv.SetLineWeight(1);
#Positive Volume Index Code
def PVI = compoundValue(1, PVI[1] + if (volume > volume[1] and close[1] != 0) then 100 * (close - close[1]) / close[1] else 0, 100);
plot UpPvi = if PVI >= PVI[VolumeBarSensitivity] then DotOffset8 else Double.NaN;
plot DnPvi = if PVI < PVI[VolumeBarSensitivity] then DotOffset8 else Double.NaN;
UpPvi.SetDefaultColor(Color.GREEN);
UpPvi.SetStyle(Curve.POINTS);
UpPvi.SetLineWeight(1);
DnPvi.SetDefaultColor(Color.RED);
DnPvi.SetStyle(Curve.POINTS);
DnPvi.SetLineWeight(1);
#Close vs SMA Trend Code
#short-term trend is based on the 8 period SMA (length adjustable in config)
#if the current price is above the SMA, then trend will be green else red
def SMA = Average(close, CloseVsSmaTrendLength);
plot UpPriceTrend = if close > SMA then DotOffset9 else double.NaN;
plot DnPriceTrend = if close <= SMA then DotOffset9 else double.NaN;
UpPriceTrend.SetDefaultColor(Color.GREEN);
UpPriceTrend.SetStyle(Curve.POINTS);
UpPriceTrend.SetLineWeight(1);
DnPriceTrend.SetDefaultColor(Color.RED);
DnPriceTrend.SetStyle(Curve.POINTS);
DnPriceTrend.SetLineWeight(1);
#PDC Up Down Trend Code
#If current price is greater than previous day close price, then trend will be green else red
plot UpPdc = if close - close(period = "day" )[1] > 0 then DotOffset10 else Double.NaN;
plot DnPdc = if close - close(period = "day" )[1] <= 0 then DotOffset10 else Double.NaN;
UpPdc.SetDefaultColor(Color.GREEN);
UpPdc.SetStyle(Curve.POINTS);
UpPdc.SetLineWeight(1);
DnPdc.SetDefaultColor(Color.RED);
DnPdc.SetStyle(Curve.POINTS);
DnPdc.SetLineWeight(1);
#CDO Up Down Trend Code
#If current price is greater than current day open price, then trend will be green else red
plot UpCdo = if close - open(period = "day" ) > 0 then DotOffset11 else Double.NaN;
plot DnCdo = if close - open(period = "day" ) <= 0 then DotOffset11 else Double.NaN;
UpCdo.SetDefaultColor(Color.GREEN);
UpCdo.SetStyle(Curve.POINTS);
UpCdo.SetLineWeight(1);
DnCdo.SetDefaultColor(Color.RED);
DnCdo.SetStyle(Curve.POINTS);
DnCdo.SetLineWeight(1);
#PMO Up Down Trend Code
#If current price is greater than current day pre-mkt open price, then trend will be green else red
def day = GetDay();
def PMopenBar = day != day[1];
def PMO = if PMopenBar then open else PMO[1];
plot UpPmo = if close - PMO > 0 then DotOffset12 else Double.NaN;
plot DnPmo = if close - PMO <= 0 then DotOffset12 else Double.NaN;
UpPmo.SetDefaultColor(Color.GREEN);
UpPmo.SetStyle(Curve.POINTS);
UpPmo.SetLineWeight(1);
DnPmo.SetDefaultColor(Color.RED);
DnPmo.SetStyle(Curve.POINTS);
DnPmo.SetLineWeight(1);
##end
@BonBon , thanks a lot for your efforts , will you able to share it as a chart?.@floydddd @RickK ..sorry everyone. I have been swamped with work!!!!!!!! Yes!!!!! I I figured it out @RickK I will be posting that script as well.
I put a twist on the signals and you will see that as well.
It takes up less space on the chart. You will have it tomorrow as its a holiday and I will have time to add the new and/or updated script.
@Branch ......lol am a but I appreciate the "bro" comment!!! lol, lol!!
Here is a chart with the MTF together.
@Kitchasap, yes I will be sharing all the charts and updates since my last post. @Floyddd, indeed, it will be great having a 4 day weekend!!!!sorry you've been so work swamps, BB, but praise be to holidays!
Hey @AspaTrader, do you mind sharing your chart?
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Start a new thread and receive assistance from our community.
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.
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.