Help needed for this indicator

Marbo
538
Marbo  

hi coders,

this indicator should do this:

1. price crosses ema 100 upwards

2. waiting for the first negative closed bar (open > close)

3. print an arrow below that bar

or

1. price crosses ema 100 downwards

2. waiting for the first positive closed bar (open < close)

3. print an arrow above that bar

it would be great if there is an additional alert box besides the arrow.

i tried to program it myself but there are some problems i can't solve.

"xflag" in the code means:

1) price/ema-cross upwards is done, waiting for the first negative bar

2) price/ema-cross downwards is done, waiting for the first positive bar

0) price/ema-cross done, first negative or positive bar found, arrow printed, now waiting for the next price/ema-cross

i hope that is understandable. i am thankful for any help!

Files:
Abdalla Doleh
1341
Abdalla Doleh  

little more clarification

Hello Marbo,

Could you clarify your definition of Negative/Positive bar? There reason I ask is because your relation assignment between open and close seem to be in contradiction of what Negative/Positive is.

Thanks,

Abdalla Doleh
1341
Abdalla Doleh  

Offcourse!

Thanks for the clarification Marbo. When i read your explanation i saw the relationship signs reversed. Sorry for the confusion.

Marbo
538
Marbo  

hi pip,

no problem... but i can just repeat what i wrote in the first posting. i don't see a mistake there. a positive/bullish bar is a rising bar where the close is higher than the open (in a chart it is simply a green bar). and a negative/bearish bar (red bar in a chart) is a bar which close is lower than the open.

just for your information: the whole "thing" should work like this:

price breaks ema upwards, i assume an uptrend and wait for the first bar to pull back. of course that bar must be a negative/bearish/red bar. when this bar has closed i want to see an arrow and wait for a possible 123 setup / trendline break... whatever brings me into the market.

the same with downtrends..

Marbo
538
Marbo  

i hoped you are a coder who would finish my work...

Abdalla Doleh
1341
Abdalla Doleh  

No promises, but i will certainly try

Abdalla Doleh
1341
Abdalla Doleh  

First Version

Hello Marbo,

The attached version of the indicator will plot an arrow below all bullish bars below the EMA and an arrow on all bearish bars above the EMA.

This version will catch the first retracing bar, but it will also catch all subsequent retracing bars.

Please let me know if you wish for the indicator to just mark the first retracing bar and nothing else and I will attempt to figure the logic out.

Please note that my adjustments were minor, you did a pretty good job with the code.

Cheers,

Files:
Marbo
538
Marbo  

hi pip !

at first, thanks for your help!! what you said is exactly what i need. only the first retracing bar after the price/ema-cross should be marked with an arrow. if it possible for you, it would be great if an alert comes up also.

this is exactly the time where i look closely at the charts and wait for a formation to appear.

it would be fantastic if can do the "job"

Marbo
538
Marbo  

pip? i hope you haven't give up yet?

tushark1
15
tushark1  

Can anyone make ea for me

Hello, i want to make such hedge based ea. For pair eurusd and gbpusd. That ea should make buy as well as sell entry at same time. Take profit should be 3-4 pips, and after that it should close that trade auto and again enter new trade.

Can anyone help me or can suggest same ea like this

thanks in advance.

Can contact me at tushark1atyahoodotcom

Abdalla Doleh
1341
Abdalla Doleh  
Marbo:
pip? i hope you haven't give up yet?

Nope, still trying to figure the logic out. My MT4 programming skills are not at the same level as other members so it may take me a while