MTF MACD

0
(0)
نالو:
MTF MACD
ليکڪ: marynarz15 (2009.05.27 08:07)
ڊائون لوڊ ٿيل: 6205
ڊائون لوڊ ڪريو:
MTF MACD 1
MTF MACD.mq4 (4.3 Kb) ڏيک
MTF MACD is a MetaTrader indicator based on well known MACD. Moving Average Convergence / Divergence, is a technical analysis indicator created by Gerald Appel in the 1960s. It shows the difference between a fast and slow exponential moving average (ايم اي) of closing prices. Additionally it has signal line which is simple moving average (SMA) of main value of indicator. MACD is a trend following indicator, and is designed to identify trend changes. It's generally not recommended in ranging market conditions.

In MetaTrader we have MACD already included as a standard technical indicator. However it can be used only for current timeframe. When we are looking for trend, it is very desirable to have MACD showing higher timeframes. MTF MACD presented here has additional parameter - ٽائيم فريم. You can use it to set up higher timeframe from which MACD will calculate its values. Because values are derived from bars, when using higher timeframes, you will notice rough shape of indicator lines.

MTF MACD settings:

  • ٽائيم فريم

Default value is 0 - means current timeframe. For other timeframes: 1=M1, 5=M5, 15=M15, 30=M30, 60=H1, 240= ايڇ 4, 1440=D1, 10080= W1, 43200=MN1

  • FastEMA

Default value is 12. This is fast exponential moving average.

  • SlowEMA

Default value is 26. This is slow exponential moving average.

  • سگنل

Default value is 9. This is signal line and it is simple moving average.

  • Applied_price

Default value is 0 - means Close price used for MA calculations. For other types of price: 0-CLOSE, 1-کوليو, 2-هاءِ, 3-گھٽ, 4-MEDIAN, 5-TYPICAL, 6-WEIGHTED.

  • شفٽ

Default value is 0. This parameter shifts whole indicator by Shift number of bars from set timeframe to the right on the chart.

مثال.

MTF MACD 2

MTF MACD screenshot

13 تبصرا: 1 2 ھڪڙو نئون تبصرو پوسٽ ڪرڻ لاء, مهرباني ڪري لاگ ان يا رجسٽر

هيلو دوست

One question to the last part of the code (in start function):

Any suggestions to how to change this code to get this MTF MACD indicator to draw smoother?

Lets say the indicator is used on M1 to draw a M5 MACD (using default setting of 12, 26, 9), the indicator as it is now will reference each close price used in the calculation 5 times until moving to the next closing value (which will be used 5 times again). Thereby getting the stair stepping indicator as displayed in the article.

How can this be changed so the indicator at any given time references the next close price on the main timeframe?
Case:
We're on M1 with the MTF MACD set to reference M5. Now to get a smoother MACD value I want to, at any time, use current price shift0 and the close price at shift5, shift10, 15, 20, 25 وغيره.

If on M5 and and MTF MACD set to M15, the indicator should reference current price shift0 and the close price of shift3, shift6, 9 وغيره.
Or to be more specific:

How do I collect and reference an array of prices where the array is defined from HigherTimeFrame/PresentTimeFrame=TFfactor and # of periods in MACD?

The array for the FastPeriod (in this case FastPeriod=12) آهي:
Shift0 and 11 periods with the TFfactor between each value (if PresentTimeFrame=M5 and HigherTimeFrame=M15 then the array referenced for the fast period is Shift0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33 on M5).
And the same principle goes for the SlowPeriod array.

 

I picture that the benefit is that a higher timeframe MACD value is being updated every time the lower timeframe draws a new bar. Of course it will not draw the exact higher-TF MACD value as if a MACD was plotted on that higher TF. But it will give an earlier zero line crossover, and potentially earlier trade signals.

Any comments and help is appreciated. مهرباني.

