I put your strategy into a candle painting "impulse" system and also a strategy for backtesting purposes. I did not know what you consider as overbought/oversold in market forecast though however so I omitted that portion but it can be added. Also I am not sure if this is meant to be a long only strategy or not, so for backtesting purposes you can simply change Order3 to Sell to Close for accurate "Long only"results.
Study:
Code:
#ImpulseHullGC based on westgl strategy
#Created by Tradebyday
input length1 = 15;
input length2 = 34;
input accelerationFactor = 0.02;
input accelerationLimit = 0.2;
input paintBars = yes;
def HMA15 = MovingAverage(AverageType.HULL, close, length1);
def HMA34 = MovingAverage(AverageType.HULL, close, length2);
#
# TD Ameritrade IP Company, Inc. (c) 2008-2020
#
assert(accelerationFactor > 0, "'acceleration factor' must be positive: " + accelerationFactor);
assert(accelerationLimit >= accelerationFactor, "'acceleration limit' (" + accelerationLimit + ") must be greater than or equal to 'acceleration factor' (" + accelerationFactor + ")");
def state = {default init, long, short};
def extreme;
def SAR;
def acc;
switch (state[1]) {
case init:
state = state.long;
acc = accelerationFactor;
extreme = high;
SAR = low;
case short:
if (SAR[1] < high)
then {
state = state.long;
acc = accelerationFactor;
extreme = high;
SAR = extreme[1];
} else {
state = state.short;
if (low < extreme[1])
then {
acc = min(acc[1] + accelerationFactor, accelerationLimit);
extreme = low;
} else {
acc = acc[1];
extreme = extreme[1];
}
SAR = max(max(high, high[1]), SAR[1] + acc * (extreme - SAR[1]));
}
case long:
if (SAR[1] > low)
then {
state = state.short;
acc = accelerationFactor;
extreme = low;
SAR = extreme[1];
} else {
state = state.long;
if (high > extreme[1])
then {
acc = min(acc[1] + accelerationFactor, accelerationLimit);
extreme = high;
} else {
acc = acc[1];
extreme = extreme[1];
}
SAR = min(min(low, low[1]), SAR[1] + acc * (extreme - SAR[1]));
}
}
plot parSAR = SAR;
parSAR.SetPaintingStrategy(PaintingStrategy.POINTS);
parSAR.SetDefaultColor(GetColor(5));
def GreenPrice = HMA15 > HMA34 and close > parSAR;
def RedPrice = HMA15 < HMA34 and close < parSAR;
plot Bullish = GreenPrice;
plot Neutral = !GreenPrice and !RedPrice;
plot Bearish = RedPrice;
Bullish.SetDefaultColor(Color.UPTICK);
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Bullish.SetLineWeight(3);
Bullish.Hide();
Neutral.SetDefaultColor(Color.BLUE);
Neutral.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Neutral.SetLineWeight(3);
Neutral.Hide();
Bearish.SetDefaultColor(Color.DOWNTICK);
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Bearish.SetLineWeight(3);
Bearish.Hide();
DefineGlobalColor("Bullish", Color.UPTICK);
DefineGlobalColor("Neutral", Color.GRAY);
DefineGlobalColor("Bearish", Color.DOWNTICK);
AssignPriceColor(if !paintBars then Color.CURRENT else if GreenPrice then GlobalColor("Bullish") else if RedPrice then GlobalColor("Bearish") else GlobalColor("Neutral"));
Strategy:
Code:
#ImpulseHullGC based on westgl strategy
#Created by Tradebyday
input length1 = 15;
input length2 = 34;
input accelerationFactor = 0.02;
input accelerationLimit = 0.2;
input paintBars = yes;
def HMA15 = MovingAverage(AverageType.HULL, close, length1);
def HMA34 = MovingAverage(AverageType.HULL, close, length2);
#
# TD Ameritrade IP Company, Inc. (c) 2008-2020
#
assert(accelerationFactor > 0, "'acceleration factor' must be positive: " + accelerationFactor);
assert(accelerationLimit >= accelerationFactor, "'acceleration limit' (" + accelerationLimit + ") must be greater than or equal to 'acceleration factor' (" + accelerationFactor + ")");
def state = {default init, long, short};
def extreme;
def SAR;
def acc;
switch (state[1]) {
case init:
state = state.long;
acc = accelerationFactor;
extreme = high;
SAR = low;
case short:
if (SAR[1] < high)
then {
state = state.long;
acc = accelerationFactor;
extreme = high;
SAR = extreme[1];
} else {
state = state.short;
if (low < extreme[1])
then {
acc = min(acc[1] + accelerationFactor, accelerationLimit);
extreme = low;
} else {
acc = acc[1];
extreme = extreme[1];
}
SAR = max(max(high, high[1]), SAR[1] + acc * (extreme - SAR[1]));
}
case long:
if (SAR[1] > low)
then {
state = state.short;
acc = accelerationFactor;
extreme = low;
SAR = extreme[1];
} else {
state = state.long;
if (high > extreme[1])
then {
acc = min(acc[1] + accelerationFactor, accelerationLimit);
extreme = high;
} else {
acc = acc[1];
extreme = extreme[1];
}
SAR = min(min(low, low[1]), SAR[1] + acc * (extreme - SAR[1]));
}
}
plot parSAR = SAR;
parSAR.SetPaintingStrategy(PaintingStrategy.POINTS);
parSAR.SetDefaultColor(GetColor(5));
def GreenPrice = HMA15 > HMA34 and close > parSAR;
def RedPrice = HMA15 < HMA34 and close < parSAR;
plot Bullish = GreenPrice;
plot Neutral = !GreenPrice and !RedPrice;
plot Bearish = RedPrice;
Bullish.SetDefaultColor(Color.UPTICK);
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Bullish.SetLineWeight(3);
Bullish.Hide();
Neutral.SetDefaultColor(Color.BLUE);
Neutral.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Neutral.SetLineWeight(3);
Neutral.Hide();
Bearish.SetDefaultColor(Color.DOWNTICK);
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Bearish.SetLineWeight(3);
Bearish.Hide();
DefineGlobalColor("Bullish", Color.UPTICK);
DefineGlobalColor("Neutral", Color.GRAY);
DefineGlobalColor("Bearish", Color.DOWNTICK);
AssignPriceColor(if !paintBars then Color.CURRENT else if GreenPrice then GlobalColor("Bullish") else if RedPrice then GlobalColor("Bearish") else GlobalColor("Neutral"));
addOrder(OrderType.BUY_AUTO, Bullish);
addOrder(OrderType.SELL_TO_CLOSE, Neutral);
addOrder(OrderType.SELL_AUTO, Bearish);
addOrder(OrderType.BUY_TO_CLOSE, Neutral);
Hi
tradebyday
How did you do with Westgl strategy ?
I like the idea and have all the info I could find from his trading and wonder if you could try to script a Vertical Line based off of the MF Blue Near and RED momo Lines breaking the 30 displaying a Green Vertical Line and or the Blue Near and Red momo breaking down through the 70 to produce a Red Vertical line ?
Westgl ......
I use the Market Forecast Daily, as a Main study for my success in trading. But I dont use the same way it is listed here. I have addition levels that are more Important. the 80 and 20 lines are just a Visual warning for me and dont provide great importance over all. I use a 30 50 70 Line as these are very Important to trend and taking trades. I use a two time frame approach, a daily chart, with a 5minute chart combination. Lets say I see that NG is either close to, or showing a setup on the daily. This Daily setup would be currently, Green Intermediate Line is above the 30 50 70, I then look at the Blue Near line and Red Momo Line, with the Inter Line High which is Bullish, I wait for the red momo and Blue Near to get Oversold under 20 and come back up to break 30 line this is when, I then start looking at the 5min for trade entries, using a REDSAR .01.05 breakout, and 30High/Low Breaking the High. and staying above it till a GoldSAR .02 .20 is Broken, Once the Daily setup starts I keep taken trades based on the 5min till it no longer breaks out, and or the Daily Red& Blue Lines get up to the 70 to 80 line, then I wait for another daily setup. I trade all Futures this way, and stocks. I have been doing it this way for years. I would Like to see if I can get it a Little more automated though.
I have some code I found a while back that uses the MF Info and provide Vertical lines for it, it is Not exactly how I want it but it is close.
Code:
##############################################################################################
# aaa_BVZ_MFC_Clusters_on_Chart - 8/21/2018 Developed by G. Horschman (
[email protected])
##############################################################################################
# This script will work on any chart. However, it was designed to work in conjunction
# with the Market Scholars Mkt Forecast Posture Script. It can be used to display
# and identify the following signals on the chart:
#
# a) Mkt Forecast Bullish and Bearish Clusters
# b) Mkt Forecast Intermediate Confirmation Signals
# c) Stochastic overbought and oversold signals - K=7,D=3 periods work really well.
# A bullish oversold up-arrow will appear when the "K" line crosses up through the
# "D" line and the "K" line is below the oversold level (25). A bearish overbought
# down-arrow will appear when the "K" line crossed down through the "D" line and
# the "K" line is above the overbought level.
# d) Mkt Forecast Posture in a chart label.
# e) 10 day EMA trend changes
#
# The script can also be used with alert signals to look for conditional setups. All
# indicators can easily be turned or off at will, as what may be appropriate for one symbol
# may not be suitable for others.
DefineGlobalColor("UpArrow", CreateColor(35, 255, 106));
DefineGlobalColor("DownArrow", CreateColor(255, 14, 20));
input ShowIntermediateConfirms = yes;
input ShowMfcClusters = yes;
input ShowStoArrows = yes;
input ShowIntermediateLabel = no;
input Show10DayMovingAvg = no;
def price = close;
def MA30 = SimpleMovingAvg(price = close, length = 30);
def EMA_10day = ExpAverage(close, length = 10);
def MFC = reference MarketForecast.intermediate;
def MFCRising = if MFC >= MFC[1] then 1 else 0;
def MFCPosture = if (MFC > 80) or (MFC > 20 and MFCRising) then 1 else 0;
def MFCURZ = if MFC > 80 then 1 else 0;
def mfcNearTerm = reference MarketForecast.nearterm;
def mfcMomentum = reference MarketForecast.momentum;
def BullishCluster = if MFC < 20 and mfcNearTerm < 20 and mfcMomentum < 20 then 1 else 0;
def BearishCluster = if MFC > 80 and mfcNearTerm > 80 and mfcMomentum > 80 then 1 else 0;
# Plot Clusters on the chart
plot bullDot = if BullishCluster and ShowMfcClusters then low * .996 else Double.NaN;
bullDot.SetStyle(Curve.POINTS);
bullDot.SetLineWeight(5);
bullDot.SetDefaultColor(Color.GREEN);
bullDot.HideBubble();
plot bearDot = if BearishCluster and ShowMfcClusters then high * 1.004 else Double.NaN;
bearDot.SetStyle(Curve.POINTS);
bearDot.SetLineWeight(5);
bearDot.SetDefaultColor(Color.RED);
bearDot.HideBubble();
# Bullish Intermediate Confirmation
def IntermediateConfirmation_Major = if MFCURZ
and mfcMomentum < 20 and mfcMomentum > 5
and mfcNearTerm > 20 and mfcNearTerm < 50 then 1 else 0;
plot IC_major = if ShowIntermediateConfirms and IntermediateConfirmation_Major then MA30 * .99 else Double.NaN;
IC_major.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
IC_major.SetLineWeight(5);
IC_major.AssignValueColor(Color.DARK_ORANGE);
def IntermediateConfirmation_Minor = if MFCURZ
and mfcMomentum < 20 and mfcMomentum > 5
and !(mfcNearTerm > 20 and mfcNearTerm < 50) then 1 else 0;
plot IC_minor = if ShowIntermediateConfirms and IntermediateConfirmation_Minor then MA30 * .99 else Double.NaN;
IC_minor.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
IC_minor.SetLineWeight(2);
IC_minor.AssignValueColor(Color.DARK_ORANGE);
AddLabel (ShowIntermediateLabel, "MFC " + Round(MFC) + " " + if MFCRising then "rising" else "falling", if MFCPosture then Color.GREEN else GlobalColor("DownArrow"));
# +++++++ Show Stochastic Reversals on Chart +++++++++++
def over_bought = 75;
def over_sold = 25;
def KPeriod = 7;
def DPeriod = 3;
def priceH = high;
def priceL = low;
def priceC = close;
def average = AverageType.SIMPLE;
def SlowK = reference StochasticSlow(over_bought,
over_sold,
KPeriod,
DPeriod,
priceH,
priceL,
priceC, AverageType.SIMPLE).SlowK;
def SlowD = reference StochasticSlow(over_bought,
over_sold,
KPeriod,
DPeriod,
priceH,
priceL,
priceC, AverageType.SIMPLE).SlowD;
plot stoUp = if (ShowStoArrows and
SlowK >= SlowD and
SlowK[1] < SlowD[1]) and
SlowK[1] < over_sold then low * .8 else Double.NaN;
plot stoDn = if (ShowStoArrows and
SlowK <= SlowD and
SlowK[1] > SlowD[1]) and
SlowK[1] > over_bought then high * 1.2 else Double.NaN;
stoUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
stoUp.SetLineWeight(3);
stoUp.SetDefaultColor(Color.YELLOW);
stoDn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
stoDn.SetLineWeight(3);
stoDn.SetDefaultColor(Color.YELLOW);
# Plot 10-day EMA Trend Changes
def v_EMA10_up = if EMA_10day > EMA_10day[1] and EMA_10day[1] < EMA_10day[2] then 1 else 0;
def v_EMA10_down = if EMA_10day < EMA_10day[1] and EMA_10day[1] > EMA_10day[2] then 1 else 0;
plot EMA10_up = if v_EMA10_up and Show10DayMovingAvg then EMA_10day else double.Nan;
plot EMA10_down = if v_EMA10_down and Show10DayMovingAvg then EMA_10day else double.Nan;
EMA10_up.SetPaintingStrategy(PaintingStrategy.POINTS);
EMA10_up.SetDefaultColor(color.GREEN);
EMA10_up.SetLineWeight(3);
EMA10_down.SetPaintingStrategy(PaintingStrategy.POINTS);
EMA10_down.SetDefaultColor(color.RED);
EMA10_down.SetLineWeight(3);
I would Like to see the above script draw a Vertical Line it already does this I would like it a little different, based off of the MF Blue Near and RED momo Lines breaking the 30 displaying a Green Vertical Line and or the Blue Near and Red momo breaking down through the 70 to produce a Red Vertical line. It would be Much better if it could display these or separate lines that could be turned on/off when Green Intermediate Line was either in a Positive trend (above 30 50 70 from a Below 20 condition) or a Negative trend (Below 70 50 30 off of a above 80 condition) alerts would also be Great.
I use the Longer time frames to tell me where the Trend starts and finishes, or continues, Coming Out of a timing Low can usually have a Velocity up move, going into a Timing Low can have a Velocity move Down into the timing Low. The SAR Breaks tell me when a Support and resistance is broken, with the Candle immediately after a RedSar Break, is an Important Level, price needs to get past that level, Cycle timing tell me where the changes are, If there is No real pull down into a Low, and you get a Higher low then next high will be a Higher high, and that tells me where the Lows will be this tells me where the Velocity down into the next timing low will occur, and the New timing start will occur for up Velocity will start. I look for timing starts and finishes, Based on cycle timing, I use the SARs based on my SAR timing to tell me when a SAR (SAR + Support and Resistance) is Important to the next trend. So lest say we see a timing Low based on a cycle band occurs and price crosses to the cycle start, you have a Potential setup occurring, then I would look at the Market Forecast or MF to show me what to do next. Lets say you missed Most of the last trend up for what ever reason, When the Price Breaks the GoldSar, this is a Early Warning of either a Trend Change, or a Choppy condition is about to occur. When I Look for these moves on a Daily chart, I will take the trades on a 5 Minute chart, using same sequences. But I now have the trend timing and important support and resistance levels. I chart picture would be important for me to explain the Market Forecast 20-30-50-70-80 Lines
Like Quote ReplyReport
westgl
New member
May 30, 2020
Add bookmark
#13
Looking for a New Trend on Daily chart or Weekly Chart, to establish the Longer trend is Important, as this will tell you What side of the trades will have the Largest Moves, so if the trend is UP on the weekly and daily, then I want to only be looking for Up moves on the Shorter intraday charts, Unless you have a unlaying that is very good at provide two sided trading, into Cycle timing Lows on a Up trend. The Market Forecast, Lets say the MF Green Inter Line is was Below the 20 line and Now has Moved Above 50 line, this is a Bullish Trend, with the Green line High (>50) I would be Looking at the Blue Near Line and the Red Momentum or Momo Line to get back down to 20 as this is a Oversold condition with a Green line above 50 for Trend UP this would be a Good Entry Tell With Green line High, and Blue and Red Getting Oversold at 30 or 20 or lower, when the red and blue come back up to above 20 or 30 line that is the Entry. I tried to paste a chart picture for you that I marked up, But it wont let me paste it. It keeps saying stop correcting. Sorry
Like Quote ReplyReport
westgl
New member
May 30, 2020
Add bookmark
#14
I have a watch list that I have made for my style of trading, that shows the Daily Green in one column breaks 50 line and Blue Breaks in one Column the 50 line, and Intraday columns with a short side and a Long side, My watchlist tells when the setup is close to or has occured.
Like Quote ReplyReport
westgl
New member
May 30, 2020
Add bookmark
#15
I am looking to Automate this strategy a Little more. Right now I put a Alert at where the REDSAR Breaks, and Post Candle High/Low depending on trend direction gets taken out, and GoldSAR Breaks, so I know when the Longer term trend has either started or has Finished. As this tells me when I should be taking trades, or Not taking trades, when a Trend is established, or coming to an end, or when it is Choppy, and to stay out.
When I say Velocity, Into and Out of a cycle. I am referring to How much Movement Velocity of move or speed of Move Down into a Cycle Timing Low. Or the Velocity speed Moving Up Out of a New Cycle Start. When I look at cycle timing, lets use a New Cycle start, for instance, if I get a Good Move up out of a New timing cycle, and it shows it has good velocity right from the start this tells me that I have a Good trend that is strong or good velocity. But If I take the same cycle Timing start, and it does Not move up Out of a Brand new cycle start with Any velocity, but in fact each consecutive candles is the same for a couple/ few candles this tells me we may be in a Choppy sideways condition. I would be looking for something that is performing better off of a New cycle. I watch Most all Futures on my watchlist. I am also watching all FAANNG stocks + MSFT Plus Gold stocks and Gold Miners, Silver Miners, Drillers, and all Currencies. I watch these daily, I do this for a Living everyday, as it is my job/career, I Must have an edge to be able to see what is Hot or near Hot, and What Is Not worth Looking at, as my time is very valuable and it must be used Very wisely.