Can someone develop this indicator?

 

Can someone develop this indicator for me. Its a simple indicator and I just need it for reference.

If the current bar breaks the high of previous 3 bars, then a buy signal is generated.

If the current bar breaks the low of previous 3 bars, then a sell signal is generated.

Also, is it possible that the break point (in figures) can be mentioned next to the buy/sell signal

Thnx

kev

 

Hi lows

Here are some hi los in a zip. You may find something of use in these.

Files:
 

here you go

Files:
hilow3.mq4  2 kb
 

thank you richx7

thank you niva

kev

 
niva:
here you go

Hi niva

the indicator does not show up in my indicator list. Could you please check if its the correct format

thnx

kev

 

what directory did you save the mq4 file? Save it under indicator directory and then compile.

 

i saved it in the indicators directory

But how do I compile it?

Kev

 

Open it by MetaEditor, press F5.

 
niva:
Open it by MetaEditor, press F5.

i compiled it. but yet it doesnt appear in my indicators list. what should i do?

kev

 
kevmcfoster:
i compiled it. but yet it doesnt appear in my indicators list. what should i do? kev

It works for me.

Files:
hilow.gif  22 kb
 
niva:
here you go

Hi ! I have a strange feeling that this one will be changing past. Why?

Here is the explenation:

for (shift = CountBars; shift>=0; shift--)

[/CODE]

So u count from left side of the screen to right. So lets say we have 2000 bars on the chart. The first index (shift) will be 2000 second 1999 next 1998 and so on. Let's continoue.

if( High[shift-1] > High[shift] && Low[shift-1] > Low[shift] && uptrend != 3)

[/CODE]

Let's say that we are on bar that is indexed as 0 (current bar). How the conditions would look like ?

if( High[0-1] > High[0] && Low[0-1] > Low[0] && uptrend != 3)

[/CODE]

So, to do that - metatrader should look in the cystal ball and predict the future. But wait till we close bar :

[CODE]

if( High[1-1] > High[0] && Low[1-1] > Low[0] && uptrend != 3)

now we compared the same bar but after the next bar was closed:

[CODE]

if( High[2-1] > High[0] && Low[2-1] > Low[0] && uptrend != 3)

Now we are changing the past

If u want to have indicator that will not change the past u should code it like that:

[CODE]

if( High[shift+1] > High[0] && Low[shift+1] > Low[0] && uptrend != 3)

Regards

Kale

Reason: