trend line alert cross notification

 

Hello!

good afternoon.

i want to modify attached source to suit what i want style.

this is trend line alert and if price line cross then alert fire but it every bar alert fire so

i want to try to make it only one times for alert but no luck.

i was used

static datetime Time0;

if(Time0 == Time[0] ) return;

but it continue alert per bar.

any help much appreciate

 
james27:

Hello!

good afternoon.

i want to modify attached source to suit what i want style.

this is trend line alert and if price line cross then alert fire but it every bar alert fire so

i want to try to make it only one times for alert but no luck.

Where do you set . . . Time0 = Time[0] ?
 
james27:

Hello!

good afternoon.

i want to modify attached source to suit what i want style.

this is trend line alert and if price line cross then alert fire but it every bar alert fire so

i want to try to make it only one times for alert but no luck.

i was used

static datetime Time0;

if(Time0 == Time[0] ) return;

but it continue alert per bar.

any help much appreciate



You should use a simple bool for this. Your using time all wrong. See file, should only give one alert now, but i havnt tested.
 
marty087:
You should use a simple bool for this. Your using time all wrong. See file, should only give one alert now, but i havnt tested.

You will only get one alert . . . you never set Alerted == false other than where it is declared . . . please mark you changes in future so they are easier to find.
 

thanks RaptorUK and marty087!

i was test marty087 your modified indicator but it only alert one times when price line go above trend line but

when price line go below trend line it never alert.

i was attached orginal source file . before i was try to modify from attached source file.

but actually some function couldn't understand i was try to debug using Print function but it very confuse.

in function valc = ObjectGetValueByShift exist..and when debug this value.

i was found valc is start of candle wicks value ? but what is valp value? i can't figure out.. double valp = ObjectGetValueByShift(LineName,testbar+1);

i think valp value is not Close[1] or Close[0] value..

what i actually want is .. when price line go above trend line alert one times and if price line( Close[1]) go below alert one times

thanks you!

Files:
 
james27:


what i actually want is .. when price line go above trend line alert one times and if price line( Close[1]) go below alert one times

You should read this thread: https://www.mql5.com/en/forum/146374
 

did you read what i wrote just before ?

i was wrote such like "i was found valc is start of candle wicks value ? but what is valp value? i can't figure out.. double valp = ObjectGetValueByShift(LineName,testbar+1);"

and in this thread https://forum.mql4.com/57289, you mention i have to read ObjectGetValueByShift this function..

ok what i want to say is ..i was read what you said related with ObjectGetValueByShift and i was try to modify source code with this function but still not working

 
How sad it is when a man's character can be determined from a few posts or a few topics he starts.
 
james27:

did you read what i wrote just before ?

i was wrote such like "i was found valc is start of candle wicks value ? but what is valp value? i can't figure out.. double valp = ObjectGetValueByShift(LineName,testbar+1);"

and in this thread https://forum.mql4.com/57289, you mention i have to read ObjectGetValueByShift this function..

ok what i want to say is ..i was read what you said related with ObjectGetValueByShift and i was try to modify source code with this function but still not working

If you really want to understand how to use this function then write some test code first, a little script ot Indicator to practice with, once you have figured out how to use this function correctly then you can add it where you really need it.

Write your test code and if you are having problems with it ask again . . . if all you want is someone to write your code for you then the solution is very, very simple: write my mql4 code for me
Reason: