MACD Strategy HELP! - TradeStation | futures io social day trading
futures io futures trading


MACD Strategy HELP!
Updated: Views / Replies:2,808 / 20
Created: by Saraf64 Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

MACD Strategy HELP!

  #1 (permalink)
Trading Apprentice
Los Angeles, CA, USA
 
Futures Experience: Advanced
Platform: TradeStation
Favorite Futures: Forex
 
Posts: 14 since Mar 2014
Thanks: 3 given, 0 received

MACD Strategy HELP!

I have been working on a MACD strategy that involves 3 MACD time frames plotted in one pane (MACD A, MACD B and MACD C). I have gone as far as programming EL to plot the 3 MACD's in the same time frame and that's where my programming ability stops.

 
Code
inputs: FastLength( Value ), SlowLength( Value), MACDLength( Value) ;
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" ) ;

	
inputs: FastLength2( Value), SlowLength2( Value), MACDLength2( Value) ;
variables: MyMACD2( 0 ), MACDAvg2( 0 ), MACDDiff2( 0 ) ;

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

Plot4( MyMACD2, "MACD" ) ;
Plot5( MACDAvg2, "MACDAvg" ) ;
Plot6( MACDDiff2, "MACDDiff" ) ;

inputs: FastLength3( Value), SlowLength3( Value), MACDLength3( Value) ;
variables: MyMACD3( 0 ), MACDAvg3( 0 ), MACDDiff3( 0 ) ;

MyMACD3 = MACD( Close, FastLength3, SlowLength3 ) ;
MACDAvg3 = XAverage( MyMACD3, MACDLength3 ) ;
MACDDiff3 = MyMACD3 - MACDAvg3 ;

Plot7( MyMACD3, "MACD" ) ;
Plot8( MACDAvg3, "MACDAvg" ) ;
Plot9( MACDDiff3, "MACDDiff" ) ;
Plot10( 0, "ZeroLine" ) ;
My intention is to create a strategy (or show me) that will generate a Buy/Sell (or show me signal) when certain events trigger.

For Example:
When MACDDiff A < 0, Then plot a DOT (BEAR) on the current bar (and at bar close) WHEN MACDDiff B < 0 within 5 bars of MACDDiff A.

In other words when MACD A crosses Bear, any time MACD B crosses bear (on the same bar or the next five bars) plot a DOT (show me).

I would also like to be able to do the same with all 3 MACDs so that when all 3 cross in the same direction within 5 bars to plot a DOT (preferably in a separate pane and not on the price chart).

I would appreciate any help to guide me in the right direction.

Thanks

Reply With Quote
 
  #2 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,527 since Apr 2013
Thanks: 229 given, 854 received
Forum Reputation: Legendary

Saraf64,

what exactly seems to be the problem? Start with "When MACDDiff A < 0, Then plot a DOT (BEAR) on the current bar (and at bar close)" and post any issues back here.

Regards,
ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #3 (permalink)
Trading Apprentice
Los Angeles, CA, USA
 
Futures Experience: Advanced
Platform: TradeStation
Favorite Futures: Forex
 
Posts: 14 since Mar 2014
Thanks: 3 given, 0 received



ABCTG View Post
Saraf64,

what exactly seems to be the problem? Start with "When MACDDiff A < 0, Then plot a DOT (BEAR) on the current bar (and at bar close)" and post any issues back here.

Regards,
ABCTG

Thanks ABCTG. The problem is, first and foremost, the programming lingo (plot DOT), and secondly, I need it to plot when MACD B crosses in the same direction as MACD A, BUT within 5 bars. For example, in a H1 TF any time MACD A and MACD B cross in the same direction within a 0-5 bar interval (5 hours), then plot a DOT WHEN MACD B crosses.

BTW, MACD A is the smaller parameter. For example, if MACD A = 12/26/9, MACD B = 24/52/9 and MACD C = 60/130/9.

Also, I need to mention that the crossing is actually the crossing of MACD and MACDAvg. I mentioned MACDDiff because it's the default signal of MACD indicator.

Thanks again

Reply With Quote
 
  #4 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,527 since Apr 2013
Thanks: 229 given, 854 received
Forum Reputation: Legendary

