How can I create an EA to place an order for buying above current price?
-
Hello,
I am new to FXdreema and seeking help to create an EA to place a buy order at a higher price than market price.
Reason is to replace stop loss of an existing sell trade with countering "buy" trade. Kinda recovery hedging to a loosing "sell" trade, in hope of recovering at later time.
Really appreciate your help! -
Do you want a buy now or a pending buy? And then at what exact distance from current price?
-
@7r4d3rsg Hi, try this

-
@l-andorrà , it should be buy now when the market price hits the configured target price. It is a rescue effort and thus I will wait until the last tick to execute this.
-
@l-andorrà , Thanks for help. I will try and let you know soon.
-
@ambrogio , Thanks for help. I will try and let you know soon.
-
I think I should explain better. Please see in picture. Assume I manually sell at certain price (with TP, but w/o SL) and immediately run EA to place a BUY order at higher price (instead of using SL). Will you guys please help to resolve this? I know hedging does not always work, but something like I want to buy time to watch the situation for sometime, rather than stopped out straight away.

-
-
Try what ambrogio suggests. Also you can add any condition block between blocks 27 and 26 if you want to open that buy at a specific distance from your current sell.
-
@ambrogio This creates too many orders.
-
@forexs Please, share your project and i'll take a look on it
-
@ambrogio said in How can I create an EA to place an order for buying above current price?:
@7r4d3rsg Hi, try this


@ambrogio @l-andorrà , I really appreciate your guidance. But I'm struggling to understand the variable "Stop-Loss" in "Buy pending order" block. What I want to do is to set a target buy price manually in that pending order, also pls note that I do not have SL in original order. I am sorry if it is too silly to ask such question, but I do not have experience in either FXD and any kind of programming EA. Hope you guys can understand and help. Thanks!
-
@ambrogio Thanks a lot
Here it is,
-
I'm a bit lost now. Are both of you asking for the same project? Just confused.
-
@l-andorrà Not at all.
. I started this with very simple question. -
@7r4d3rsg said in How can I create an EA to place an order for buying above current price?:
@ambrogio said in How can I create an EA to place an order for buying above current price?:
@7r4d3rsg Hi, try this


What I want to do is to set a target buy price manually in that pending order

-
@ambrogio , I have done before. It didn't work. Here is my project. https://fxdreema.com/shared/4cRND7wIb . Kindly comment. My take is that the broker does not accept placing "buy pending order" above the current market price. Only way is to use condition and "buy now". Sadly, that one also did not work ( https://fxdreema.com/shared/KcmW6IoR ). Pls correct me if my idea is wrong. Thanks!
-
Just to update. I tested starting from condition check and it did place MANY orders. Then I added "Turn Off Blocks" and manage to stop it at single order.

Will you guys please teach me how to terminate the EA itself after executing once and also delete the objects created by EA. Thanks!
-
@7r4d3rsg said in How can I create an EA to place an order for buying above current price?:
@ambrogio , I have done before. It didn't work. Here is my project. https://fxdreema.com/shared/4cRND7wIb . Kindly comment. My take is that the broker does not accept placing "buy pending order" above the current market price. Only way is to use condition and "buy now". Sadly, that one also did not work ( https://fxdreema.com/shared/KcmW6IoR ). Pls correct me if my idea is wrong. Thanks!
It's not about brokers, it's about logic. Start testing this in the tester
-
@ambrogio , Thanks for update. I will try testing soon. But just wonder, since creating pending buy order above market price is not possible, why do you keep going for it? I have tested using buynow and it works at basic level (screenshot attached). Anyway, I will definitely test your update and post back here. Cheers!

