try this:
if( ObjectFind("BUY") != -1 ) ObjectDelete("BUY"); ObjectCreate("BUY", OBJ_HLINE, 0, TimeCurrent(), High[current+1]);
Then you can change how your line should look with
ObjectSet(..)
gooly
thanks gooly, it seems to work smoothly
jopopo: but the ea doesn't work.
ObjectSet("BUY", OBJPROP_PRICE1,High[current+1]);
- "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
- Check your return codes and find out if it's even being called. What are Function return values ? How do I use them ? - MQL4 forum
- You could use Gooly's suggestion (always delete and create,) or ObjectMove (if move fails, create,) or your ObjectSet (if set fails, create.) All do the same.
- Current+1 sounds like EA Builder. We hate EA builder
- EA builder makes bad code counting up while closing multiple orders.
- EA builder makes bad code Bars is unreliable (max bars on chart) volume is unreliable (miss ticks) Always use time
- EA builder makes bad code Not adjusting for 4/5 digit brokers
- EA builder makes bad code not adjusting for ECN brokers.
- EA builder makes bad code not checking return codes.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
I m trying to create an ea that will move an horizontal line on the High/Low of the previous candle according to certain condition. the compilation is OK, but the ea doesn't work.
if you can highlight the mistaken part, it would be great.
thanks