Coding help - page 112

 
mladen:
Instead of using iCustom() for rsi and cci use the built in functions.

Parameters needed for RSI :

[TD]string symbol, int timeframe, int period, int applied_price, int shift)
double iRSI([/TD] string symbol, int timeframe, int period, int applied_price, int shift)[/TD]

[/TR]

[/TABLE]

Parameters needed for CCI :

[TABLE="class: docvar"]

[TR]

[TD]double iCCI(

And for CMO, first parameter is LastBarOnly and the second is CMO_Range, so the iCustom() call should be something like :

iCustom(NULL,0,"cmo",false,CMORange,0,i);

where CMORange would be some parameter

i m a newbie to mql4, can you write,? please

 
anonimm:
i m a newbie to mql4, can you write,? please

Do something like this :

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Crimson

#property indicator_color2 RoyalBlue

extern int barsToProcess=100;

extern int RsiPeriod = 14;

extern int RsiPrice = PRICE_CLOSE;

extern int CciPeriod = 14;

extern int CciPrice = PRICE_TYPICAL;

extern int CmoRange = 14;

//

double ExtMapBuffer1[];

double ExtMapBuffer2[];

//------------------------------------------------------------------

//

//------------------------------------------------------------------

int init()

{

SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,233);

SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,234);

return(0);

}

int deinit() { return(0); }

//------------------------------------------------------------------

//

//------------------------------------------------------------------

int start()

{

int counted_bars=IndicatorCounted();

if(counted_bars>0)counted_bars--;

int limit=Bars-counted_bars; if(limit>barsToProcess)limit=barsToProcess;

for(int i=limit;i>=0;i--)

{

double rsi=iRSI(NULL,0,RsiPeriod,RsiPrice,i);

double cci=iCCI(NULL,0,CciPeriod,CciPrice,i);

double cmo=iCustom(NULL,0,"cmo",false,CmoRange,0,i);

if(rsi>60.0 && cci>150.0 && cmo>30.0)

ExtMapBuffer1=High+5*Point;

else ExtMapBuffer1=EMPTY_VALUE;

if(rsi<40.0 && cci<-150.0 && cmo<-30.0)

ExtMapBuffer2=Low-5*Point;

else ExtMapBuffer2=EMPTY_VALUE;

}

return(0);

}

Attaching a test indicator (same as the code above) too

Files:
_test.mq4  2 kb
 

I post here one of the best Stochastic divergence from FX5 I ever seen 5 (I try many many indis like that),

It indicate "normal divergence" and the very interesting "Hidden divergence"

Can someone add in the code the possibility to change the color of the trendlines on the graph and the stochastics

And can someone use this code do to a so veautiful RSI divergence because I never find it

Thanks a lot for the coder who will do it

Have a nice day

Zilliq

https://mon-partage.fr/f/qtt6kDOR/

Ps: Thanks to the moderator who change this post in the right place ;-)

Files:
 
zilliq:
I post here one of the best Stochastic divergence from FX5 I ever seen 5 (I try many many indis like that),

It indicate "normal divergence" and the very interesting "Hidden divergence"

Can someone add in the code the possibility to change the color of the trendlines on the graph and the stochastics

And can someone use this code do to a so veautiful RSI divergence because I never find it

Thanks a lot for the coder who will do it

Have a nice day

Zilliq

https://mon-partage.fr/f/qtt6kDOR/

Ps: Thanks to the moderator who change this post in the right place ;-)

zilliq

Try it out now : colors can be set from parameters

 

Thanks a lot Mladen ,

I try it immediately

Zilliq

 

Hi Mladen

Correlation indicator values from advanced elite doesnt appear , can you help?Thanks.

 
nevar:
Hi Mladen Correlation indicator values from advanced elite doesnt appear , can you help?Thanks.

Hello Nevar, if its this one https://www.mql5.com/en/forum/180028 did you get the dll also and enable dll imports?

 

Thanks MrTools

Yes it is solved with dll file.

 

Coding Help needed....

I am playing around with OBJ_VLINE and not going anywhere fast. Using the following code, I can draw a VLINE on an intersection of two moving averages as an example.

{

string name="vline"+DoubleToStr(i,0);

ObjectCreate(name,OBJ_VLINE,0,iTime(Symbol(),0,i),0);

}

What I am really trying to do is create a VLINE and Horizontal line at the point where an MA changes slope from positive to negative. The Horizontal line showing the actual price where the change happens. I am using the following code to change colours on slope.

fasttrend=fasttrend;

if (MABuf>MABuf) fasttrend= 1;

if (MABuf<MABuf) fasttrend=-1;

if (fasttrend>0)

{

FastUpBuffer = MABuf;

if (fasttrend<0) FastUpBuffer=MABuf;

FastDnBuffer = EMPTY_VALUE;

}

else if (fasttrend<0)

{

FastDnBuffer = MABuf;

if (fasttrend>0) FastDnBuffer=MABuf;

FastUpBuffer = EMPTY_VALUE

}

My first attempt just resulted in vlines being drawn on every bar which was colourful but not really what I had in mind. I also have no idea how to delete the old "cross hair" when a new one is created. Is there a function floating around that does this? I would like to set this up as an alternative to arrows to indicate slope change where we can see the actual price on the bar where the indicator actually changed direction.

Thanks for any help,

Alex

 
hughesfleming:
Coding Help needed....

I am playing around with OBJ_VLINE and not going anywhere fast. Using the following code, I can draw a VLINE on an intersection of two moving averages as an example.

{

string name="vline"+DoubleToStr(i,0);

ObjectCreate(name,OBJ_VLINE,0,iTime(Symbol(),0,i),0);

}

What I am really trying to do is create a VLINE and Horizontal line at the point where an MA changes slope from positive to negative. The Horizontal line showing the actual price where the change happens. I am using the following code to change colours on slope.

fasttrend=fasttrend;

if (MABuf>MABuf) fasttrend= 1;

if (MABuf<MABuf) fasttrend=-1;

if (fasttrend>0)

{

FastUpBuffer = MABuf;

if (fasttrend<0) FastUpBuffer=MABuf;

FastDnBuffer = EMPTY_VALUE;

}

else if (fasttrend<0)

{

FastDnBuffer = MABuf;

if (fasttrend>0) FastDnBuffer=MABuf;

FastUpBuffer = EMPTY_VALUE

}

My first attempt just resulted in vlines being drawn on every bar which was colourful but not really what I had in mind. I also have no idea how to delete the old "cross hair" when a new one is created. Is there a function floating around that does this? I would like to set this up as an alternative to arrows to indicate slope change where we can see the actual price on the bar where the indicator actually changed direction.

Thanks for any help,

Alex

Alex

Did you try something like this (for the horizontal line addition) :

{

string name="vline"+Time;ObjectCreate(name,OBJ_VLINE,0,Time,0);

name="hline"+Time;ObjectCreate(name,OBJ_HLINE,0,Time,MABuff);

}

Reason: