logMACD
I want to add a logmacd study to multicharts. The lenghts of the 3 timeseries has to be adjustable and the signal based on changing color of the bars (at min en max lenghts of the bars = ? differnce of the 2 basiclines). I know from other platform only about .tas scripts. They are available on the internet. But how to find a study-script for MC ? Does anybody have logmacd for me or can somebody explain what kind of text I can copy to the Power Language editor ? (I can't write such a text myself, I don't understand a thing of Java.) Thanks. Ferdinand
- JoshM
- Posts: 2196
- Joined: May 20 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Open the original MACD indicator for the code:I want to add a logmacd study to multicharts.
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" ) ;
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 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)The lenghts of the 3 timeseries has to be adjustable
A signal cannot colour price bars in MultiCharts.and the signal based on changing color of the bars (at min en max lenghts of the bars = ? differnce of the 2 basiclines).
Luckily, PowerLanguage is much easier than Java, so don't worry.(I can't write such a text myself, I don't understand a thing of Java.)
Dear Josh,
It works, but not as I hope for. Adding Log() does not change the result of the indicator , only the values. the logmacd study - I'm used too - has a really different pattern. Only I have it only as DLL, the unreadable compiled version in my other platform.
Thanks for trying .
It works, but not as I hope for. Adding Log() does not change the result of the indicator , only the values. the logmacd study - I'm used too - has a really different pattern. Only I have it only as DLL, the unreadable compiled version in my other platform.
Thanks for trying .
Without knowing what is in the DLL on your other platform, three other things to try out.
1. Try taking log of the sum of price changes over a certain window and not the log of the price. Typically when you take logs, you take logs of price ratios and not price itself. So try do following:
2. Your other platform may also be referring to the PPO (percentage price oscillator) as log MACD. Google PPO on the web. It takes only 2 lines of PL code.
1. Try taking log of the sum of price changes over a certain window and not the log of the price. Typically when you take logs, you take logs of price ratios and not price itself. So try do following:
Code: Select all
// original code commented out and new code below
// var0 = MACD( Log(Close), FastLength, SlowLength ) ;
// var1 = XAverage( var0, MACDLength ) ;
// var2 = var0 - var1 ;
var0 = xaverage(Log(close/close[1]), FastLength) - xaverage(Log(close/close[1]), SlowLength ) ;