Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

Recommended Posts

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/forums/f46/gapless-squeeze-6161.html#post68059

 

 

Here is the 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;

 


{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;

 

{***************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. ** }

 

{******************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);


@SK_FAST_MACDBB.ELD

5aa70ef448aaa_FastMACDBB.thumb.jpg.debadb3a5c7c003dd6a91519ada8c23a.jpg

Share this post


Link to post
Share on other sites

hi

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 :(

Share this post


Link to post
Share on other sites

Great ta, thx allot. Is like what I have come up with for MACD primary trading indicator, but did not have the dots....this dot version works great on the crosses in scalping!!!.....great work...thanks... :)

Share this post


Link to post
Share on other sites

I've updated the code to :

 

*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.

 

{************************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);


@SK_FAST_MACDBB_V2.ELD

Share this post


Link to post
Share on other sites

Here's something pretty cool IMHO.....

 

Just add:

 

//Squeeze Input
SQLength(20),
nKeltner(1.5), 
nBBands(2), 
AlertLine( 1);

 

under your FastMACD inputs. (Remember to change the semicolon after 'zerocolor' to a comma (,).

 

Then add below your FastMACD 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); 

 

then press F3 to compile.

 

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/forums/f46/gapless-squeeze-6161.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). :)

Edited by simterann22

Share this post


Link to post
Share on other sites
Here's something pretty cool IMHO.....

 

Just add:

 

//Squeeze Input
SQLength(20),
nKeltner(1.5), 
nBBands(2), 
AlertLine( 1);

 

under your FastMACD inputs. (Remember to change the semicolon after 'zerocolor' to a comma (,).

 

...

 

 

 

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);

Share this post


Link to post
Share on other sites

Ajax358, I'm glad you've found a good use for it. How are you using the indicator? I'm curious to know since you mentioned scalping the crosses. What sort of timeframe? Would you mind sharing?

 

Cheers.

Share this post


Link to post
Share on other sites
Ajax358, I'm glad you've found a good use for it. How are you using the indicator? I'm curious to know since you mentioned scalping the crosses. What sort of timeframe? Would you mind sharing?

 

Cheers.

 

How using?...using it in my existing MACD/Stoch window....found that the std settings of this indicator was completely equal to my own MACD indicator that I had gotten as fast in the turns as i could over 3 years & use it day for emini day trades (my MACD input=8,21,13)....I wait for the MACD to cross the MACD avg, then wait for the MACD to cross the zl. Sometimes will go in earlier if my Stoch has lead the MACD in a certain look, as it leads the macd in every real turn, as have found out over time. I use the "Fast BB MACD", by blocking out as a dot/black all the lines except, except the "BBMACD" line of 'dots', as the color change shows & verifies the MACD cross the MACD Avg great!!!!....the others are blacked out because I already have the MACD/MACD Avg in that level #1, & don't need this ta's lines then, but use the 'dots'. The lines are the same as my MACD input results, so you/anyone could use this indicator & know ya have the very fastest in the turns...great job on this indicator!!!.....I know, I have tested every input value there is in these number areas, & these are the fastest, mine & yours, imo.

 

The time frame is a 166tk NQ & ES....used to use a 89 & 144tk, but found the 116 tk is not only mid way between the two, so maintains the fibanacci ratios, but is smoother than the 89tk & quicker than the 144tk in the turns. So use it as my trade chart & use a 305tk ES &NQ as my anchor charts (305 tk is midway betweee the 377 & 233tk, so maintains again the Fib ratio, & is quicker than the 377tk, but smoother than the 233tk; all my inputs are Fib's numbers in my system).

 

Hope that helps....give it a look & backtest & see what ya think.... :)

Share this post


Link to post
Share on other sites

Thanks Ajax358, I like to hear what other traders are doing. Yeah....similar to my setup but I hadn't quite found my 'perfect' timeframe for the ES etc. yet. Thanks for sharing your setup.

 

Check out the DoubleStoch below. See what you think. It's actually a 'Quadruple Double Stochastic"! I simply made a new indicator with 4 together...it sure beats having to mount 4 each time I want to plot them. I've commented out one of the plots so I really only use 3 at this stage. Here is the text version as well:

 

[LegacyColorValue = true]; 

{_DStoc: Double Stochastic Function}

Inputs: 
DStLen(NumericSimple)
;

Vars:   
Num(0),
Denom(0),
Ratio(0),
PctK(0),
DNum(0),
DDenom(0),
DRatio(0),
DPctK(0);

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


{Stoc}
Num=RelC-_Lst(RelL,DStLen);
Denom=_Hst(RelH,DStLen)-_Lst(RelL,DStLen);
Ratio=IFF(Denom>0,(Num/Denom)*100,Ratio[1]);
PctK=IFF(CurrentBar=1,Ratio,PctK[1]+(.5*(Ratio-PctK[1])));

{DStoc}
DNum=PctK-_Lst(PctK,DStLen);
DDenom=_Hst(PctK,DStLen)-_Lst(PctK,DStLen);
DRatio=IFF(DDenom>0,(DNum/DDenom)*100,DRatio[1]);
DPctK=IFF(CurrentBar=1,DRatio,DPctK[1]+(.5*(DRatio-DPctK[1])));

_DStocGL=DPctK;

 

{_Lst: Calculates Lowest Values}
{Copyright 1998 Walter Bressert} 

Inputs: 
Price(NumericSeries),Length(NumericSimple);

Vars:   
X(0),
Lo(0)
;

Lo=999999;
For X=0 to Length-1 begin
 If Price[X] < Lo then Lo = Price[X];
End;

_Lst=Lo;

 

[LegacyColorValue = true]; 

{_Hst: Calculates Highest Values}
{Copyright 1998 Walter Bressert} 

Inputs: Price(NumericSeries),Length(NumericSimple);

Vars:   X(0),Hi(-999999);

Hi=-999999;
For X=0 to Length-1 begin
 If Price[X]>Hi then Hi=Price[X];
End;

_Hst=Hi;

 

inputs: Test( truefalsesimple ), TrueVal( numericsimple ), FalseVal( numericsimple ) ;

if Test then
IFF = TrueVal 
else 
IFF = FalseVal ;


{ ** Copyright (c) 2001 - 2009 TradeStation Technologies, Inc. All rights reserved. ** 
 ** TradeStation reserves the right to modify or overwrite this analysis technique 
    with each release. ** }

 

[LegacyColorValue = true]; 

{
Double Stochastic 
Plots function _DstocGL}

Inputs: //Len1(17), 
	Len2(28), Len3(42), Len4(85);


//value1 = _DstocGL(Len1);
value2 = _DstocGL(Len2);
value3 = _DstocGL(Len3);
value4 = _DstocGL(Len4);


//plot1 (value1, "Stoch1",red,default,1);
plot2 (value2, "Stoch2",green,default,1);
plot3 (value3, "Stoch3",magenta,default,1);
plot4 (value4, "Stoch4",white,default,2);
plot5 (80, "OB",blue,default,1);
Plot6 (20, "OS",blue,default,1);

 

Enjoy.....

DBL STOCH.ELD

Share this post


Link to post
Share on other sites

YW....& thx for the Dbl Stoch.....will look at it now. I use my Stoch (13,8,8,1,30,70) 'in' my first level w/ the MACD, as in real/true moves, it ALWAYS leads the MACD in the move, & the across the the MACD crosses & zl. WIll see how this one looks in the setup....thx again.... :)

 

Just loaed & backtested it....looks great, the lines cross well in the turns...is near equal to my MACD/Stoch lines cross, in fact almost exactly equal, means great indicator...thx... :)

Edited by ajax358

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Topics

  • Posts

    • $HUBC Hub Cyber Security stock back to 1.01 triple support area with high trade quality, https://stockconsultant.com/?HUBC
    • Date: 2nd May 2024. Market News – Stocks mixed; Yen support still on; Eyes on NFP & Apple tonight. Economic Indicators & Central Banks:   As the Fed maintained a “high-for-longer” stance, stocks gave up their gains with attention turning back to earnings. Chair Powell and the Fed were not as hawkish as feared and the markets reacted immediately and in textbook fashion to the still dovish policy stance. The Fed flagged that recent disappointing inflation readings could make rate cuts a while in coming, but Fed chief Jerome Powell characterized the risk of more hikes as “unlikely,” giving some solace to markets. Stocks traded mixed across Asia, while in Europe, DAX and FTSE futures are finding buyers and US futures are also in demand, after the Fed’s message. Yen: Another suspected intervention by authorities, this time in late New York trading, ran into resistance from traders keen to keep selling the currency. Swiss CPI lifted to 1.4% y/y in April from 1.0% y/y in the previous month. Headline numbers are still at low levels and base effects play a role, with the different timing of Easter this year also likely to distort the picture. That said, the numbers may not question the SNB’s decision to cut rates, but they do not support another rate cut in June. Financial Markets Performance:   The USDIndex has corrected to 105.58, but USDJPY is already inching higher again, after a sharp drop to a low of 153.04 on Tuesday that sparked fresh intervention speculation. The pair is currently trading at 155.38. Treasury yields plunged and were down over double digits before profit taking set in. USOIL finished with a -3.6% loss to $79.00, the lowest since March 12. Currently it is as $79.53. Gold was up 1.4% to $2319.55 per ounce, reclaiming the $2300 level. Market Trends:   Wall Street climbed initially with gains of 1.4% on the NASDAQ, 1.2% on the Dow, and 0.96% on the S&P500. The NASDAQ and S&P500 closed with losses of -0.3%, while the Dow was 0.23% firmer. The Hang Seng rallied more than 2%, and the ASX also posting slight gains, while CSI 300 and Nikkei declined. Apple’s earnings report is due after the US market closes today, will give investors a better sense of how the iPhone maker is weathering a sales slump, due in part to a sluggish China market. Always trade with strict risk management. Your capital is the single most important aspect of your trading business. Please note that times displayed based on local time zone and are from time of writing this report. Click HERE to access the full HFM Economic calendar. Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding on how markets work. Click HERE to register for FREE! Click HERE to READ more Market news. Andria Pichidi Market Analyst HFMarkets Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in FX and CFDs products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
    • $CHWY Chewy stock breakdown watch, https://stockconsultant.com/?CHWY
    • $PYXS Pyxis Oncology stock low volume pullback to 4.32 support area, high trade quality, https://stockconsultant.com/?PYXS
    • $EVER EverQuote stock strong day, breakout, https://stockconsultant.com/?EVER
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.