Hello, I am trying to apply Multicharts' built in "MACD LE" signal to the 3rd data series on my chart, but it is not working for some reason. The code I wrote to do this is below, would really appreciate a code example showing what I did wrong.
FYI: You'll see the third to last line of this code is the only thing I changed from MC's original code in order to get it to apply to data series 3.
Code: Select all
inputs: FastLength( 12 ), SlowLength( 26 ), MACDLength( 9 ) ;
variables: var0( 0 ), var1( 0 ), var2( 0 ) ;
var0 = MACD( Close, FastLength, SlowLength ) ;
var1 = XAverage( var0, MACDLength ) ;
var2 = var0 - var1 ;
condition1 = CurrentBar of data3 > 2 and var2 of data3 crosses over 0 ;
if condition1 then
Buy ( "MacdLE" ) next bar at market ;
Also, I'm not sure if it changes anything about how I'd write this code, but I thought I'd let you know that i'm using this code with Multicharts "Precise Backtesting" feature (explain here
http://bit.ly/1RP8kyM) so that the fills are based on actual Bid and ask prices. With that in mind, I have set the chart (and the "properties>backtesting>extended" tab) so that Bid prices are Data1 and Ask prices are data2.
The data3 series I've referred to above represents 5 minute "Last" bars.
Thanks!