[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 109
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
How do I do this? What do I need to replace in this MACD code?
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 DarkKhaki
#property indicator_color2 Red
#property indicator_width1 2
//---- indicator parameters
extern int FastEMA=12;
extern inttern SlowEMA=26;
extern inttern SignalSMA=9;
//---- indicator buffers
double MacdBuffer[];
double SignalBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialisation function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexStyle(1,DRAW_LINE);
SetIndexDrawBegin(1,SignalSMA);
IndicatorDigits(Digits+1);
//---- indicator buffers mapping
SetIndexBuffer(0,MacdBuffer);
SetIndexBuffer(1,SignalBuffer);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("USDJPY("+FastEMA+", "+SlowEMA+", "+SignalSMA+")");
SetIndexLabel(0, "MACD");
SetIndexLabel(1, "Signal");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
for(int i=0; i<limit; i++)
MacdBuffer[i]=iMA("USDJPY",0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA("USDJPY",0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line counted in the 2nd buffer
for(i=0; i<limit; i++)
SignalBuffer[i]=iMAOnArray(MacdBuffer,Bars,SignalSMA,0,MODE_SMA,i);
//---- done
return(0);
}
//+------------------------------------------------------------------+
A little later. Not now
Can you tell me who's clever - how do I declare a function that returns an array?
int fxName[] (int p1, int p2) {
...
}
doesn't want to understand
Tell me who's clever - how do you declare a function that returns an array?
It's better this way:
Better like this:
int& is it like by reference?
You can. And there are examples. I have one of those in my toys.
Is there any way you can be more specific?
I guess I just need some advice on how to do it, not some complicated help ...? )
Is there any way you can be more specific?
I take it I just need some advice on how to do it, not some complicated help ...? )
https://forum.mql4.com/ru/12535 Here you can look up the code in one of the experts.
Can you tell me if anyone has encountered a fractal-based slider, maybe like envelopes, I'd be very grateful...