scouseman Posted February 15, 2010 Report Share Posted February 15, 2010 Hi All, I wonder if somebody could help me out please. I recently paid to have my trend indicator decompiled as I wanted to have a alert coded into it. The indicator is displayed in the form of a histogram, where as the pre decompiled indicator produced a nice histogram my decompiled indicator the histogram bars are all the same length. Firstly could there be anything obvious that would cause such a problem? I have included the MQ4 codein this post , if there is anybody kind enough to look at it for me I would be very grateful, this is the pure decompiled code I received there has been no editing done. Many Thanks for reading my post Cheers scouseman #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 LawnGreen #property indicator_color2 Red extern int CountBars = 500; double g_ibuf_80[]; double g_ibuf_84[]; int init() { string ls_unused_0; IndicatorBuffers(2); SetIndexStyle(0, DRAW_HISTOGRAM); SetIndexBuffer(0, g_ibuf_80); SetIndexStyle(1, DRAW_HISTOGRAM); SetIndexBuffer(1, g_ibuf_84); return (0); } int start() { double ld_12; double ld_20; double ld_28; double ld_36; double ld_44; double ld_52; SetIndexDrawBegin(0, Bars - CountBars + 45); SetIndexDrawBegin(1, Bars - CountBars + 45); int l_ind_counted_8 = IndicatorCounted(); if (Bars <= 44) return (0); if (l_ind_counted_8 < 44) { for (int li_0 = 1; li_0 <= 0; li_0++) g_ibuf_80[CountBars - li_0] = 0.0; for (li_0 = 1; li_0 <= 0; li_0++) g_ibuf_84[CountBars - li_0] = 0.0; } for (li_0 = CountBars - 44 - 1; li_0 >= 0; li_0--) { ld_28 = (Close[li_0 + 0]) / 2.0 + (Close[li_0 + 1]) / 2.0 + 0.2460452079 * (Close[li_0 + 2]) + 0.1104506886 * (Close[li_0 + 3]) - 0.0054034585 * (Close[li_0 + 4]) - 0.0760367731 * (Close[li_0 + 5]) - (Close[li_0 + 6]) / 10.0 - 0.0670110374 * (Close[li_0 + 7]) - 0.0190795053 * (Close[li_0 + 8]) + 0.0259609206 * (Close[li_0 + 9]) + 0.0502044896 * (Close[li_0 + 10]) + 0.0477818607 * (Close[li_0 + 11]) + 0.0249252327 * (Close[li_0 + 12]) - 0.0047706151 * (Close[li_0 + 13]) - 0.0272432537 * (Close[li_0 + 14]) - 0.0338917071 * (Close[li_0 + 15]) - 0.0244141482 * (Close[li_0 + 16]) - 0.0055774838 * (Close[li_0 + 17]) + 0.0128149838 * (Close[li_0 + 18]) + 0.0226522218 * (Close[li_0 + 19]) + 0.0208778257 * (Close[li_0 + 20]) + 0.0100299086 * (Close[li_0 + 21]) - 0.0036771622 * (Close[li_0 + 22]) - 0.013674485 * (Close[li_0 + 23]) - 0.0160483392 * (Close[li_0 + 24]) - 0.0108597376 * (Close[li_0 + 25]) - 0.0016060704 * (Close[li_0 + 26]) + 0.0069480557 * (Close[li_0 + 27]) + 0.0110573605 * (Close[li_0 + 28]) + 0.0095711419 * (Close[li_0 + 29]) + 0.0040444064 * (Close[li_0 + 30]) - 0.0023824623 * (Close[li_0 + 31]) - 0.0067093714 * (Close[li_0 + 32]) - 0.00720034 * (Close[li_0 + 33]) - 0.004771771 * (Close[li_0 + 34]) + 0.0005541115 * (Close[li_0 + 35]) + 0.000786016 * (Close[li_0 + 36]) + (Close[li_0 + 37]) / 76.84677635 + 0.0040364019 * (Close[li_0 + 38]); ld_36 = (-0.02232324 * (Close[li_0 + 0])) + 0.02268676 * (Close[li_0 + 1]) + 0.08389067 * (Close[li_0 + 2]) + 0.1463038 * (Close[li_0 + 3]) + 0.19282649 * (Close[li_0 + 4]) + 0.21002638 * (Close[li_0 + 5]) + 0.19282649 * (Close[li_0 + 6]) + 0.1463038 * (Close[li_0 + 7]) + 0.08389067 * (Close[li_0 + 8]) + 0.02268676 * (Close[li_0 + 9]) - 0.02232324 * (Close[li_0 + 10]) - 0.04296564 * (Close[li_0 + 11]) - 0.03980614 * (Close[li_0 + 12]) - 0.02082171 * (Close[li_0 + 13]) + 0.00243636 * (Close[li_0 + 14]) + 0.0195058 * (Close[li_0 + 15]) + 0.02460929 * (Close[li_0 + 16]) + 0.01799295 * (Close[li_0 + 17]) + 0.0047054 * (Close[li_0 + 18]) - 0.00831985 * (Close[li_0 + 19]) - 0.01544722 * (Close[li_0 + 20]) - 0.01456262 * (Close[li_0 + 21]) - 0.0073398 * (Close[li_0 + 22]) + 0.00201852 * (Close[li_0 + 23]) + 0.00902504 * (Close[li_0 + 24]) + 0.01093067 * (Close[li_0 + 25]) + 0.00766099 * (Close[li_0 + 26]) + 0.00145478 * (Close[li_0 + 27]) - 0.00447175 * (Close[li_0 + 28]) - 0.00750446 * (Close[li_0 + 29]) - 0.00671646 * (Close[li_0 + 30]) - 0.00304016 * (Close[li_0 + 31]) + 0.00143433 * (Close[li_0 + 32]) + 0.00457475 * (Close[li_0 + 33]) + 0.00517589 * (Close[li_0 + 34]) + 0.00336708 * (Close[li_0 + 35]) + 0.00034406 * (Close[li_0 + 36]) - 0.00233637 * (Close[li_0 + 37]) - 0.0035228 * (Close[li_0 + 38]) - 0.00293522 * (Close[li_0 + 39]) - 0.00114249 * (Close[li_0 + 40]) + 0.00083536 * (Close[li_0 + 41]) + 0.00215524 * (Close[li_0 + 42]) + 0.00604133 * (Close[li_0 + 43]) - 0.00013046 * (Close[li_0 + 44]); ld_44 = (Close[li_0 + 0 + 1]) / 2.0 + (Close[li_0 + 1 + 1]) / 2.0 + 0.2460452079 * (Close[li_0 + 2 + 1]) + 0.1104506886 * (Close[li_0 + 3 + 1]) - 0.0054034585 * (Close[li_0 + 4 + 1]) - 0.0760367731 * (Close[li_0 + 5 + 1]) - (Close[li_0 + 6 + 1]) / 10.0 - 0.0670110374 * (Close[li_0 + 7 + 1]) - 0.0190795053 * (Close[li_0 + 8 + 1]) + 0.0259609206 * (Close[li_0 + 9 + 1]) + 0.0502044896 * (Close[li_0 + 10 + 1]) + 0.0477818607 * (Close[li_0 + 11 + 1]) + 0.0249252327 * (Close[li_0 + 12 + 1]) - 0.0047706151 * (Close[li_0 + 13 + 1]) - 0.0272432537 * (Close[li_0 + 14 + 1]) - 0.0338917071 * (Close[li_0 + 15 + 1]) - 0.0244141482 * (Close[li_0 + 16 + 1]) - 0.0055774838 * (Close[li_0 + 17 + 1]) + 0.0128149838 * (Close[li_0 + 18 + 1]) + 0.0226522218 * (Close[li_0 + 19 + 1]) + 0.0208778257 * (Close[li_0 + 20 + 1]) + 0.0100299086 * (Close[li_0 + 21 + 1]) - 0.0036771622 * (Close[li_0 + 22 + 1]) - 0.013674485 * (Close[li_0 + 23 + 1]) - 0.0160483392 * (Close[li_0 + 24 + 1]) - 0.0108597376 * (Close[li_0 + 25 + 1]) - 0.0016060704 * (Close[li_0 + 26 + 1]) + 0.0069480557 * (Close[li_0 + 27 + 1]) + 0.0110573605 * (Close[li_0 + 28 + 1]) + 0.0095711419 * (Close[li_0 + 29 + 1]) + 0.0040444064 * (Close[li_0 + 30 + 1]) - 0.0023824623 * (Close[li_0 + 31 + 1]) - 0.0067093714 * (Close[li_0 + 32 + 1]) - 0.00720034 * (Close[li_0 + 33 + 1]) - 0.004771771 * (Close[li_0 + 34 + 1]) + 0.0005541115 * (Close[li_0 + 35 + 1]) + 0.000786016 * (Close[li_0 + 36 + 1]) + (Close[li_0 + 37 + 1]) / 76.84677635 + 0.0040364019 * (Close[li_0 + 38 + 1]); ld_52 = (-0.02232324 * (Close[li_0 + 0 + 1])) + 0.02268676 * (Close[li_0 + 1 + 1]) + 0.08389067 * (Close[li_0 + 2 + 1]) + 0.1463038 * (Close[li_0 + 3 + 1]) + 0.19282649 * (Close[li_0 + 4 + 1]) + 0.21002638 * (Close[li_0 + 5 + 1]) + 0.19282649 * (Close[li_0 + 6 + 1]) + 0.1463038 * (Close[li_0 + 7 + 1]) + 0.08389067 * (Close[li_0 + 8 + 1]) + 0.02268676 * (Close[li_0 + 9 + 1]) - 0.02232324 * (Close[li_0 + 10 + 1]) - 0.04296564 * (Close[li_0 + 11 + 1]) - 0.03980614 * (Close[li_0 + 12 + 1]) - 0.02082171 * (Close[li_0 + 13 + 1]) + 0.00243636 * (Close[li_0 + 14 + 1]) + 0.0195058 * (Close[li_0 + 15 + 1]) + 0.02460929 * (Close[li_0 + 16 + 1]) + 0.01799295 * (Close[li_0 + 17 + 1]) + 0.0047054 * (Close[li_0 + 18 + 1]) - 0.00831985 * (Close[li_0 + 19 + 1]) - 0.01544722 * (Close[li_0 + 20 + 1]) - 0.01456262 * (Close[li_0 + 21 + 1]) - 0.0073398 * (Close[li_0 + 22 + 1]) + 0.00201852 * (Close[li_0 + 23 + 1]) + 0.00902504 * (Close[li_0 + 24 + 1]) + 0.01093067 * (Close[li_0 + 25 + 1]) + 0.00766099 * (Close[li_0 + 26 + 1]) + 0.00145478 * (Close[li_0 + 27 + 1]) - 0.00447175 * (Close[li_0 + 28 + 1]) - 0.00750446 * (Close[li_0 + 29 + 1]) - 0.00671646 * (Close[li_0 + 30 + 1]) - 0.00304016 * (Close[li_0 + 31 + 1]) + 0.00143433 * (Close[li_0 + 32 + 1]) + 0.00457475 * (Close[li_0 + 33 + 1]) + 0.00517589 * (Close[li_0 + 34 + 1]) + 0.00336708 * (Close[li_0 + 35 + 1]) + 0.00034406 * (Close[li_0 + 36 + 1]) - 0.00233637 * (Close[li_0 + 37 + 1]) - 0.0035228 * (Close[li_0 + 38 + 1]) - 0.00293522 * (Close[li_0 + 39 + 1]) - 0.00114249 * (Close[li_0 + 40 + 1]) + 0.00083536 * (Close[li_0 + 41 + 1]) + 0.00215524 * (Close[li_0 + 42 + 1]) + 0.00604133 * (Close[li_0 + 43 + 1]) - 0.00013046 * (Close[li_0 + 44 + 1]); ld_12 = ld_28 - ld_36; ld_20 = ld_44 - ld_52; if (ld_12 > ld_20) { g_ibuf_80[li_0] = ld_12; g_ibuf_84[li_0] = 0.0; } else { g_ibuf_84[li_0] = ld_12; g_ibuf_80[li_0] = 0.0; } } return (0); } Quote Link to comment Share on other sites More sharing options...
scarface Posted February 15, 2010 Report Share Posted February 15, 2010 Re: Nice Trend indi (fix) Hi scouseman, Good day, Can you post a picture of your indicator before decompilation so I can see where the problem is? Maybe the problem you are referring to can't be seen through the code, but only by picture. Please let me know. Best wishes, Quote a New Year 2011 has come, and the challenge has just started 8-) Link to comment Share on other sites More sharing options...
soundfx Posted February 15, 2010 Report Share Posted February 15, 2010 Re: Nice Trend indi (fix) Hi scouseman, It looks as though the decompiler threw a wobbler with all those numbers. How do you use this indicator out of interest - I see it uses a digital filter. I've corrected the bits of code which were incorrectly decompiled, try this: #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 LawnGreen #property indicator_color2 Red extern int CountBars = 500; double g_ibuf_80[]; double g_ibuf_84[]; int init() { string ls_unused_0; IndicatorBuffers(2); SetIndexStyle(0, DRAW_HISTOGRAM); SetIndexBuffer(0, g_ibuf_80); SetIndexStyle(1, DRAW_HISTOGRAM); SetIndexBuffer(1, g_ibuf_84); return (0); } int start() { double ld_12; double ld_20; double ld_28; double ld_36; double ld_44; double ld_52; SetIndexDrawBegin(0, Bars - CountBars + 43); SetIndexDrawBegin(1, Bars - CountBars + 43); int l_ind_counted_8 = IndicatorCounted(); if (Bars <= 44) return (0); if (l_ind_counted_8 < 44) { for (int li_0 = 1; li_0 <= 0; li_0++) g_ibuf_80[CountBars - li_0] = 0.0; for (li_0 = 1; li_0 <= 0; li_0++) g_ibuf_84[CountBars - li_0] = 0.0; } for (li_0 = CountBars - 44 - 1; li_0 >= 0; li_0--) { ld_28 = 0.4360409450 * (Close[li_0 + 0]) + 0.3658689069 * (Close[li_0 + 1]) + 0.2460452079 * (Close[li_0 + 2]) + 0.1104506886 * (Close[li_0 + 3]) - 0.0054034585 * (Close[li_0 + 4]) - 0.0760367731 * (Close[li_0 + 5]) - 0.0933058722 * (Close[li_0 + 6]) - 0.0670110374 * (Close[li_0 + 7]) - 0.0190795053 * (Close[li_0 + 8]) + 0.0259609206 * (Close[li_0 + 9]) + 0.0502044896 * (Close[li_0 + 10]) + 0.0477818607 * (Close[li_0 + 11]) + 0.0249252327 * (Close[li_0 + 12]) - 0.0047706151 * (Close[li_0 + 13]) - 0.0272432537 * (Close[li_0 + 14]) - 0.0338917071 * (Close[li_0 + 15]) - 0.0244141482 * (Close[li_0 + 16]) - 0.0055774838 * (Close[li_0 + 17]) + 0.0128149838 * (Close[li_0 + 18]) + 0.0226522218 * (Close[li_0 + 19]) + 0.0208778257 * (Close[li_0 + 20]) + 0.0100299086 * (Close[li_0 + 21]) - 0.0036771622 * (Close[li_0 + 22]) - 0.013674485 * (Close[li_0 + 23]) - 0.0160483392 * (Close[li_0 + 24]) - 0.0108597376 * (Close[li_0 + 25]) - 0.0016060704 * (Close[li_0 + 26]) + 0.0069480557 * (Close[li_0 + 27]) + 0.0110573605 * (Close[li_0 + 28]) + 0.0095711419 * (Close[li_0 + 29]) + 0.0040444064 * (Close[li_0 + 30]) - 0.0023824623 * (Close[li_0 + 31]) - 0.0067093714 * (Close[li_0 + 32]) - 0.00720034 * (Close[li_0 + 33]) - 0.004771771 * (Close[li_0 + 34]) + 0.0005541115 * (Close[li_0 + 35]) + 0.000786016 * (Close[li_0 + 36]) + 0.0130129076 * (Close[li_0 + 37]) + 0.0040364019 * (Close[li_0 + 38]); ld_36 = (-0.02232324 * (Close[li_0 + 0])) + 0.02268676 * (Close[li_0 + 1]) + 0.08389067 * (Close[li_0 + 2]) + 0.1463038 * (Close[li_0 + 3]) + 0.19282649 * (Close[li_0 + 4]) + 0.21002638 * (Close[li_0 + 5]) + 0.19282649 * (Close[li_0 + 6]) + 0.1463038 * (Close[li_0 + 7]) + 0.08389067 * (Close[li_0 + 8]) + 0.02268676 * (Close[li_0 + 9]) - 0.02232324 * (Close[li_0 + 10]) - 0.04296564 * (Close[li_0 + 11]) - 0.03980614 * (Close[li_0 + 12]) - 0.02082171 * (Close[li_0 + 13]) + 0.00243636 * (Close[li_0 + 14]) + 0.0195058 * (Close[li_0 + 15]) + 0.02460929 * (Close[li_0 + 16]) + 0.01799295 * (Close[li_0 + 17]) + 0.0047054 * (Close[li_0 + 18]) - 0.00831985 * (Close[li_0 + 19]) - 0.01544722 * (Close[li_0 + 20]) - 0.01456262 * (Close[li_0 + 21]) - 0.0073398 * (Close[li_0 + 22]) + 0.00201852 * (Close[li_0 + 23]) + 0.00902504 * (Close[li_0 + 24]) + 0.01093067 * (Close[li_0 + 25]) + 0.00766099 * (Close[li_0 + 26]) + 0.00145478 * (Close[li_0 + 27]) - 0.00447175 * (Close[li_0 + 28]) - 0.00750446 * (Close[li_0 + 29]) - 0.00671646 * (Close[li_0 + 30]) - 0.00304016 * (Close[li_0 + 31]) + 0.00143433 * (Close[li_0 + 32]) + 0.00457475 * (Close[li_0 + 33]) + 0.00517589 * (Close[li_0 + 34]) + 0.00336708 * (Close[li_0 + 35]) + 0.00034406 * (Close[li_0 + 36]) - 0.00233637 * (Close[li_0 + 37]) - 0.0035228 * (Close[li_0 + 38]) - 0.00293522 * (Close[li_0 + 39]) - 0.00114249 * (Close[li_0 + 40]) + 0.00083536 * (Close[li_0 + 41]) + 0.00215524 * (Close[li_0 + 42]) + 0.00604133 * (Close[li_0 + 43]) - 0.00013046 * (Close[li_0 + 44]); ld_44 = 0.4360409450 * (Close[li_0 + 0 + 1]) + 0.3658689069 * (Close[li_0 + 1 + 1]) + 0.2460452079 * (Close[li_0 + 2 + 1]) + 0.1104506886 * (Close[li_0 + 3 + 1]) - 0.0054034585 * (Close[li_0 + 4 + 1]) - 0.0760367731 * (Close[li_0 + 5 + 1]) - 0.0933058722 * (Close[li_0 + 6 + 1]) - 0.0670110374 * (Close[li_0 + 7 + 1]) - 0.0190795053 * (Close[li_0 + 8 + 1]) + 0.0259609206 * (Close[li_0 + 9 + 1]) + 0.0502044896 * (Close[li_0 + 10 + 1]) + 0.0477818607 * (Close[li_0 + 11 + 1]) + 0.0249252327 * (Close[li_0 + 12 + 1]) - 0.0047706151 * (Close[li_0 + 13 + 1]) - 0.0272432537 * (Close[li_0 + 14 + 1]) - 0.0338917071 * (Close[li_0 + 15 + 1]) - 0.0244141482 * (Close[li_0 + 16 + 1]) - 0.0055774838 * (Close[li_0 + 17 + 1]) + 0.0128149838 * (Close[li_0 + 18 + 1]) + 0.0226522218 * (Close[li_0 + 19 + 1]) + 0.0208778257 * (Close[li_0 + 20 + 1]) + 0.0100299086 * (Close[li_0 + 21 + 1]) - 0.0036771622 * (Close[li_0 + 22 + 1]) - 0.013674485 * (Close[li_0 + 23 + 1]) - 0.0160483392 * (Close[li_0 + 24 + 1]) - 0.0108597376 * (Close[li_0 + 25 + 1]) - 0.0016060704 * (Close[li_0 + 26 + 1]) + 0.0069480557 * (Close[li_0 + 27 + 1]) + 0.0110573605 * (Close[li_0 + 28 + 1]) + 0.0095711419 * (Close[li_0 + 29 + 1]) + 0.0040444064 * (Close[li_0 + 30 + 1]) - 0.0023824623 * (Close[li_0 + 31 + 1]) - 0.0067093714 * (Close[li_0 + 32 + 1]) - 0.00720034 * (Close[li_0 + 33 + 1]) - 0.004771771 * (Close[li_0 + 34 + 1]) + 0.0005541115 * (Close[li_0 + 35 + 1]) + 0.000786016 * (Close[li_0 + 36 + 1]) + 0.0130129076 * (Close[li_0 + 37 + 1]) + 0.0040364019 * (Close[li_0 + 38 + 1]); ld_52 = (-0.02232324 * (Close[li_0 + 0 + 1])) + 0.02268676 * (Close[li_0 + 1 + 1]) + 0.08389067 * (Close[li_0 + 2 + 1]) + 0.1463038 * (Close[li_0 + 3 + 1]) + 0.19282649 * (Close[li_0 + 4 + 1]) + 0.21002638 * (Close[li_0 + 5 + 1]) + 0.19282649 * (Close[li_0 + 6 + 1]) + 0.1463038 * (Close[li_0 + 7 + 1]) + 0.08389067 * (Close[li_0 + 8 + 1]) + 0.02268676 * (Close[li_0 + 9 + 1]) - 0.02232324 * (Close[li_0 + 10 + 1]) - 0.04296564 * (Close[li_0 + 11 + 1]) - 0.03980614 * (Close[li_0 + 12 + 1]) - 0.02082171 * (Close[li_0 + 13 + 1]) + 0.00243636 * (Close[li_0 + 14 + 1]) + 0.0195058 * (Close[li_0 + 15 + 1]) + 0.02460929 * (Close[li_0 + 16 + 1]) + 0.01799295 * (Close[li_0 + 17 + 1]) + 0.0047054 * (Close[li_0 + 18 + 1]) - 0.00831985 * (Close[li_0 + 19 + 1]) - 0.01544722 * (Close[li_0 + 20 + 1]) - 0.01456262 * (Close[li_0 + 21 + 1]) - 0.0073398 * (Close[li_0 + 22 + 1]) + 0.00201852 * (Close[li_0 + 23 + 1]) + 0.00902504 * (Close[li_0 + 24 + 1]) + 0.01093067 * (Close[li_0 + 25 + 1]) + 0.00766099 * (Close[li_0 + 26 + 1]) + 0.00145478 * (Close[li_0 + 27 + 1]) - 0.00447175 * (Close[li_0 + 28 + 1]) - 0.00750446 * (Close[li_0 + 29 + 1]) - 0.00671646 * (Close[li_0 + 30 + 1]) - 0.00304016 * (Close[li_0 + 31 + 1]) + 0.00143433 * (Close[li_0 + 32 + 1]) + 0.00457475 * (Close[li_0 + 33 + 1]) + 0.00517589 * (Close[li_0 + 34 + 1]) + 0.00336708 * (Close[li_0 + 35 + 1]) + 0.00034406 * (Close[li_0 + 36 + 1]) - 0.00233637 * (Close[li_0 + 37 + 1]) - 0.0035228 * (Close[li_0 + 38 + 1]) - 0.00293522 * (Close[li_0 + 39 + 1]) - 0.00114249 * (Close[li_0 + 40 + 1]) + 0.00083536 * (Close[li_0 + 41 + 1]) + 0.00215524 * (Close[li_0 + 42 + 1]) + 0.00604133 * (Close[li_0 + 43 + 1]) - 0.00013046 * (Close[li_0 + 44 + 1]); ld_12 = ld_28 - ld_36; ld_20 = ld_44 - ld_52; if (ld_12 > ld_20) { g_ibuf_80[li_0] = ld_12; g_ibuf_84[li_0] = 0.0; } else { g_ibuf_84[li_0] = ld_12; g_ibuf_80[li_0] = 0.0; } } return (0); } Quote Link to comment Share on other sites More sharing options...
scouseman Posted February 16, 2010 Author Report Share Posted February 16, 2010 Re: Nice Trend indi (fix) I have just checked your repaired code and it works a treat, just like the original, thanks. It identifies the trend really well, just use the cross of the zero line on the 1hr chart. Cheers scouseman avibe 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.