| Trading Indicators Post your custom trading indicators. If you download, remember to click INSTALL. |
![]() | | Tweet | |
Fast BB MACD Details »» | |||||||||||||||||||||||||||
Here is a fast MACD using a Hull Moving Average and a Fractal Moving Average. The FastMACD dots change color when they breach outside their Bollinger Bands (which you can't see). I have taken from other coder's work, so full credit goes to them. I have simply added the faster MAs and incorporated the BBs. This indicator came about just by experimenting. So try an idea out......you never know ![]() It seems to pick the highs and lows nicely. I have coded it with a standard MACD so I can see divergences. You are quite welcome to add or remove anything and post it if you think it has merit. The indicator also has a gapless code added which will take into account opening gaps on intraday charts. I use this with Blu-Ray's Paintbars (Similar to the Heikin Ashi), Double Stochastics and The Gapless Squeeze (here): http://www.traderslaboratory.com/for...html#post68059 Here is the code: Code: {**************FMA Function******************}
// generates very smooth and responsive moving average
// copyright 2008 John McCormick
// feel free to copy and use this code royalty free
// as long as you don't remove the above acknowledgement
//
Inputs:
Price(numericseries),
Length(numericsimple);
Vars:
j(0),
workinglen(maxlist(1,absvalue(Length))),
peak(workinglen/3),
tot(0),
divisor(0);
Array:
val[100](0);
if workinglen>100 then workinglen=100; // use larger array to handle lengths over 100
tot=0;
divisor=0;
for j=1 to floor(workinglen+1) begin
if j<=peak then val[j]=j/peak
else val[j]=(workinglen+1-j)/(workinglen+1-peak);
tot=tot+price[j-1]*val[j];
divisor=divisor+val[j];
end;
if divisor<>0 then FMA_smooth=tot/divisor; Code:
{jtHMA - Hull Moving Average Function}
{Author: Atavachron}
{May 2005}
Inputs: price(NumericSeries), length(NumericSimple);
Vars: halvedLength(0), sqrRootLength(0);
{
Original equation is:
---------------------
waverage(2*waverage(close,period/2)-waverage(close,period), SquareRoot(Period)
Implementation below is more efficient with lengthy Weighted Moving Averages.
In addition, the length needs to be converted to an integer value after it is halved and
its square root is obtained in order for this to work with Weighted Moving Averaging
}
if ((ceiling(length / 2) - (length / 2)) <= 0.5) then
halvedLength = ceiling(length / 2)
else
halvedLength = floor(length / 2);
if ((ceiling(SquareRoot(length)) - SquareRoot(length)) <= 0.5) then
sqrRootLength = ceiling(SquareRoot(length))
else
sqrRootLength = floor(SquareRoot(length));
Value1 = 2 * WAverage(price, halvedLength);
Value2 = WAverage(price, length);
Value3 = WAverage((Value1 - Value2), sqrRootLength);
jtHMA = Value3; Code: {***************FastMACD Function**********************
inputs:
Price( numericseries ),
FastLength( numericsimple ), { this input assumed to be a constant >= 1 }
SlowLength( numericsimple ) ; { this input assumed to be a constant >= 1 }
MACD_HMA_FMA = jthma( Price, FastLength ) - FMA_smooth( Price, SlowLength ) ;
{ ** Copyright (c) 2001 - 2009 tradestation Technologies, Inc. All rights reserved. **
** tradestation reserves the right to modify or overwrite this analysis technique
with each release. ** } Code: {******************FastMACD Indicator*************}
inputs:
price(close),
fastlength (12),
slowlength (26),
signal (9),
BBstDv(1),
DirColor(True),
BBColorUp(White),
BBColorDn(Magenta),
ZeroColor(DarkCyan);
VARS:
BB_Macd(0),
MyMACD(0),
Avg(0),
SDev(0),
Alert_Msg(" "),
Upper_Band(0),
Lower_Band(0),
BBColor(0),
Cross_Up(False),
Cross_Dn(False);
// gapless day transitions - John McCormick May 2008
Vars:
RelO(0), // Relative Open
RelH(0), // Relative High
RelL(0), // Relative low
RelC(0), // Relative Close
gap(0), // the opening gap (modified by the gap coefficient)
GapCoef(1.0), // Gap Coefficient
Accum(0); // The sum of all the daily gaps
if currentsession(0)<>currentsession(0)[1] or date<>date[1] then
begin
gap=GapCoef*(O-C[1]);
Accum=Accum+gap;
end;
if BarType<=1 then //Valid only for Tick or Intraday
begin
RelO = O-Accum;
RelC = C-Accum;
RelH = H-Accum;
RelL = L-Accum;
end
else begin
RelO = O;
RelC = C;
RelH = H;
RelL = L;
end;
// Gapless - end
Var: GL_Price(0);
GL_price = RelC;
If Price=open then GL_price = RelO;
If Price=high then GL_price = RelH;
If Price=low then GL_price = RelL;
BB_Macd = FMA_smooth(MACD_HMA_FMA(GL_price, FastLength, SlowLength),3)*0.5 ;//added xaverage to smooth 'bumps'
MyMACD = MACD( GL_price, FastLength, SlowLength )*1.5 ;
//Avg = FMA_smooth( BB_Macd, Signal);
Avg = XAverage( MyMACD,Signal ) ;
SDev = StandardDev( BB_Macd, Signal, 1);
Upper_Band = ( Avg + BBStDv * SDev );
Lower_Band = ( Avg - BBStDv * SDev );
//******************************************************//
// Sub-Graph plot logic. //
//******************************************************//
if DirColor=True then
begin
If BB_Macd > BB_Macd[1] then BBColor = BBColorUp else BBColor = BBColorDn;
If Cross_Up = False then if BB_Macd > Upper_Band then begin
Cross_Up = True;
Cross_Dn = False;
BBColor = Cyan;
If CheckAlert then Alert( "BB cross up " + Alert_Msg );
end;
If Cross_Dn = False then if BB_Macd < Lower_Band then begin
Cross_Up = False;
Cross_Dn = True;
BBColor = Yellow;
If CheckAlert then Alert( "BB cross down " + Alert_Msg );
end;
Plot1( BB_Macd, "BBMACD" ,BBColor );
Plot2(Avg, "Signal",Cyan);
Plot4( 0, "Zero_Line", ZeroColor );
Plot3(MyMACD, "MACD", green,2);
end
else
setplotcolor(1,green); Download Now
Screenshots Show Your Support
| |||||||||||||||||||||||||||
| Comments |
| | #2 | ||
![]() | Re: Fast BB MACD i found this error : Unknown Function errLine 74, errColumn 10, errLineEnd 74, errColumnEnd 20 refer to FMA_smooth , i 've insert fma function and compile well | ||
| |
|
| The Following User Says Thank You to shrike For This Useful Post: | ||
jemko (10-03-2009) | ||
| | #3 | ||
![]() | Re: Fast BB MACD | ||
| |
|
| The Following User Says Thank You to ajax358 For This Useful Post: | ||
simterann22 (07-01-2009) | ||
| | #4 | ||
![]() | Re: Fast BB MACD make some change now works thanks again | ||
| |
|
| | #5 | ||
![]() | Re: Fast BB MACD *Show crossing of BB's more accurately and to plot the correct BB lines if you so wish (you will however have to 'uncomment' the plots out to show them though). The BB lines were plotted off the standard MACD instead of the FastMACD in V1, but since I do not use the indicator this way I had not noticed. *Allow the 'non directional plot' to work ie. if you do not want the white and magenta directional dots, they will appear green. Of course the colors are mostly hard-coded in EL for simplicity but you can easily change them if you wish to do so. *Fixed the alert. Please let me know if you know of any more bugs or any new ways to improve this indicator. Cheers. Code: {************************sk_FastMACD_Gapless*********************}
{************************Simterann22 2009************************}
inputs:
price(close),
fastlength (12),
slowlength (26),
signal (9),
BBstDv(1),
DirColor(True),
BBColorUp(White),
BBColorDn(Magenta),
ZeroColor(DarkCyan);
VARS:
BB_Macd(0),
MyMACD(0),
Avg(0),
AvgBB(0),
SDev(0),
Alert_Msg(" "),
Upper_Band(0),
Lower_Band(0),
BBColor(0),
Cross_Up(False),
Cross_Dn(False);
// gapless day transitions - John McCormick May 2008
Vars:
RelO(0), // Relative Open
RelH(0), // Relative High
RelL(0), // Relative low
RelC(0), // Relative Close
gap(0), // the opening gap (modified by the gap coefficient)
GapCoef(1.0), // Gap Coefficient
Accum(0); // The sum of all the daily gaps
if currentsession(0)<>currentsession(0)[1] or date<>date[1] then
begin
gap=GapCoef*(O-C[1]);
Accum=Accum+gap;
end;
if BarType<=1 then //Valid only for Tick or Intraday
begin
RelO = O-Accum;
RelC = C-Accum;
RelH = H-Accum;
RelL = L-Accum;
end
else begin
RelO = O;
RelC = C;
RelH = H;
RelL = L;
end;
// Gapless - end
Var: GL_Price(0);
GL_price = RelC;
If Price=open then GL_price = RelO;
If Price=high then GL_price = RelH;
If Price=low then GL_price = RelL;
BB_Macd = FMA_smooth(MACD_HMA_FMA(GL_price, FastLength, SlowLength),3)*0.5 ;//added FMA_smooth to smooth 'bumps'
MyMACD = MACD( GL_price, FastLength, SlowLength )*1.5 ;//Standard MACD
Avg = XAverage( MyMACD, Signal);//Plotted standard MACD signal
AvgBB = XAverage( BB_Macd,Signal ) ;//Average for FastMACD, not plotted
SDev = StandardDev( BB_Macd, Signal, 1);
Upper_Band = ( AvgBB + BBStDv * SDev );
Lower_Band = ( AvgBB - BBStDv * SDev );
if DirColor=True then
begin
If BB_Macd > BB_Macd[1] then BBColor = BBColorUp else BBColor = BBColorDn;
If Cross_Up = False then if BB_Macd > Upper_Band then begin
Cross_Up = True;
Cross_Dn = False;
BBColor = Cyan;
Alert( "BB cross up ");
end;
If Cross_Dn = False then if BB_Macd < Lower_Band then begin
Cross_Up = False;
Cross_Dn = True;
BBColor = Yellow;
Alert( "BB cross down ");
end;
Plot1( BB_Macd, "BBMACD" ,BBColor );
end
else begin
Plot1( BB_Macd, "BBMACD" ,Green);
end;
Plot2(Avg, "Signal",Cyan,1);
Plot3(MyMACD, "MACD", Green,2);
Plot4( 0, "Zero_Line", ZeroColor );
//Plot5(Upper_Band,"Upper Band",Red,1);
//Plot6(Lower_Band,"Lower Band",Red,1); | ||
| |
|
| | #6 | ||
![]() | Re: Fast BB MACD Just add: Code: //Squeeze Input SQLength(20), nKeltner(1.5), nBBands(2), AlertLine( 1); Then add below your FastMACD code: Code: Vars: SDevSQ(0),ATR(0),LHMult(0),Denom(0),BBS_Ind(0); if ( barnumber=1 ) then Begin If minmove <> 0 then LHMult = pricescale/minmove; end; ATR = AvgTrueRangeGL(SQLength); SDevSQ = StandardDev(RelC, SQLength, 1); Denom = (nKeltner*ATR); If Denom <> 0 then BBS_Ind = (nBBands * SDevSQ) /Denom; If BBS_Ind < Alertline then SetPlotColor(1, Red); This turns the FastMACD dots to red if a BB Squeeze is happening ie. when the BBs are inside the Keltner Channels. So when it turns red look for chop and slowing of volatility. When it exits red along with an increase in the distance between the dots you may be looking at a decent move. You can change the squeeze length, BB and KC settings to suit your taste. Edit: In order for this to work you will need to install the Gapless Squeeze http://www.traderslaboratory.com/for...html#post68059, because you'll need the AvgTrueRangeGL function. If you don't want to bother then just change AvgTrueRangeGL to AvgTrueRange (although it won't be as accurate for session gaps). Last edited by simterann22; 07-01-2009 at 08:27 PM. | ||
| |
|
| The Following User Says Thank You to simterann22 For This Useful Post: | ||
Tams (07-01-2009) | ||
| | #7 | ||
![]() | Re: Fast BB MACD Quote:
one small EasyLanguage programming note: you can have more than ONE input section. i.e. if you add the following after the first input section, you don't have to worry about changing the semi-colon. //Squeeze Input INPUT: SQLength(20), nKeltner(1.5), nBBands(2), AlertLine( 1); | ||
| |
|
| The Following User Says Thank You to Tams For This Useful Post: | ||
simterann22 (07-01-2009) | ||
![]() |
| Tags |
| bollinger band, macd |
| Thread Tools | |
| Help Others By Rating This Thread | |
| |
| ∧ Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| FAST BUCKS: How Porsche Made Billions | taq | Trading Videos | 3 | 07-03-2011 03:13 AM |
| Screaming Fast Moving Average | Minetoo | Trading Indicators | 47 | 04-10-2011 12:46 PM |
| Poker & Fast Intra-Session Trading | UrmaBlume | Technical Analysis | 18 | 02-04-2009 02:01 AM |
| Is Ninja/Zen Fast Enough for EMini Futures Trading | Khepfere | Futures Trading Laboratory | 15 | 11-23-2008 09:37 AM |
| Reg NMS - Fast Fills on NYSE? | The Bear | Stock Trading Laboratory | 0 | 03-10-2007 06:39 PM |