Coding help - page 149

 

hi Mladen,

Thank you again for all your help. and i need again

in the following indicator, i would like to get "buy" and "sell" arrow on the same bar. (i mean, when rsi, cci and cmo conditions occur at the same bar (time)). can you modify?

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Blue

#property indicator_color2 Red

extern int barsToProcess=100000;

//

double ExtMapBuffer1[];

double ExtMapBuffer2[];

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

//

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

int init()

{

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

SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(1,DRAW_ARROW,0,2); 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,5,PRICE_CLOSE,i);

double cci=iCCI(NULL,0,15,PRICE_CLOSE,i);

double cci1=iCCI(NULL,0,18,PRICE_CLOSE,i);

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

if(rsi>80 && cci>250 && cmo>50)

ExtMapBuffer1=Low+5*Point;

else ExtMapBuffer1=EMPTY_VALUE;

if(rsi<20 && cci1<-250 && cmo<-50)

ExtMapBuffer2=High-5*Point;

else ExtMapBuffer2=EMPTY_VALUE;

}

return(0);

}

 
anonimm:
hi Mladen,

Thank you again for all your help. and i need again

in the following indicator, i would like to get "buy" and "sell" arrow on the same bar. (i mean, when rsi, cci and cmo conditions occur at the same bar (time)). can you modify?

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Blue

#property indicator_color2 Red

extern int barsToProcess=100000;

//

double ExtMapBuffer1[];

double ExtMapBuffer2[];

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

//

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

int init()

{

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

SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(1,DRAW_ARROW,0,2); 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,5,PRICE_CLOSE,i);

double cci=iCCI(NULL,0,15,PRICE_CLOSE,i);

double cci1=iCCI(NULL,0,18,PRICE_CLOSE,i);

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

if(rsi>80 && cci>250 && cmo>50)

ExtMapBuffer1=Low+5*Point;

else ExtMapBuffer1=EMPTY_VALUE;

if(rsi<20 && cci1<-250 && cmo<-50)

ExtMapBuffer2=High-5*Point;

else ExtMapBuffer2=EMPTY_VALUE;

}

return(0);

}

Hi Anonimm, added a trend buffer, should work, but not having the cmo close by to test not 100% sure.

Files:
 

Hi mladen,

Thank you for your quick response. The indi is good.

Would you please to modify it, that can show not only one monday (if we choose monday), but 300 mondays (or can be adjusted).

OR it will show not only one tuesday (if we choose Tuesday), but it will show 300 tuesdays (can be adjusted is much better).

Thank you and Best Regards,

anton

mladen:
anton1 Here you go. You can chose the day of the week and set the colors of the lines
 
anton1:
Hi mladen,

Thank you for your quick response. The indi is good.

Would you please to modify it, that can show not only one monday (if we choose monday), but 300 mondays (or can be adjusted).

OR it will show not only one tuesday (if we choose Tuesday), but it will show 300 tuesdays (can be adjusted is much better).

Thank you and Best Regards,

anton

Here you go

Files:
 

Hi mladen,

Would you please to modify this "year-open" indi? I need this indi to show not only one year-opening-line, but many years before in history.

Thank you and Regards always,

anton

mladen:
fareastol

This can find you the open price of the year fairly quickly :

for (int i=0; i<12; i++) if (TimeYear(iTime(NULL,PERIOD_MN1,i))!=TimeYear(iTime(NULL,PERIOD_MN1,i+1))) break;

double yearOpen = iOpen(NULL,PERIOD_MN1,i);

Then you simply calculate the difference of the current close (Close[0] does not matter what time frame are you using when you call it) and that yearOpen price and that would be it. If you need it as an indicator, attached one that display a horizontal line at the current year open price and writes out the distance in pips as a comment
 
anton1:
Hi mladen,

Would you please to modify this "year-open" indi? I need this indi to show not only one year-opening-line, but many years before in history.

Thank you and Regards always,

anton

That is not an indicator. Please read that post again

 

hi mladen,

You are great and kind person.

Thank you very much much much..............

Best Regards,

anton

note: hi my friend, mladen, how should I thank you?

mladen:
Here you go
 

oppsss sorry...

Maybe you are willing to code the 'yearly-openning-horizontal line', please.

Thank you,

anton

note: that indi shows yearly-open-line, but only for this year. I need an indi can show historical yearly-open-line.

mladen:
That is not an indicator. Please read that post again
 

Hi mladen,

Would you please to modify this "year-open" indi? I need this indi to show not only one year-opening-line, but many years before in history.

Thank you and Regards always,

anton

mladen:
fareastol

This can find you the open price of the year fairly quickly :

for (int i=0; i<12; i++) if (TimeYear(iTime(NULL,PERIOD_MN1,i))!=TimeYear(iTime(NULL,PERIOD_MN1,i+1))) break;

double yearOpen = iOpen(NULL,PERIOD_MN1,i);

Then you simply calculate the difference of the current close (Close[0] does not matter what time frame are you using when you call it) and that yearOpen price and that would be it. If you need it as an indicator, attached one that display a horizontal line at the current year open price and writes out the distance in pips as a comment
 
anton1:
Hi mladen,

Would you please to modify this "year-open" indi? I need this indi to show not only one year-opening-line, but many years before in history.

Thank you and Regards always,

anton

Anton,

Here attached my indicator to help you draw Year Open level of any year in the past. Please note that default parameter NumYear = 0 means open price of this year, you should increase that number to show value of past years. Besides, to show multiple years at the same time on same chart, you should also change the name of ID correspondingly.

This indicator is based totally on mladen's work plus some minor change. I'm just amateur in coding. So if it doesnot work, it's my weak coding, and maybe Mladen would give his hands on this.

Regards,

fareastol

Files:
Reason: