Buy/Sell Market at Horizontal Line
-
Hello,
I want the EA to buy or sell only once when the price touches a horizontal line that I named "Line". Initially, I had a string constant called "Line" but then I removed it thinking it is the reason the EA is not working.
Anyway, I am attaching the EA here as I am not sure what is causing it to not work.https://fxdreema.com/shared/OvVUL4Y2c
In the meantime, I am sharing a simple EA that will instantly execute a buy/sell for only once with trailing features and risk percentage. This one is working fine for me and thought some may need it.
https://fxdreema.com/shared/h1rVdqbge
Thanks,
-
you need to draw the line in order to reference it, your condition references a line but its never created.

-
just put it under a pass or wherever you see fit. It should be drawn before you reference it, obviously (# of the blocks will matter)
-
@jsauter86
Thank you for your reply.Initially, I wanted to use (Draw Line) but saw that I have to specify where to draw it. But I want to be able to drag the line manually and then the EA recognizes it.
That is why I named it "Line" in the EA and at the same time, I have manually put a Horizontal line on the chart and named it "Line". I also chose (Objects on Chart) and this means it should pick up the name from the Chart. That was my logic.
Not sure how to define the Horizontal Line in the (Draw Line) Block. If I defined it by Candle ID, it will not be draggable. Or If I define it by Market Property, it will still be not draggable. Maybe I can try Objects on Chart again in the Draw Block? I will see.
-
Good luck, I'm not too keen on drawing objects.
Perhaps this needs to be done in the (OnChart) tab rather than OnTick? I found that fixed an issue I was having
-
I am still unable to figure out how to use "Draggable" Horizontal lines for Entry Orders.
Does anyone have an idea or has tried it before?
-
@mohamed80 I would suggest not reinventing the wheel and manually place a stop or limit order. If youre manually creating a line anyways, why take the time to code it?
-
@jsauter86
It helps a lot with changing the stop loss and partial targets when done with lines on the chart. -
Hello,
I have create project with line at open market. I will create another subject for help too.
