NexusFi: Find Your Edge


Home Menu

 





convert MACD_ZeroLag Ninja indicator to Multi Charts


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one emini_Holy_Grail with 2 posts (0 thanks)
    2. looks_two cbritton with 1 posts (5 thanks)
    3. looks_3 ABCTG with 1 posts (0 thanks)
    4. looks_4 cory with 1 posts (0 thanks)
    1. trending_up 4,571 views
    2. thumb_up 5 thanks given
    3. group 5 followers
    1. forum 7 posts
    2. attach_file 1 attachments




 
Search this Thread

convert MACD_ZeroLag Ninja indicator to Multi Charts

  #1 (permalink)
 emini_Holy_Grail 
Dallas,TX
 
Experience: Intermediate
Platform: NinjaTrader, OpenQuant
Broker: Zaner/Zen Fire
Trading: ES,6E,6B,GC,CL
Posts: 597 since Nov 2009
Thanks Given: 176
Thanks Received: 126

Can anyone help to convert this Ninja indicator to Multi Charts
MACD_ZeroLag_Colors_BigMike_ctrlbrk.zip

View Download Details - Big Mike's Trading Forum

thks and appreciate it

I am not sure if there is a thread about conversions to Multi Charts

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
MC PL editor upgrade
MultiCharts
How to apply profiles
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
28 thanks
Tao te Trade: way of the WLD
24 thanks
Diary of a simple price action trader
21 thanks
My NQ Trading Journal
14 thanks
GFIs1 1 DAX trade per day journal
9 thanks
  #3 (permalink)
 
cbritton's Avatar
 cbritton 
Atlanta, Georgia
 
Experience: Intermediate
Platform: NT
Broker: DDT
Trading: ZN, ZB
Posts: 230 since Mar 2010
Thanks Given: 152
Thanks Received: 256


I have TS, so here's the code you can add to MC.

Zero Lag EMA function. Save it as "_ZeroLagEMA"

 
Code
{
Zero Lag EMA

from the NT version

            EMA ema1 = EMA(Input, Period);
            double difference = ema1[0] - EMA(ema1, Period)[0];
            ZLEMA.Set(ema1[0] + difference);
            
}
input: price(NumericSeries),
        period(NumericSimple);


Value1 = XAverage(price, period);
// diff
Value2 = value1[0] - XAverage(value1, period);
// zlema
Value3 = value1 + value2;

_ZeroLagEMA = value3;
ADXVMA function (also found elsewhere on nexusfi.com (formerly BMT)). Save it as "ADXVMA".

 
Code
// Big Mike Trading https://nexusfi.com
// April 17 2010
// Converted from NinjaTrader version, original author unknown
// Function

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

vars:
    TR(0),
    DI_Diff(0),
    DI_Sum(0),
    ma(0),
    pdm(0),
    mdm(0),
    pdi(0),
    mdi(0), 
    DI_Factor(0), 
    VI(0), 
    diff(0), 
    HHV(0), 
    LLV(0),
    WeightDM(Length), 
    WeightDI(Length), 
    WeightDX(Length),
    ChandeEMA(Length),
    out(0),
    j(0);

once ma=Price;    

if(Price>Price[1]) then pdm=Price-Price[1] else mdm=Price[1]-Price;//This array is not displayed.

pdm=((WeightDM-1)*pdm[1] + pdm)/WeightDM;//ema.
mdm=((WeightDM-1)*mdm[1] + mdm)/WeightDM;//ema.

TR=pdm+mdm;

if (TR>0) then begin    pdi=pdm/TR; mdi=mdm/TR; end
 else begin
    pdi=0;
    mdi=0;
end;

pdi=((WeightDI-1)*pdi[1] + pdi)/WeightDI;//ema.
mdi=((WeightDI-1)*mdi[1] + mdi)/WeightDI;//ema.
DI_Diff=pdi-mdi;
  
if (DI_Diff<0) then  DI_Diff= -DI_Diff;//Only positive momentum signals are used.

DI_Sum=pdi+mdi;
DI_Factor=0;//Zero case, DI_Diff will also be zero when DI_Sum is zero.

if (DI_Sum>0) then out=DI_Diff/DI_Sum else out=0;

out=((WeightDX-1)*out[1] + out)/WeightDX;
//HHV = highest(out, length+1);
//LLV = lowest(out, length+1);

if (out>out[1]) then begin HHV=out; LLV=out[1]; end 
 else begin
    HHV=out[1];
    LLV=out;
end;

for j = 1 to Length-1 begin    
    if(out[j+1]>HHV)then HHV=out[j+1];
    if(out[j+1]<LLV) then LLV=out[j+1];
end;

diff = HHV - LLV;
VI=0;

if (diff>0) then  VI=(out-LLV)/diff;
          
ma=((ChandeEMA-VI)*ma[1]+VI*Price)/ChandeEMA;//Chande VMA formula with ema built in.

ADXVMA = ma;
The indicator itself.

 
Code
{
MACD using the ZeroLag EMA function and ADXVMA function.
Converted from the NT version on BigMike's
}

input: price(close),
       fast(12),
       slow(26),
       smoothing(9),
       threshold(0),  // amount past zero line it needs to cross to trigger
       acceleration(1);  // 0.5, 1, 1.5, 2.0
vars:
    fastEMA(0),
    diff(0),
    macd1(0),
    macdAvg2(0),
    adxvma1(0),
    signal(0);
    
value1 = fast/acceleration; //
value2 = slow/acceleration; // 
fastEma = _ZeroLagEMA(price, value1) - _ZeroLagEMA(price, value2);

macdAvg2 = _ZeroLagEMA(fastEMA, smoothing);
adxvma1= ADXVMA(fastEMA, value1);
diff = fastEMA - macdAvg2;

Plot1(fastEMA, "MACD");
Plot2(macdAvg2, "Avg");
Plot8(0, "MACD_");
Plot3(diff, "Diff");  //histogram
Plot5(0, "MACD Up");
Plot6(0, "MACD Down");
Plot7(0, "MACD Neutral");

noPlot(5);
noPlot(6);
noPlot(7);

//todo - add alers on the threshold 
if fastEMA > adxvma1 and fastEMA > threshold then begin
    setPlotColor(8, getPlotcolor(5));
end else if fastEMA < adxvma1 and fastEMA < -threshold then begin
    setPlotColor(8, getPlotcolor(6));
end else begin
    setPlotColor(8, getPlotcolor(7));
end;
I did not add the alerts for the signals. If you want it, let me know and I'll add it. Also included a screen shot.

Regards,
-C

“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
Attached Thumbnails
Click image for larger version

Name:	zlmacd_cl.PNG
Views:	422
Size:	51.2 KB
ID:	53491  
Reply With Quote
  #4 (permalink)
 emini_Holy_Grail 
Dallas,TX
 
Experience: Intermediate
Platform: NinjaTrader, OpenQuant
Broker: Zaner/Zen Fire
Trading: ES,6E,6B,GC,CL
Posts: 597 since Nov 2009
Thanks Given: 176
Thanks Received: 126

cbritton
thks much and really appreciate it.
I will have to reinstall MC in another PC and will let you know about the alerts

Started this thread Reply With Quote
  #5 (permalink)
 futuros 
Weston, Florida, USA
 
Experience: Advanced
Platform: Ninja Trader
Trading: ES, CL, TF, 6E, GC
Posts: 47 since Oct 2010
Thanks Given: 49
Thanks Received: 49

Hello big Mike,

Do you or anyone have changed the code for the indicator MACD zero lag colors for Ninja Trader 6.5 to Ninja trader 7.xx?? I've been looking for that indicator every where and couldn't find it.

Thanks,
Alan

Reply With Quote
  #6 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090

a quick search with 'MACD' yielded this

Reply With Quote
  #7 (permalink)
Vinchente
Versailles, Yvelines France
 
Posts: 1 since Jan 2014
Thanks Given: 0
Thanks Received: 0

Hello Big Mike!

This indicator looks great!
But, I am not able to correct the "Compile error" for both functions in MC:
for "_ZeroLagEMA":
------ Compiled with error(s): ------
Compile error
line 0, column 0

For "ADXVM":
------ Compiled with error(s): ------
Compile error
line 0, column 0

What the hell is it, please?

Thank you very much for your support!

Best regards.

Vinchente

Reply With Quote
  #8 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

Vinchente,

maybe your errors are related to this: errLine_0,_errColumn_0,_errLineEnd_0,_errColumnEnd_0. In case this doesn't help you, you will likely have to contact Multicharts support via their chat.

Regards,
ABCTG


Vinchente View Post
Hello Big Mike!

This indicator looks great!
But, I am not able to correct the "Compile error" for both functions in MC:
for "_ZeroLagEMA":
------ Compiled with error(s): ------
Compile error
line 0, column 0

For "ADXVM":
------ Compiled with error(s): ------
Compile error
line 0, column 0

What the hell is it, please?

Thank you very much for your support!

Best regards.

Vinchente


Follow me on Twitter Reply With Quote




Last Updated on January 20, 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