NexusFi: Find Your Edge


Home Menu

 





TS/MC DoubleMA indicator


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one Big Mike with 5 posts (5 thanks)
    2. looks_two ptcm with 3 posts (0 thanks)
    3. looks_3 khellian with 2 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 7,255 views
    2. thumb_up 5 thanks given
    3. group 2 followers
    1. forum 10 posts
    2. attach_file 1 attachments




 
Search this Thread

TS/MC DoubleMA indicator

  #1 (permalink)
 ptcm 
Taiwan
 
Experience: Intermediate
Platform: MC
Posts: 77 since Jun 2010
Thanks Given: 8
Thanks Received: 17

Hello everyone,

I am trying to write the TS/MC codes for a doubleMA (pls see below, the same one big mike has on the August 28, 2009 video)



Big Mike's Trading Blog: videos

Does anyone have any idea on that ?

Basically, I want the MA to be blue if >20ma and red if <20ma.

many thanks....

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
Better Renko Gaps
The Elite Circle
ZombieSqueeze
Platforms and Indicators
How to apply profiles
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
33 thanks
Just another trading journal: PA, Wyckoff & Trends
28 thanks
Bigger Wins or Fewer Losses?
23 thanks
Tao te Trade: way of the WLD
23 thanks
GFIs1 1 DAX trade per day journal
21 thanks
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,444 since Jun 2009
Thanks Given: 33,217
Thanks Received: 101,608


The main difference with doing it in EasyLanguage is MultiCharts (or TradeStation) doesn't have a drop-down menu system to select enums, so it is less user friendly for situations where you have a lot of settings.

But the NT version of DoubleMA is really quite convoluted, it can be written very simply:

 
Code
                            
vars:

doublema (0);

doublema Average(XAverage(Cma1), ma2); 
In English it simply means Average (SMA) of the XAverage (EMA).

Plotting different colors for rising or falling is not hard. I'm sure I've listed examples already on the forum in this section.

You'll want to use a switch () to give the indicator options of defining what type of MA to use, like case 0 = sma, case 1 = ema, case 2 = zerolagema, etc etc.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,444 since Jun 2009
Thanks Given: 33,217
Thanks Received: 101,608

Here, I went ahead and made it for you.

[img]https://nexusfi.com/v/rrxmfp.png[/img]

[img]https://nexusfi.com/v/a3ksy4.png[/img]

[img]https://nexusfi.com/v/tkmne3.png[/img]

Attached is the MultiCharts .pla. Below is the EasyLanguage code.

 
Code
// 6 August 2010
// Big Mike Trading
// www.bigmiketrading.com
// Note:  Comment out the moving averages you don't have, or visit nexusfi.com (formerly BMT) to get them

inputs:
	ma1type ( 0 ),
	ma2type ( 0 ),
	ma1length ( 100 ),
	ma2length ( 20 );
	
vars:
	ma2series ( 0 ),
	dma ( 0 );
	

switch ma2type begin

	default : ma2series = Average(C, ma2length);
	
	case 0	: ma2series = Average(C, ma2length);
	case 1	: ma2series = XAverage(C, ma2length);
	case 2	: ma2series = WAverage(C, ma2length);
	case 3	: ma2series = ADXVMA(C, ma2length);
	case 4	: ma2series = jtHMA(C, ma2length);
	case 5	: ma2series = PMA(C, ma2length, 0, 1);
	case 6	: ma2series = ZeroLagEMA(C, ma2length);
	case 7	: ma2series = ZeroLagWMA(C, ma2length);

end;

switch ma1type begin

	default : dma = Average(ma2series, ma1length);
	
	case 0	: dma = Average(ma2series, ma1length);
	case 1	: dma = XAverage(ma2series, ma1length);
	case 2	: dma = WAverage(ma2series, ma1length);
	case 3	: dma = ADXVMA(ma2series, ma1length);
	case 4	: dma = jtHMA(ma2series, ma1length);
	case 5	: dma = PMA(ma2series, ma1length, 0, 1);
	case 6	: dma = ZeroLagEMA(ma2series, ma1length);
	case 7	: dma = ZeroLagWMA(ma2series, ma1length);

