Enter trade when price hits a rectangle
-
Hi,
I'm trying to create an EA that will place a trade when price moves into a rectangle chart object that has been manually drawn. The idea is I draw my areas of interest in a morning and the EA does the rest. The EA will place buy trades when price moves down into blue rectangles and then change their colour after a trade is entered so a second trade can't be placed on the same rectangle. I couldn't find any other threads with something similar.
My attempt doesn't seem to be working so i'd really appreciate some help. The example is for a buy only.
Many thanks
AdamScreenshots attached

-
@adamghous Is the reactangle created manually or automatically? IMHO you should use variables to store the price levels instead of an object.
-
Hi L'andorra,
Yes the rectangles will be created manually. I set the area (marked by the rectangle) I think will create a reaction in price and the EA places the trades on my behalf. Including the SL which is the bottom of the rectangle.
Can explain more about using variables to store the price levels? Currently if price enters a rect from above it stores the rects price 1 and price 2 values in variables and then enters a buy trade including SL and TP based on those variables.
Thanks
Adam -
@adamghous There was a wonderful thread explaining how to do that by I can't find it on the search tool now. Not sure if the hacking crippled that tool too. I cannot provide a reply on how to do it on rectangles but if you know the upper and the lower limits of the proce levels used to trigger a trade you can manually insert them into variables via buttons, for example.
I hope the search too can be fully recovered soon. There you'd find a lot of useful info.
-
@l-andorrà Hello, the google search directed me to this post. Do you think the tutorial you had mentioned could be recreated? IMHO it would be a killer feature to draw into the chart "valid-zones" and the EA does only there what it is intend to do

-
Yeah, someone has already done it and use it. Great idea.
-
@biztet Hey body, do you know where I can find an instruction on how to build this?
-
Sorry i don't know about any instruction about that. But i think the logic is just use condition when price crosses the object, your rectandle box, then execute whatever you want. Use price level for above and below box.... I guess..
-
Any idea to read out the begin and end time of an rectangle? I used before the logic to draw lines and use them later in the script to put pending orders on it, but the usage of rectangles is pretty new to me

-
You can get the time and price values like this: https://fxdreema.com/shared/yJf4kkjnc
-
@jstap Many thanks for the hint!
-