Saraf64,

I would still suggest to start with the simple plot and then gradually make it more complex. For a dot you have to use the same reserved word i.e. PlotX, where X is the PlotNumber. Then you have to change the plot style in the indicator properties to point or cross.

Regards,
ABCTG


Saraf64 View Post
Thanks ABCTG. The problem is, first and foremost, the programming lingo (plot DOT), and secondly, I need it to plot when MACD B crosses in the same direction as MACD A, BUT within 5 bars. For example, in a H1 TF any time MACD A and MACD B cross in the same direction within a 0-5 bar interval (5 hours), then plot a DOT WHEN MACD B crosses.

BTW, MACD A is the smaller parameter. For example, if MACD A = 12/26/9, MACD B = 24/52/9 and MACD C = 60/130/9.

Also, I need to mention that the crossing is actually the crossing of MACD and MACDAvg. I mentioned MACDDiff because it's the default signal of MACD indicator.

Thanks again


Reply With Quote
 
  #5 (permalink)
Elite Member
Newcastle, Australia
 
Futures Experience: Intermediate
Platform: Multicharts 8 - Full Version
Broker/Data: IB
Favorite Futures: SPI,FTSE100, 6E, 6A
 
Posts: 285 since Oct 2010
Thanks: 108 given, 177 received

You mentioned that you did not want the plot to be on the same chart as the price. Plot it in a second chart and plot the 1st macd at a value of 1. Then the second at 0, followed by the 3rd at -1. This the gives you three rows of potential dots on the bottom chart. When they are above each other, you have met your condition.
If you also specified the color in the plot, you could use green dots for longs and red dots for shorts.

Sent from my SM-N9005 using Tapatalk

Reply With Quote
The following user says Thank You to NW27 for this post:
 
  #6 (permalink)
Trading Apprentice
Los Angeles, CA, USA
 
Futures Experience: Advanced
Platform: TradeStation
Favorite Futures: Forex
 
Posts: 14 since Mar 2014
Thanks: 3 given, 0 received


ABCTG View Post
Saraf64,

I would still suggest to start with the simple plot and then gradually make it more complex. For a dot you have to use the same reserved word i.e. PlotX, where X is the PlotNumber. Then you have to change the plot style in the indicator properties to point or cross.

Regards,
ABCTG

ABC,

Here's what I have so far and it is quite obvious that I am nowhere near where I want to be

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

	
inputs: FastLength2( 26 ), SlowLength2( 52 ), MACDLength2( 9 ) ;
variables: MyMACD2( 0 ), MACDAvg2( 0 ), MACDDiff2( 0 ) ;

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

Plot4( MyMACD2, "MACD" ) ;
Plot5( MACDAvg2, "MACDAvg" ) ;
Plot6( MACDDiff2, "MACDDiff" ) ;

inputs: FastLength3( 52 ), SlowLength3( 104 ), MACDLength3( 9 ) ;
variables: MyMACD3( 0 ), MACDAvg3( 0 ), MACDDiff3( 0 ) ;

MyMACD3 = MACD( Close, FastLength3, SlowLength3 ) ;
MACDAvg3 = XAverage( MyMACD3, MACDLength3 ) ;
MACDDiff3 = MyMACD3 - MACDAvg3 ;

Plot7( MyMACD3, "MACD" ) ;
Plot8( MACDAvg3, "MACDAvg" ) ;
Plot9( MACDDiff3, "MACDDiff" ) ;
Plot10( 0, "ZeroLine" ) ;

If MyMACD > MACDAvg then
	Begin
	Plot1 (High, "Bull") ;
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }
		
If MyMACD < MACDAvg then
	Begin
	Plot2 (Low, "Bear");
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }

If MyMACD2 > MACDAvg2 then
	Begin
	Plot3 (High, "Bull") ;
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }
		
If MyMACD2 < MACDAvg2 then
	Begin
	Plot4 (Low, "Bear");
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }
	
	
	If MyMACD3 > MACDAvg3 then
	Begin
	Plot5 (High, "Bull") ;
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }
		
