Coding help - page 26

 

Hi,

Is there someone here who can slightly modify WPR indicator code for me?

The way I understand WPR at present is it writes the line on close of each bar.

What I would like is for WPR to write the line once bar is 10 pips long (high-low=>10 pips), then wait for new bar before writing again.

I use range bars so my bars are always >10.

Obviously I am prepared to pay for this mod.

cogs

Files:
wpr.mq4  3 kb
 

WPR filtered ...

This could be it

The way it works is the following : if the high-low range is greater than or equal to the required filter than it calculates a normal WPR value, otherwise it inherits the previous value. Here is a comparison : upper is the WPR, lower is this indicator with filter set to 0 and lower is this indicator with filter set to 10 pips

PS: since you wanted the filter in pips, on higher time frames you will probably have to use larger filter size

cog09:
Hi,

Is there someone here who can slightly modify WPR indicator code for me?

The way I understand WPR at present is it writes the line on close of each bar.

What I would like is for WPR to write the line once bar is 10 pips long (high-low=>10 pips), then wait for new bar before writing again.

I use range bars so my bars are always >10.

Obviously I am prepared to pay for this mod.

cogs
Files:
 

Need help to modify indicator.

Hi.

first i would like to thanks all the forum for their knowledge.

this is my first post and i'm french then sorry for my bad english.

my problem is the following:

I have the indicator rsi_ema_mtf and would like to modify the coding.

instead of to call the indicator "IMAonarray",I call the indicator "JMA"

please can anyone help me? thank you in advance

I join the two indicator:

rsi_ema_mtf.mq4

jma.mq4

Files:
jma.mq4  11 kb
 

EA doesnt Work

Hi folks,

the attached is my EA , it didnt open ticket/trading ,

could someone tkae a look and tell me what's wrong with it ?

thanks

Files:
test_ea.mq4  128 kb
 

...

kemal44

I have answered to a very similar post by you (this post : https://www.mql5.com/en/forum/173219/page196 )

Please read that post. Also, I recommend you to go to this section: Metatrader 4 mql 4 - Development course . I think a lot of answers to questions you can have about coding EAs and combining them with indicators can be found there

all the best

kemal44:
Hi folks,

the attached is my EA , it didnt open ticket/trading ,

could someone tkae a look and tell me what's wrong with it ?

thanks
 

(Req) little Code modification allow it to use in 2 digits pairs

Dear Guru Programmers

Could any programmers can modify little bit on the following mq4 content, so that it can display in JPY pairs with 2 digits. This indicator can only normally display/work on 4 digits or 5 digits instruments, but strangely cannot display/work on JPY pairs with 2 digits or any instruments with less than 4 digits. Please help. you can also use this indicator. it is worth to modify /code it. Please pm me or post here . Many thanks.

#property indicator_chart_window

#property indicator_buffers 1

#property indicator_color1 LawnGreen

extern int ndot=5;

extern int CountBars=300;

//---- buffers

double cfl[];

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

//| Custom indicator initialization function |

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

int init()

{

string short_name;

//---- indicator line

IndicatorBuffers(1);

SetIndexStyle(0,DRAW_LINE);

SetIndexBuffer(0,cfl);

//----

return(0);

}

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

//| |

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

int start()

{

if (CountBars>=Bars) CountBars=Bars;

SetIndexDrawBegin(0,Bars-CountBars+ndot+1);

int i,shift,cnt,ndot1,counted_bars=IndicatorCounted();

double TYVar,ZYVar,TIndicatorVar,ZIndicatorVar,M,N,AY,AIn dicator;

//----

if(Bars<=ndot) return(0);

//----

shift=CountBars-ndot-1;

while(shift>=0)

{

TYVar=0;

ZYVar=0;

N=0;

M=0;

TIndicatorVar=0;

ZIndicatorVar=0;

ndot1=ndot;

if (shift+1<ndot1) ndot1=shift+1;

for (cnt=ndot; cnt>=1; cnt--) // n=5 - 镱 ?蜩 蝾麝囔

{

N=N+cnt*cnt; //疣忭?55

M=M+cnt; //疣忭?15

}

for (cnt=ndot1; cnt>=1; cnt--) // n=5 - 镱 ?蜩 蝾麝囔

{

ZYVar=ZYVar+(High[shift-cnt+1]+Low[shift-cnt+1])/2*(ndot+1-cnt);

TYVar=TYVar+(High[shift-cnt+1]+Low[shift-cnt+1])/2;

ZIndicatorVar=ZIndicatorVar+iMA(NULL,0,5,3,MODE_SM MA,PRICE_MEDIAN,shift-cnt+1)*(ndot+1-cnt);

TIndicatorVar=TIndicatorVar+iMA(NULL,0,5,3,MODE_SM MA,PRICE_MEDIAN,shift-cnt+1);

}

AY=(TYVar+(N-2*ZYVar)*ndot/M)/M;

AIndicator=(TIndicatorVar+(N-2*ZIndicatorVar)*ndot/M)/M;

cfl[shift]=Close[shift]+((-1000)*MathLog(AY/AIndicator)/500);

shift--;

}

return(0);

}

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

 

...

It looks like this on USDJPY when I test it (so it works)

annbeea:
Dear Guru Programmers

Could any programmers can modify little bit on the following mq4 content, so that it can display in JPY pairs with 2 digits. This indicator can only normally display/work on 4 digits or 5 digits instruments, but strangely cannot display/work on JPY pairs with 2 digits or any instruments with less than 4 digits. Please help. you can also use this indicator. it is worth to modify /code it. Please pm me or post here . Many thanks.

#property indicator_chart_window

#property indicator_buffers 1

#property indicator_color1 LawnGreen

extern int ndot=5;

extern int CountBars=300;

//---- buffers

double cfl[];

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

//| Custom indicator initialization function |

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

int init()

{

string short_name;

//---- indicator line

IndicatorBuffers(1);

SetIndexStyle(0,DRAW_LINE);

SetIndexBuffer(0,cfl);

//----

return(0);

}

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

//| |

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

int start()

{

if (CountBars>=Bars) CountBars=Bars;

SetIndexDrawBegin(0,Bars-CountBars+ndot+1);

int i,shift,cnt,ndot1,counted_bars=IndicatorCounted();

double TYVar,ZYVar,TIndicatorVar,ZIndicatorVar,M,N,AY,AIn dicator;

//----

if(Bars<=ndot) return(0);

//----

shift=CountBars-ndot-1;

while(shift>=0)

{

TYVar=0;

ZYVar=0;

N=0;

M=0;

TIndicatorVar=0;

ZIndicatorVar=0;

ndot1=ndot;

if (shift+1<ndot1) ndot1=shift+1;

for (cnt=ndot; cnt>=1; cnt--) // n=5 - 镱 ?蜩 蝾麝囔

{

N=N+cnt*cnt; //疣忭?55

M=M+cnt; //疣忭?15

}

for (cnt=ndot1; cnt>=1; cnt--) // n=5 - 镱 ?蜩 蝾麝囔

{

ZYVar=ZYVar+(High[shift-cnt+1]+Low[shift-cnt+1])/2*(ndot+1-cnt);

TYVar=TYVar+(High[shift-cnt+1]+Low[shift-cnt+1])/2;

ZIndicatorVar=ZIndicatorVar+iMA(NULL,0,5,3,MODE_SM MA,PRICE_MEDIAN,shift-cnt+1)*(ndot+1-cnt);

TIndicatorVar=TIndicatorVar+iMA(NULL,0,5,3,MODE_SM MA,PRICE_MEDIAN,shift-cnt+1);

}

AY=(TYVar+(N-2*ZYVar)*ndot/M)/M;

AIndicator=(TIndicatorVar+(N-2*ZIndicatorVar)*ndot/M)/M;

cfl[shift]=Close[shift]+((-1000)*MathLog(AY/AIndicator)/500);

shift--;

}

return(0);

}

//+------------------------------------------------------------------+
Files:
test.gif  28 kb
 

Need a simple MOD for Gann_SQ9_A2 Indicator...Mladen please help...

Hi mladen.

It seems to me that you are well versed in coding. I am a complete beginner in indi's, and need your help.

I need to have this indi give the outputs of 1, and -1, when MODE 1 (or MODE 0, I really don't care at this point) is selected if at all possible PLEASE!

The outputs (1, -1) ALREADY ARE AVAILABLE in the indi, but it doesn't output those values.

You can find these outputs from this variable way down in the code; âåðõ_âíèç.

I was trying out different things with this indi and had (almost) a success, but when used with an EA that I want to have call the indi by the iCustom function, it either stalled, or did a number of strange things (during different stages of modding).

I have included the " Almost Working prototype" indi (Gann_SQ9_A4), as well as the original (Gann_SQ9_A2) for comparison.

If the current "prototype" can display the " 1 , or -1" on the chart, then I would imagine it not too hard to be able to route that signal to the indi's output? But then again - I don't know enough about indi's to be able to do this!

I really hope that you can help....

Cheers

AG

Files:
 
mladen:
It looks like this on USDJPY when I test it (so it works)

as compare to non-jpy pairs, the signals on jpypairs are quite meaningless, (no buy or sell signal), so i say it does not work in jpy pairs and all less than 4 digits instruments, could you kindly recode/modify it? many thanks.

 

...

For that I would need to know how you use it for signals (from the code I do not see exactly the "intention" of the indicator. especially since you have a part of code that is using future values for calculations, this part :
for (cnt=ndot1; cnt>=1; cnt--) // n=5 - ? ?? ???

{

ZYVar=ZYVar+(High[shift-cnt+1]+Low[shift-cnt+1])/2*(ndot+1-cnt);

TYVar=TYVar+(High[shift-cnt+1]+Low[shift-cnt+1])/2;

ZIndicatorVar=ZIndicatorVar+iMA(NULL,0,5,3,MODE_SMMA,PRICE_MEDIAN,shift-cnt+1)*(ndot+1-cnt);

TIndicatorVar=TIndicatorVar+iMA(NULL,0,5,3,MODE_SMMA,PRICE_MEDIAN,shift-cnt+1);

}

the shift-cnt+1 expression almost always uses future values (except for the current bar) and will cause te indicator repaint

annbeea:
as compare to non-jpy pairs, the signals on jpypairs are quite meaningless, (no buy or sell signal), so i say it does not work in jpy pairs and all less than 4 digits instruments, could you kindly recode/modify it? many thanks.