Utilizing Indicator Functions with Multi-Data on MultiCharts

A good portion of my readers use MultiCharts and the similarities between their PowerLanguage and EasyLanguage is almost indistinguishable.  However, I came across a situation where one my clients was getting different values between an indicator function call and the actual plotted indicator when using Multi-Data.

Here is the code that didn’t seem to work, even though it was programmed correctly in TradeStation.

vars:
oDMIPlus1(0),oDMIMinus1(0),oDMI1(0),oADX1(0),oADXR1(0),oVolty1(0),
oDMIPlus2(0,data2),oDMIMinus2(0,data2),oDMI2(0,data2),oADX2(0,data2),oADXR2(0,data2),oVolty2(0,data2),
ema1(0),ema2(0,data2),trendUp(false);



Value1 = DirMovement( H, L, C , Data1ADXLen, oDMIPlus1, oDMIMinus1, oDMI1, oADX1, oADXR1, oVolty1 ) ;
Value2 = DirMovement( H of data2, L of data2, C of data2, Data2ADXLen, oDMIPlus2, oDMIMinus2, oDMI2, oADX2, oADXR2, oVolty2 );

 

Pretty simple – so what is the problem.  Data aliasing was utilized in the Vars: section – this keeps the indicator from being calculated on the time frame of data1.  Its only calculated on the data2 time frame – think of data1 being a 5 min. chart and data2 a 30 min. chart.  I discovered that you have to also add data aliasing to not just the variables used in the indicator function but also to the function call itself.  This line of code fixed the problem:


DirMovement( H of data2, L of data2, C of data2, Value2, oDMIPlus2, oDMIMinus2, oDMI2, oADX2, oADXR2, oVolty2 )data2;
Add data2 after the function call to tie it to data2.

 

See that!  Just add Data2 to the end of the function call.  This verifies in TradeStation and compiles in MC with no problems.

 


Discover more from George Pruitt

Subscribe to get the latest posts sent to your email.

Leave a Reply