insomniawawa:
This indicator has 5 parameters, but I only know period parameter. Could you explain me how work the rest (Porog, metod, metod2, prise)?
Additional question: How can change this indicator that it draws line in 2 colours? I know that I should change
tmp1=iMA(Symbol(),0,period,0,metod,prise,i); tmp2=iMA(Symbol(),0,period,1,metod2,prise,i); if(MathAbs(tmp1-tmp2)>=porog*Point){
- double iMA( string symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift) so metod/metod2 are the method, prise is the applied price and porog is how many points the current and secondary must differ or the line doesn't change.
- There is only one buffer, you'll have to add a second, decide what the two colors represent and fill each approprately. Look at any colored indicator to see how it's down.
- Use SRC
- No Slaves here, learn to code or pay someone. We're not going to code it FOR you. We are willing to HELP you.
Thank you for your help! I only don't understand one thing, there are two methods and both are used at the same time. What's the difference between them?
insomniawawa:
Thank you for your help! I only don't understand one thing, there are two methods and both are used at the same time. What's the difference between them?
Thank you for your help! I only don't understand one thing, there are two methods and both are used at the same time. What's the difference between them?
Constant | Value | Description |
---|---|---|
MODE_SMA | 0 | Simple moving average, |
MODE_EMA | 1 | Exponential moving average, |
MODE_SMMA | 2 | Smoothed moving average, |
MODE_LWMA | 3 | Linear weighted moving average. |
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I found free indicator called XMA, I've noticed that it can be very useful, but unfortunatelly I'm totally green in MQL4.
This indicator has 5 parameters, but I only know period parameter. Could you explain me how work the rest (Porog, metod, metod2, prise)?
Please, expain me in plain english.
Additional question: How can change this indicator that it draws line in 2 colours? I know that I should change
"#property indicator_buffers 1
#property indicator_color1 Blue"
in
"#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red"
,but that's not all.
Best regards!
it's source code:
//+------------------------------------------------------------------+//| Xma.mq4 |
//| Copyright © 2009, XrustSolution. Toys from Vinin.|
//| http://www.xrust.ucoz.net http://www.vinin.ucoz.ru |
//| xrust@land.ru xrust@gmail.com xrust@mksat.net |
//-------------------------------------------------------------------+
#property copyright "Copyright © 2008, XrustSolution."
#property link "http://www.xrust.ucoz.net"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Blue
//---- indicator parameters
extern int period=12;
extern int porog =3;
extern int metod =1;
extern int metod2=1;
extern int prise =0;
//---- buffers
double Signal[];
//+------------------------------------------------------------------+
void init(){
SetIndexStyle(0,DRAW_LINE);
SetIndexDrawBegin(0,0);
SetIndexBuffer(0,Signal);
IndicatorShortName("Xma"+period+porog);
return;}
//+------------------------------------------------------------------+
int start() {
int limit;
double tmp1,tmp2;
int counted_bars=IndicatorCounted();
int i;
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for (i = limit;i>=0;i--){
tmp1=iMA(Symbol(),0,period,0,metod,prise,i);
tmp2=iMA(Symbol(),0,period,1,metod2,prise,i);
if(MathAbs(tmp1-tmp2)>=porog*Point){
Signal[i]=tmp2;
}else{
Signal[i]=Signal[i+1];
}
}
return(0);}
//+------------------------------------------------------------------+