If MyMACD3 < MACDAvg3 then
	Begin
	Plot6 (Low, "Bear");
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }
As I mentioned earlier, my EL skills are very minimal and I have to refer to other indicators and ShowMe's to try and make something out of it. For instance, I don't know how to go about plotting ONE dot (currently plotting a DOT at each bar in a separate pane).

I am going to continue working on this and I would appreciate any feedback.

Thanks again
Saraf64

Reply With Quote
 
  #7 (permalink)
Trading Apprentice
Los Angeles, CA, USA
 
Futures Experience: Advanced
Platform: TradeStation
Favorite Futures: Forex
 
Posts: 14 since Mar 2014
Thanks: 3 given, 0 received


NW27 View Post
You mentioned that you did not want the plot to be on the same chart as the price. Plot it in a second chart and plot the 1st macd at a value of 1. Then the second at 0, followed by the 3rd at -1. This the gives you three rows of potential dots on the bottom chart. When they are above each other, you have met your condition.
If you also specified the color in the plot, you could use green dots for longs and red dots for shorts.

Sent from my SM-N9005 using Tapatalk

Thank you NW,

As you can see from my last post I am trying (and struggling) to get this right, but my knowledge of EL is too limited. I have to be honest and mention that I do not understand what you are referring to as MACD value.

Thanks again for your input.

Reply With Quote
 
  #8 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,527 since Apr 2013
Thanks: 229 given, 854 received
Forum Reputation: Legendary

Saraf64,

you are using duplicate plot numbers in your code, for clarity you should remove the duplicates and also not plot the MACD and the High or Low in the same pane. This will mess up your scaling.
The conditions you used for checking like "MyMACD > MACDAvg " for example, will produce dots as long as they are valid i.e. for every bar where MyMACD is above MACDAvg. If you are looking for the cross over bars, you can either use the reserved word "MyMACD crosses over MACDAvg" or add the additional check that on the previous bar MyMACD was below MACDAvg. In Easylanguage you can reference values from previous bars by adding a square bracket to your variable. The number within the brackets is the number of bars you want to go back where 0 is the current bar.
I'd highly recommend studying the EasyLanguage Essentials pdf that you can download via the Tradestation website, this covers most of the basics.

Regards,
ABCTG


Saraf64 View Post
ABC,

Here's what I have so far and it is quite obvious that I am nowhere near where I want to be

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

	
inputs: FastLength2( 26 ), SlowLength2( 52 ), MACDLength2( 9 ) ;
variables: MyMACD2( 0 ), MACDAvg2( 0 ), MACDDiff2( 0 ) ;

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

Plot4( MyMACD2, "MACD" ) ;
Plot5( MACDAvg2, "MACDAvg" ) ;
Plot6( MACDDiff2, "MACDDiff" ) ;

inputs: FastLength3( 52 ), SlowLength3( 104 ), MACDLength3( 9 ) ;
variables: MyMACD3( 0 ), MACDAvg3( 0 ), MACDDiff3( 0 ) ;

MyMACD3 = MACD( Close, FastLength3, SlowLength3 ) ;
MACDAvg3 = XAverage( MyMACD3, MACDLength3 ) ;
MACDDiff3 = MyMACD3 - MACDAvg3 ;

Plot7( MyMACD3, "MACD" ) ;
Plot8( MACDAvg3, "MACDAvg" ) ;
Plot9( MACDDiff3, "MACDDiff" ) ;
Plot10( 0, "ZeroLine" ) ;

If MyMACD > MACDAvg then
	Begin
	Plot1 (High, "Bull") ;
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }
		
If MyMACD < MACDAvg then
	Begin
	Plot2 (Low, "Bear");
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }

If MyMACD2 > MACDAvg2 then
	Begin
	Plot3 (High, "Bull") ;
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }
		
If MyMACD2 < MACDAvg2 then
	Begin
	Plot4 (Low, "Bear");
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }
	
	
	If MyMACD3 > MACDAvg3 then
	Begin
	Plot5 (High, "Bull") ;
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }
		
If MyMACD3 < MACDAvg3 then
	Begin
	Plot6 (Low, "Bear");
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }
As I mentioned earlier, my EL skills are very minimal and I have to refer to other indicators and ShowMe's to try and make something out of it. For instance, I don't know how to go about plotting ONE dot (currently plotting a DOT at each bar in a separate pane).

I am going to continue working on this and I would appreciate any feedback.

Thanks again
Saraf64


Reply With Quote
 
  #9 (permalink)
Trading Apprentice
Los Angeles, CA, USA
 
Futures Experience: Advanced
Platform: TradeStation
Favorite Futures: Forex
 
Posts: 14 since Mar 2014
Thanks: 3 given, 0 received


ABCTG View Post
Saraf64,

you are using duplicate plot numbers in your code...

Regards,
ABCTG

ABC,

You are absolutely right. The duplicate plot numbers were an error as I was trying different things, such as removing the actual MACD plots. Also thank you for the cross above and below tip. That fixed the issue with plotting dots at each bar.

I have downloaded the EL PDF and started reading it. In my defense I must say that it is overwhelming for an inexperienced programmer such as myself, but I do intend to learn the essentials.

As of now this is what I have so far.

 
Code
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 ;
	
inputs: FastLength2( 26 ), SlowLength2( 52), MACDLength2( 9 ) ;
variables: MyMACD2( 0 ), MACDAvg2( 0 ), MACDDiff2( 0 ) ;

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

inputs: FastLength3( 52 ), SlowLength3( 104), MACDLength3( 9 ) ;
variables: MyMACD3( 0 ), MACDAvg3( 0 ), MACDDiff3( 0 ) ;

MyMACD3 = MACD( Close, FastLength3, SlowLength3 ) ;
MACDAvg3 = XAverage( MyMACD3, MACDLength3 ) ;
MACDDiff3 = MyMACD3 - MACDAvg3 ;

If MyMACD crosses above MACDAvg then
	Begin
	Plot2 (High, "Bull") ;
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }
		
If MyMACD crosses below MACDAvg then
	Begin
	Plot3 (Low, "Bear");
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }

If MyMACD2 crosses above MACDAvg2 then
	Begin
	Plot4 (High, "Bull") ;
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }
		
If MyMACD2 crosses below MACDAvg2 then
	Begin
	Plot5 (Low, "Bear");
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }
	
	If MyMACD3 crosses above MACDAvg3 then
	Begin
	Plot6 (High, "Bull") ;
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }
		
If MyMACD3 crosses below MACDAvg3 then
	Begin
	Plot7 (Low, "Bear");
	Alert;
	end
	
	else
	NoPlot( 1 ) ; { remove the marker }
As for the second part of the strategy I would appreciate if you could give me pointers on bar intervals so that MACD B and MACD C plot a DOT only when their crossings happen within 5 bars of MACD A crossing, otherwise NO DOTS.

I really appreciate your help. I feel I have accomplished more than I was hoping for and only in a few hours

Thanks again

Regards
Saraf64

Reply With Quote
 
  #10 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,527 since Apr 2013
Thanks: 229 given, 854 received
Forum Reputation: Legendary


Saraf64,

you are welcome. I know that it is overwhelming at first, that's why I suggested to start simple. One way to accomplish what you have in mind is store the bar number with a variable when your MACD A crosses (use the reserved word CurrentBar) and compare it to the bar number at the moment your second MACD crosses. If the difference is within your allowed limits, the code can plot the dot.

Regards,
ABCTG

Reply With Quote

Reply



futures io > > > > MACD Strategy HELP!

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
MultiCharts MACD exit strategy bam2809 MultiCharts 2 October 4th, 2013 03:04 PM
I am at my witts end, simple MACD Cross over strategy tomlryde Sierra Chart Programming 11 September 8th, 2013 06:50 PM
MACD biweber NinjaTrader 10 August 20th, 2013 06:15 PM
How to Reference MACD-1 and MACD-2 in the Same Chart a2trader EasyLanguage Programming 3 July 21st, 2013 06:11 PM
Looking for a simple MACD strategy. MACD Xover LONG, go LONG roshareid NinjaTrader Programming 2 April 11th, 2010 09:05 PM


All times are GMT -4. The time now is 04:10 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-12 in 0.13 seconds with 19 queries on phoenix via your IP 54.163.210.170