end;

Plot1( dma, "Rising" );
Plot2( dma, "Falling" );
Plot3( dma, "Neutral" );
Plot4( dma, "DoubleMA", iff(dma=dma[1], GetPlotColor(3), iff(dma>dma[1], GetPlotColor(1), GetPlotColor(2))) ) ;
NoPlot(1);
NoPlot(2);
NoPlot(3);
Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Attached Files
Elite Membership required to download: BMT DoubleMA.pla
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #5 (permalink)
 ptcm 
Taiwan
 
Experience: Intermediate
Platform: MC
Posts: 77 since Jun 2010
Thanks Given: 8
Thanks Received: 17

Hello BM,

thanks a lot for your quick response. I was trying to compile the code, but I got stuck at

"case 3 : ma2series = ADXVMA(C, ma2length);"

any idea why ? is ADXVMA a proprietary function ?

Started this thread Reply With Quote
  #6 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,444 since Jun 2009
Thanks Given: 33,217
Thanks Received: 101,608


ptcm View Post
Hello BM,

thanks a lot for your quick response. I was trying to compile the code, but I got stuck at

"case 3 : ma2series = ADXVMA(C, ma2length);"

any idea why ? is ADXVMA a proprietary function ?

Yes, please read the top section of the code, you will see I said to comment out the ones you do not have, or you can use the search feature and find them on futures.io (formerly BMT).

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #7 (permalink)
 ptcm 
Taiwan
 
Experience: Intermediate
Platform: MC
Posts: 77 since Jun 2010
Thanks Given: 8
Thanks Received: 17

I am getting error on this line when compiling.

"Plot4( dma, "DoubleMA", iff(dma=dma[1], GetPlotColor(3), iff(dma>dma[1], GetPlotColor(1), GetPlotColor(2))) ;"

------ Compiled with error(s): ------
syntax error, unexpected ';', expecting ')'
errLine 99, errColumn 108, errLineEnd 99, errColumnEnd 108


why is that ? Can anyone help please ?

Started this thread Reply With Quote
  #8 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,444 since Jun 2009
Thanks Given: 33,217
Thanks Received: 101,608


ptcm View Post
I am getting error on this line when compiling.

"Plot4( dma, "DoubleMA", iff(dma=dma[1], GetPlotColor(3), iff(dma>dma[1], GetPlotColor(1), GetPlotColor(2))) ;"

------ Compiled with error(s): ------
syntax error, unexpected ';', expecting ')'
errLine 99, errColumn 108, errLineEnd 99, errColumnEnd 108


why is that ? Can anyone help please ?

At first glance, looks like you are missing one ) at the end of the sentence before the semicolon, like the error says "Expecting ')' not ';'".

Add another ) after GetPlotColor(2) and before ;

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #9 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,444 since Jun 2009
Thanks Given: 33,217
Thanks Received: 101,608


Big Mike View Post
At first glance, looks like you are missing one ) at the end of the sentence before the semicolon, like the error says "Expecting ')' not ';'".

Add another ) after GetPlotColor(2) and before ;

Mike

I looked again at the code I posted, for some reason one of the parenthesis-semicolon was converted to a smilie, so when you cut/pasted it broke it probably. I fixed it now.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #10 (permalink)
 
khellian's Avatar
 khellian 
Rio Rancho, NM
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Ninja
Trading: CL , ES
Posts: 18 since Feb 2010
Thanks Given: 27
Thanks Received: 4


I'm moving over to MC64 Release Version 9.1 from NT so was glad to see this port. I downloaded the indicator and all the functions associated with it but when I attempted to compile the functions there was a compile error:

--------------------------------
06.10.16 11:43:55
------ Build started: ------
Study: "ZeroLagEMA" (Function)
Please wait ....
------ Compiled with error(s): ------
Compile error
line 0, column 0
---------------------------------

(Line 0, Column 0) threw me I must admit. As I'm new to EasyLanguage I would greatly appreciate any thoughts or suggestions.

Thanks

Reply With Quote




Last Updated on October 6, 2016


© 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