NexusFi: Find Your Edge


Home Menu

 





Multiple MACD in EL


Discussion in TradeStation

Updated
    1. trending_up 1,792 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 4 posts
    2. attach_file 1 attachments




 
Search this Thread

Multiple MACD in EL

  #1 (permalink)
Saraf64
Los Angeles, CA, USA
 
Posts: 14 since Mar 2014
Thanks Given: 3
Thanks Received: 0

Hi! I am quite new at EL programming and would like to get help on creating a MACD indicator to plot two MACD's with their individual parameters in the same pane as one code. Thank you.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
Battlestations: Show us your trading desks!
26 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
The Program
18 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623

Hi Saraf64,

when using two individual MACDs in the same pane using the same scaling doesn't work for you, take a look at the build in MACD indicator code. Just duplicate the code and add a 2 to all inputs and variables in the duplication part of the code.
This would be a quick and dirty approach, but it would do what you have in mind.

Regards,
ABCTG


Saraf64 View Post
Hi! I am quite new at EL programming and would like to get help on creating a MACD indicator to plot two MACD's with their individual parameters in the same pane as one code. Thank you.


Follow me on Twitter Reply With Quote
  #3 (permalink)
Saraf64
Los Angeles, CA, USA
 
Posts: 14 since Mar 2014
Thanks Given: 3
Thanks Received: 0


Hi ABCTG.

Thank you for your response. I (think) I tried your suggestion, but didn't get the result I was hoping for, but I believe you might have put me in the right direction. Let me explain my intention a little further. This is the beginning of a bigger plan for creating a strategy with multiple MACD's. Basically I have plotted multiple MACD's (with different parameters) in one pane (for visual purpose). I have done thorough studies of my system and although it's not the "Holy Grail", the results are quite astounding. Perhaps it is something that might interest you as well.

Please see the attached chart and give me your thoughts on it.

Thank you much
Saraf64



ABCTG View Post
Hi Saraf64,

when using two individual MACDs in the same pane using the same scaling doesn't work for you, take a look at the build in MACD indicator code. Just duplicate the code and add a 2 to all inputs and variables in the duplication part of the code.
This would be a quick and dirty approach, but it would do what you have in mind.

Regards,
ABCTG


Attached Thumbnails
Click image for larger version

Name:	MACD.jpg
Views:	160
Size:	537.5 KB
ID:	141019  
Reply With Quote
  #4 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623

Saraf64,

it looks okay from the screenshot, but it's a possibility that the scaling is different for all three MACDs.
You can compare this to a study where two MACDs come out of one indicator.
 
Code
inputs:
	int FastLength( 12 ), { the shorter of the two exponential moving average
	 lengths used to calculate the MACD value, in bars }
	int SlowLength( 26 ), { the longer of the two exponential moving average
	 lengths used to calculate the MACD value, in bars }
	int MACDLength( 9 ), { the number of bars over which to exponentially average
	 the MACD value }
	int MACDDiff_Up_Color( Green ), { color to be used to plot positive values of
	 MACDDiff }
	int MACDDiff_Down_Color( Red ), { color to be used to plot negative values of
	 MACDDiff }
	int FastLength2( 24 ), { the shorter of the two exponential moving average
	 lengths used to calculate the MACD value, in bars }
	int SlowLength2( 52 ), { the longer of the two exponential moving average
	 lengths used to calculate the MACD value, in bars }
	int MACDLength2( 18 ), { the number of bars over which to exponentially average
	 the MACD value }
	int MACDDiff_Up_Color2( DarkGreen ), { color to be used to plot positive values of
	 MACDDiff }
	int MACDDiff_Down_Color2( DarkRed ); { color to be used to plot negative values of
	 MACDDiff }

variables:
	double MyMACD( 0 ),
	double MACDAvg( 0 ),
	double MACDDiff( 0 ),
	double HistogramColor( 0 ),
	double MyMACD2( 0 ),
	double MACDAvg2( 0 ),
	double MACDDiff2( 0 ),
	double HistogramColor2( 0 );
		
MyMACD = MACD( Close, FastLength, SlowLength ) ;
MACDAvg = XAverage( MyMACD, MACDLength ) ;
MACDDiff = MyMACD - MACDAvg ;
HistogramColor = iff( MACDDiff > 0, MACDDiff_Up_Color, MACDDiff_Down_Color ) ;

MyMACD2 = MACD( Close, FastLength2, SlowLength2 ) ;
MACDAvg2 = XAverage( MyMACD2, MACDLength2 ) ;
MACDDiff2 = MyMACD2 - MACDAvg2 ;
HistogramColor2 = iff( MACDDiff2 > 0, MACDDiff_Up_Color2, MACDDiff_Down_Color2 ) ;

Plot1( MyMACD, "MACD" ) ;
Plot2( MACDAvg, "MACDAvg" ) ;
Plot3( MACDDiff, "MACDDiff", HistogramColor ) ;
Plot4( MyMACD2, "MACD2" ) ;
Plot5( MACDAvg2, "MACDAvg2" ) ;
Plot6( MACDDiff2, "MACDDiff2", HistogramColor ) ;
Plot7( 0, "ZeroLine" )
Regards,
ABCTG

Follow me on Twitter Reply With Quote
  #5 (permalink)
Saraf64
Los Angeles, CA, USA
 
Posts: 14 since Mar 2014
Thanks Given: 3
Thanks Received: 0

Thank you. As soon as I posted the last message, I went back and added the "2" that you had mentioned to wherever I thought it would make sense and I got the result I was looking for.


inputs: FastLength( 12 ), SlowLength( 26 ), MACDLength( 9 ) ;
variables: MyMACD( 0 ), MACDAvg( 0 ), MACDDiff( 0 ) ;

MyMACD = MACD( Close, FastLength, SlowLength ) ;
MACDAvg = XAverage( MyMACD, MACDLength ) ;
MACDDiff = MyMACD - MACDAvg ;

Plot1( MyMACD, "MACD" ) ;
Plot2( MACDAvg, "MACDAvg" ) ;
Plot3( MACDDiff, "MACDDiff" ) ;
Plot4( 0, "ZeroLine" ) ;

{ Alert criteria }
if MACDDiff crosses over 0 then
Alert( "Bullish alert" )
else if MACDDiff crosses under 0 then
Alert( "Bearish alert" ) ;

inputs: FastLength2( 48 ), SlowLength2( 104 ), MACDLength2( 9 ) ;
variables: MyMACD2( 0 ), MACDAvg2( 0 ), MACDDiff2( 0 ) ;

MyMACD2 = MACD( Close, FastLength2, SlowLength2 ) ;
MACDAvg2 = XAverage( MyMACD2, MACDLength2 ) ;
MACDDiff2 = MyMACD2 - MACDAvg2 ;

Plot5( MyMACD2, "MACD" ) ;
Plot6( MACDAvg2, "MACDAvg" ) ;
Plot7( MACDDiff2, "MACDDiff" ) ;
Plot8( 0, "ZeroLine" ) ;

{ Alert criteria }
if MACDDiff crosses over 0 then
Alert( "Bullish alert" )
else if MACDDiff crosses under 0 then
Alert( "Bearish alert" ) ;


That's Part 1 of the strategy. Let me know if you would be interested in working with me on this strategy. I believe the results will quite surprise you

Thanks a lot again
Saraf64




ABCTG View Post
Saraf64,

it looks okay from the screenshot, but it's a possibility that the scaling is different for all three MACDs.
You can compare this to a study where two MACDs come out of one indicator.
[Code]

Regards,
ABCTG


Reply With Quote




Last Updated on March 19, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts