I want to add a logmacd study to multicharts.
Open the original MACD indicator for the code:
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 ;
Plot1( var0, "MACD" ) ;
Plot2( var1, "MACDAvg" ) ;
Plot3( var2, "MACDDiff" ) ;
Plot4( 0, "ZeroLine" ) ;
Copy that to a new indicator, and use the
Log() keyword to calculate the log value. Since you didn't specify of what value you wanted to take the logarithmic value of, let's assume it's the close. The code then becomes:
Code: Select all
inputs: FastLength( 12 ), SlowLength( 26 ), MACDLength( 9 ) ;
variables: var0( 0 ), var1( 0 ), var2( 0 ) ;
var0 = MACD( Log(Close), FastLength, SlowLength ) ;
var1 = XAverage( var0, MACDLength ) ;
var2 = var0 - var1 ;
Plot1( var0, "MACD" ) ;
Plot2( var1, "MACDAvg" ) ;
Plot3( var2, "MACDDiff" ) ;
Plot4( 0, "ZeroLine" ) ;
The lenghts of the 3 timeseries has to be adjustable
The length of the functions can be set in the default settings of the MACD indicator (see code above: FastLength, SlowLength, MACDLength). But with 'time series' you mean you want three (different?) data series? (Like symbol A, B, and C)
and the signal based on changing color of the bars (at min en max lenghts of the bars = ? differnce of the 2 basiclines).
A signal cannot colour price bars in MultiCharts.
(I can't write such a text myself, I don't understand a thing of Java.)
Luckily, PowerLanguage is much easier than Java, so don't worry.