int شروع()
{
int limit, iChart, iTF, delta=0;
datetime TimeArray[];
جيڪڏهن(ٽائيم فريم>عرصو()) delta=MathCeil(TimeFrame/Period());
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(شمار ٿيل_بار<0) واپسي(-1);
//---- the last counted bar will be recounted
if(شمار ٿيل_بار>0) counted_bars--;
limit=Bars-counted_bars+delta;

ArrayCopySeries(TimeArray,MODE_TIME ,علامت(),ٽائيم فريم); 

iTF=0;
لاءِ(iChart=0; iChart<limit; iChart++)
{
جڏهن ته(وقت[iChart]<TimeArray[iTF]) iTF++;
MainBuffer[iChart]=EMPTY_VALUE;
SignalBuffer[iChart]=EMPTY_VALUE;
MainBuffer[iChart]=iMACD(علامت(),ٽائيم فريم,FastEMA,S lowEMA,سگنل,AppliedPrice,MODE_MAI N,iTF+Shift);
SignalBuffer[iChart]=iMACD(علامت(),ٽائيم فريم,FastEMA,S lowEMA,سگنل,AppliedPrice,MODE_SIG NAL,iTF+Shift);
}
واپسي(0);
}
25.06.2011 13:12 tttechtrader

This is MetaTrader forum. مهرباني ڪري .. No one here is interested in your literacy.

30.05.2009 05:51 marynarz15

marynarz15 wrote:The code I share is entirely mine....

another plagiary

and War and Peace - also yours - same book but yours calls "quite different" (Piece and War), characters quite different too - (Pierre changed to Pedro) ... : )))))))))))))))

30.05.2009 04:38 fxxx

Thank you for sharing your opinion. I think you are much more intelligent than me 🙂

30.05.2009 04:23 marynarz15

marynarz15 wrote:
I'm glad you posted this code. Now everyone can see that it is quite different...

Maryna, you seems like not very bright girl, so again - if you think replacing "i" سان "اي" ۽ "y"سان "ب", TF/Per with "delta" (which is TF/Per) وغيره. would make it "quite different" - you just offending people intelligence - they not as dumb as you ... think

30.05.2009 03:15 fxxx

I'm glad you posted this code. Now everyone can see that it is quite different...

29.05.2009 14:05 marynarz15

ڀيڻ گهرجي: limit=Bars-counted_bars + TimeFrame/Period();

"programer" - you can't read or dum?

تنهنجو "copyright" - ساڄو, you copied Kerises indi.., stick some minute changes (تنهنجو 80% crap) : )))))

btw. it was very first post and Kerises very first mtf ind... Last edited by keris2112; 03-05-2006 تي 02:11 ايم. - whole thread after that

and btw - maryna, i'm not Keris

سلام, fxxx

MTF MACD 3

//+------------------------------------------------------------------+
//| MTF_RSI.mq4 |
//| ڪاپي رائيٽ © 2006, ڪيريس 2112 |
//+------------------------------------------------------------------+
#ملڪيت جي حق اشاعت "ڪاپي رائيٽ © 2006, ڪيريس 2112"
#ملڪيت جي لنڪ "http://www.forex-tsd.com"

#property indicator_separate_window
#ملڪيت جي اشاري_بفرز 1
#property indicator_color1 DodgerBlue
#property indicator_level1 30
#property indicator_level2 70

extern int TimeFrame=0;
extern int RSIperiod=14;
extern int applied_price=0;

ڊبل ExtMapBuffer1[];
//+------------------------------------------------------------------+

int init()
{
SetIndexBuffer(0,ExtMapBuffer1);

TimeFrame=MathMax(ٽائيم فريم,عرصو());
اشارو مختصر نالو("MTF_RSI("+RSIperiod+") [ايم"+TimeFrame+"] ");

}

واپسي(0);

//+------------------------------------------------------------------+

int شروع()
{
datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted();

جيڪڏهن(شمار ٿيل_بار<0) واپسي(-1);
جيڪڏهن(شمار ٿيل_بار>0) counted_bars--;

ArrayCopySeries(TimeArray,MODE_TIME,علامت(),ٽائيم فريم);

limit=Bars-counted_bars + TimeFrame/Period();

لاءِ(i=0,y=0;i<limit;i++)
{
جيڪڏهن (وقت[i]<TimeArray[y]) y++;

ExtMapBuffer1[i]=iRSI(NULL,ٽائيم فريم,RSI مدت,applied_price,y) ;

}

واپسي(0);
}

29.05.2009 07:00 fxxx

fxxx wrote:
...

keris I checked 'your code'...

This is what you published:

http://www.forex-tsd.com/attachments/indicators-metatrader-4/4150d1140475808-multi-timeframe-indicators-mtf-set-1.zip

and here we can see how it works:

http://www.forex-tsd.com/attachments/indicators-metatrader-4/4155d1140478448-multi-timeframe-indicators-mtf-example.gif

The code looks like this:

#ملڪيت جي حق اشاعت "ڪاپي رائيٽ © 2006, ڪيريس 2112"
#ملڪيت جي لنڪ "http://www.forex-tsd.com"

ڊبل ExtMapBuffer1[];
int init()
{
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(0,DRAW_LINE);
سوئچ(ٽائيم فريم)
{
...
...
}
اشارو مختصر نالو("MTF_RSI("+RSIperiod+") ("+TimeFrameStr+")");
}
واپسي(0);
}
int شروع()
{
datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted();
limit=Bars-counted_bars;
لاءِ(i=0,y=0;i<limit;i++)
{
جيڪڏهن (وقت[i]<TimeArray[y]) y++;
ExtMapBuffer1[i]=iRSI(NULL,ٽائيم فريم,RSI مدت,applied_price,y) ;
}
واپسي(0);
}

And it works like this:

MTF MACD 4
keris RSI

If you claim copyrights to above code, I see no problem...

For twenty lines of code we have 80% difference. And yours is completely crap...

28.05.2009 17:03 marynarz15

marynarz15 wrote:

The code I share is entirely mine. The code you are refering to is quite different.

I wonder if this works all the time, especially if you have gaps..

جيڪڏهن (وقت[i]<TimeArray[y]) y++;

I coded few much more complex multi timeframe indicators to some of my clients and they were very happy, so I thought it would be nice to share some very basic version for free with the world.

Thanks for the comment anyway.

: )))))))))))) "entirely yours"? what a b.s.; whom you bulshtng? (may be only those, from whom you collect "billing information")

basicaly same thing

Keris, Igorad:

ArrayCopySeries(TimeArray,MODE_TIME,علامت(),ٽائيم فريم);
limit = Bars - شمار ٿيل_بار;
limit = MathMax ( limit, TimeFrame/Period() ); // limit=Bars-counted_bars + TimeFrame/Period();

لاءِ(i=0, y=0; i<limit; i++)
{ جيڪڏهن (وقت[i]<TimeArray[y]) y++;

ExtMapBuffer1[i]=iRSI(NULL,ٽائيم فريم,RSI مدت,applied_price,y) ;
----------------------

"توهان":

جيڪڏهن(ٽائيم فريم>عرصو()) delta=MathCeil(TimeFrame/Period());
limit=Bars-counted_bars+delta;

ArrayCopySeries(TimeArray,MODE_TIME,علامت(),ٽائيم فريم);
iTF=0;
لاءِ(iChart=0; iChart<limit; iChart++)
{ جڏهن ته(وقت[iChart]<TimeArray[iTF]) iTF++; ...
ExtMapBuffer1[iChart]=iRSI(علامت(),ٽائيم فريم,RSIPeriod,Applied_price, iTF+Shift);

ڇا آھي "quite different"?: you called "i" - "iChart", y -"iTF"; "جڏهن ته" insead of "جيڪڏهن"-different, the rest - same thing : ))))))))))
------------------------------

شفٽ (iTF+Shift ) - works too bad; it normaly goes in init:

TimeFrame = MathMax(ٽائيم فريم,عرصو());
SetIndexShift(0,shift*TimeFrame/Period());

هي پوسٽ ڪيترو مفيد هو?

ان کي ريٽ ڪرڻ لاء اسٽار تي ڪلڪ ڪريو!

سراسري درجه بندي 0 / 5. ووٽن جي ڳڻپ: 0

هن وقت تائين ڪوبه ووٽ ناهي! هن پوسٽ جي درجه بندي ڪرڻ لاء پهريون ٿيو.

اسان کي افسوس آهي ته هي پوسٽ توهان لاء مفيد نه هئي!

اچو ته هن پوسٽ کي بهتر بڻايون!

اسان کي ٻڌايو ته اسان هن پوسٽ کي ڪيئن بهتر ڪري سگهون ٿا?



ليکڪ: فاریکس وڪي ٽيم
اسان انتهائي تجربيڪار فاریکس واپارين جي ٽيم آهيون [2000-2023] جيڪي اسان جي پنهنجي شرطن تي زندگي گذارڻ لاءِ وقف آهن. اسان جو بنيادي مقصد مالي آزادي ۽ آزادي حاصل ڪرڻ آهي, ۽ اسان خود تعليم حاصل ڪئي آهي ۽ فاریکس مارڪيٽ ۾ وسيع تجربو حاصل ڪيو آهي جيئن اسان جو مطلب هڪ خودمختاري واري زندگي گذارڻ جي لاءِ آهي..