Script or EA that opens a pending trade at the price of a horizontal line.
-
Good morning, I'm trying to create a very simple Scritpt or EA and I can't get it. I need that when dragging it to the chart, it opens a pending trade in the price of a horizontal line that I will have previously drawn. I tried it with pending order on the object price of the chart and it doesn't open the trade for me. Can someone help me?
Thank you very much.
-
@cllatser I do something similar in my tutorial EA I published here last weekend. I set TP level and pick them up on the on Init tab. You may have a look there or share your project here.
-
@cllatser
Are you specific on the name of your object?Every Object Contains a "Name" and "Description"
Your condition will have to match your "Name" at least. You can filter by color or other parameters. I personally use Color.
For example, create a line. Call it "Pending Order" and color it Yellow (or any color).
On your EA, create a "conditions block"
Left Operand "Object on Chart" Pick by Name, Pending Order EQUALS (==) Right Operand "Value" and Choose Color as your input. Choose the correct color.Connect this block to "Buy (or Sell) Pending Order"
You will have to differentiate between Buys and Sells though. To do this, you can use two different colors. Then match your conditions to the correct color to open a pending/limit buy or pending/limit sell.
If you want to know what parameters your object has, press CTRL+B
I forgot, to set the level of your pending order, do the same thing on the Pending Order Block You'll need to choose the
"Custom Price" and then go to "Object on Chart" then Make sure the name matches and go from there. -
@TitanGeorge Done everything you mentioned here (on tick) like for like... unfortunately this does not work