- Beranda
- Komunitas
- Pemrograman
- MACD TRUE
Edit Komentar Anda
MACD TRUE
Menjadi Anggota Sejak Jun 23, 2014
12 postingan
Mar 15, 2018 at 08:04
Menjadi Anggota Sejak Jun 23, 2014
12 postingan
Attached is a MACD True indicator by David W. Thomas and it looks good. How can I access the values of each in coding a test script? My attempts have come to nothing. Any help? Where I am I wrong when scripting
double m = iCustom(NULL,0,"MACD True",MODE_MAIN,1);
double n = iCustom(NULL,0,"MACD True",0,MODE_SIGNAL,1);
double p = iCustom(NULL,0,"MACD True",0,MODE_EMA,1); //and I have no idea how to get the histogram value
Thanks inadvance,😞
double m = iCustom(NULL,0,"MACD True",MODE_MAIN,1);
double n = iCustom(NULL,0,"MACD True",0,MODE_SIGNAL,1);
double p = iCustom(NULL,0,"MACD True",0,MODE_EMA,1); //and I have no idea how to get the histogram value
Thanks inadvance,😞
Keep Learning and better your best!!
Menjadi Anggota Sejak Jun 14, 2013
127 postingan
Mar 15, 2018 at 08:35
(diedit Mar 15, 2018 at 08:36 yang lalu)
Menjadi Anggota Sejak Jun 14, 2013
127 postingan
Hi CupOtea,
I know the MACD True, use it myself... :)
The indicator stores the following values:
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,MACDLineBuffer);
SetIndexDrawBegin(0,SlowMAPeriod);
SetIndexStyle(1,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(1,SignalLineBuffer);
SetIndexDrawBegin(1,SlowMAPeriod+SignalMAPeriod);
SetIndexStyle(2,DRAW_HISTOGRAM);
SetIndexBuffer(2,HistogramBuffer);
SetIndexDrawBegin(2,SlowMAPeriod+SignalMAPeriod);
So buffer 0 stores the value for the MACD Line, Buffer 1 the value for the Signal Line, and buffer 2 the value for the Histogram.
So you can try this. I have not tested it, but it should work. Just remember to replace "period", "method" and "price" with the values you want:
YourVariable = iCustom( NULL, 0, "MACD True", period, method, price, 0, 0 ); // BUFFER 0 - MACD Line
YourVariable = iCustom( NULL, 0, "MACD True", period, method, price, 1, 0 ); // BUFFER 1 - Signal Line
YourVariable = iCustom( NULL, 0, "MACD True", period, method, price, 2, 0 ); // BUFFER 2 - Histogram
Hope this helps. :)
I know the MACD True, use it myself... :)
The indicator stores the following values:
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,MACDLineBuffer);
SetIndexDrawBegin(0,SlowMAPeriod);
SetIndexStyle(1,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(1,SignalLineBuffer);
SetIndexDrawBegin(1,SlowMAPeriod+SignalMAPeriod);
SetIndexStyle(2,DRAW_HISTOGRAM);
SetIndexBuffer(2,HistogramBuffer);
SetIndexDrawBegin(2,SlowMAPeriod+SignalMAPeriod);
So buffer 0 stores the value for the MACD Line, Buffer 1 the value for the Signal Line, and buffer 2 the value for the Histogram.
So you can try this. I have not tested it, but it should work. Just remember to replace "period", "method" and "price" with the values you want:
YourVariable = iCustom( NULL, 0, "MACD True", period, method, price, 0, 0 ); // BUFFER 0 - MACD Line
YourVariable = iCustom( NULL, 0, "MACD True", period, method, price, 1, 0 ); // BUFFER 1 - Signal Line
YourVariable = iCustom( NULL, 0, "MACD True", period, method, price, 2, 0 ); // BUFFER 2 - Histogram
Hope this helps. :)
Keep it simple, be disciplined, get rich slowly and above all protect your equity!
Menjadi Anggota Sejak Jun 23, 2014
12 postingan
Mar 15, 2018 at 10:22
Menjadi Anggota Sejak Jun 23, 2014
12 postingan
Thanks JacoAF, but it isn't working. Still getting Null values.
Keep Learning and better your best!!
Menjadi Anggota Sejak Jun 14, 2013
127 postingan
Mar 15, 2018 at 11:40
(diedit Mar 15, 2018 at 11:43 yang lalu)
Menjadi Anggota Sejak Jun 14, 2013
127 postingan
CupOtea posted:
Thanks JacoAF, but it isn't working. Still getting Null values.
Hi,
Sorry I made a mistake in the code. Try this, I tested it and it seems to work.
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
double MACDLineValue;
double SignalLineValue;
double HistogramValue;
MACDLineValue = iCustom( NULL, 0, "MACD True", 12, 26, 9, 0, 0 ); // BUFFER 0 - MACD Line
SignalLineValue = iCustom( NULL, 0, "MACD True", 12, 26, 9, 1, 0 ); // BUFFER 1 - Signal Line
HistogramValue = iCustom( NULL, 0, "MACD True", 12, 26, 9, 2, 0 ); // BUFFER 0 - Histogram
Alert("MACD Line: " + DoubleToStr(MACDLineValue) + ", Signal Line: " + DoubleToStr(SignalLineValue) + ", Histogram: " + DoubleToStr(HistogramValue));
}
//+------------------------------------------------------------------+
The "Alert" function is just to test and compare the values to the Data Window values
Keep it simple, be disciplined, get rich slowly and above all protect your equity!
Menjadi Anggota Sejak Jun 23, 2014
12 postingan
Mar 15, 2018 at 11:44
Menjadi Anggota Sejak Jun 23, 2014
12 postingan
No buddy, It aint working. Perhaps I need a copy of your MACD True
Keep Learning and better your best!!
Menjadi Anggota Sejak Jun 14, 2013
127 postingan
Mar 15, 2018 at 11:50
(diedit Mar 15, 2018 at 11:52 yang lalu)
Menjadi Anggota Sejak Jun 14, 2013
127 postingan
Ok here is what I use...
MACD_True.mq4 (Indicator), other one is the sample script code.
Just a note... in the sample code I used "MACD True" as the indicator name.... the attached indicator does not have the space... use "MACDTrue as the name
MACD_True.mq4 (Indicator), other one is the sample script code.
Just a note... in the sample code I used "MACD True" as the indicator name.... the attached indicator does not have the space... use "MACDTrue as the name
Keep it simple, be disciplined, get rich slowly and above all protect your equity!
Menjadi Anggota Sejak Jun 14, 2013
127 postingan
Mar 15, 2018 at 11:53
(diedit Mar 15, 2018 at 11:55 yang lalu)
Menjadi Anggota Sejak Jun 14, 2013
127 postingan
I just noticed something... when I paste the code here it changes the double quotes to single quotes... probably why it does not work.... the indicator name MUST be between double quotes...
see the script sample, and remember to use the indicator name exactly as it appears on your PC...
see the script sample, and remember to use the indicator name exactly as it appears on your PC...
Keep it simple, be disciplined, get rich slowly and above all protect your equity!
Menjadi Anggota Sejak Jun 23, 2014
12 postingan
Mar 15, 2018 at 12:10
Menjadi Anggota Sejak Jun 23, 2014
12 postingan
I am somewhere there. I have installed in a different broker's MT4 and old MACD True is working. Yours too. I need to revisit my usual broker and find out why it aint working.
Thanks buddy.
Thanks buddy.
Keep Learning and better your best!!
*Penggunaan komersial dan spam tidak akan ditoleransi dan dapat mengakibatkan penutupan akun.
Tips: Memposting URL gambar/YouTube akan otomatis menyematkannya di postingan Anda!
Tips: Ketik tanda @ untuk melengkapi nama pengguna secara otomatis yang berpartisipasi dalam diskusi ini.