How to check existing trade?
-
Hi fxDreema,
Great site and hard work, well done!
I need some help. I tried a lot of things but I couldnt find the block to do this:
How can I check an open position and open an other position when for example the market price goes 10 pips under the opening price of the first position?
Thank you in advance.
Pityu -
One way is to create multiple pending orders at some distance from each other. They are also executed on the server, which is a good bonus, and they also support expiration. "Buy pending orders in grid" or "Sell pending orders in grid" is to do that.
Otherwise you have to spy the last trade. Something like this: https://fxdreema.com/shared/HdVlWXpKc
-
Thanks,
I am wondering is there any way to give ID numbers to the positions so then the "FOR EACH TRADE" block could filter only that position? or I have to use group numbers..but it does not work for me.
Also for some reason the first block "NO TRADE/ORDER EXIST" does not work for me...during test the robot opens lots of positions at the same time. Is it because I gave group numbers?
-
Yes, because of group numbers. No trade exists now checks trades with group = 0, then you create a trade with different group number, and No trade exists just don't care about that.
Well, if you can separate trades by type (Buy, Sell), do it by type. Note that all pink blocks are universal, they work for buys and sells (whateve For each Trade is loading above).
Look at "Not more than N trades" option in "For each Trade". it depends, but I think you should set it to 1... maybe. And also take a look at the "once per trade/order" block, I think you have to put this one after the "pips away". -
Hi,
I am back again. I am stuck again.
somehow I can not make the ea to close the trades.
I want to close all the trades when any of the trades hit the take profit.
the robot would open 0,1 lot buy position then when the price goes 15 pips below opening price opens a sell position with double size lot (0,2 lot). when the price goes up again abowe the opening price of the sell position - open an other buy with double size(0,4 lot) so on...
But I want the robot close all the positions when any of the positions hit the TP. what is wrong in my project?https://fxdreema.com/shared/Vh6W7Kjxe
is there any more simple way to do this?
thank you in advance. -
Try "on Trade" event. There is a block to filter the event when some trade closes (by TP, if needed) and then put "Close trades".
For the other thing, why don't you try this block "Round numbers detector", I think it does exactly what you want to do. Write 0.0015 inside and connect one Buy now and one Sell now to it's outputs.
-