How/what blocks can i use the blocks to structure this problem?
-
Thanks in advance.
I want to say.
If there is/when ever there is a TRADE on the SELL order
Then place a pending BUY order.The issue i am having is that it is placing multiple BUY order trades. i would just like it to place on pending BUY order for every SELL order that becomes an order.
-
Use this on the 'On trade' tab:

-
hmm.. thats strange.
That 'trade created' block doesn't seem to exist on my version of fxdreema..
Is there any other way this can be done?
thanks -
-
@fxgjg
^^ You are on the "on Tick" tab, click the "on Trade" one.
As well "on tick", i think you can do it this way : https://fxdreema.com/shared/ZzlAeTyGb -
@seb-0
I've just realised.... in the link youve sent above you are showing me blocks for mql5.... I am using mql4...
The '(on Trade) filter specific event option has now just appeared on my dropdown...
I will put the blocks together and update you....
many thanks -
Bingo... ive done the Trade created block then attached the pending buy order block... It works... any only places one buy order for every new sell order created....
thanks again.... -

So im also tryiny to close out the pending buy order once the sell order has closed... in the same order but it seems not to be working
-
Ok i made an error... now fixed using the close pending orders block instead of close trade block.
How can i close each pending buy order that was opened with each sell order (once the sell order is closed) i.e. the pending sell order that got triggered and became a sell order which then opened a buy order.. but when that sell order is closed (whether by take profit or stop loss) i would like the corresponding pending buy order to be closed NOT to close out all the other pending buy orders.
thanks in advance
-
It depends. How many orders can ther be open at the same time. Linking each one to 'its own' pending can be solved with arrays. Sadly that is something that can't be done with fxDreema, so I can't either :(.
However, roar craeted a wonderful example not long ago and maybe could geive you a hand.
-
@l-andorrà ok thanks...
is roar a member of this forum?
Can anyone here code up that part of the EA/Script for me... i would be happy to pay $ -
Yes, he is one of the most active members here.
-
OK i will await Roars return...
in the meantime this is a visual of what i would like to achieve...
i want to be able to link the Pending SELL/BUY blocks to the Trade closed blocks...
Whenever i try it doesn't even close the pending orders... so i have left it detached (however, leaving it detached closes ALL the pending orders on screen)
-
@fxgjg Hi!
I would connect the buy and sell orders with the group ID.
I use a variable tradeID for that in my example. Just make sure you use the same group ID for the orders (open the orders at the same time).
Now you can check if there is a running buy/sell, if not, delete pending orders with the corresponding group #. -
Thanks @roar
I'll give it a try now.
I think i have to explain a bit more... for the issue is when i have multiple Pending BUY or Pending SELL orders placed... i only wish to close specific ones. (i.e. the ones that directly correlate to the current market conditions and not the ones away from the current market conditions.


As you can see above, once the sell order (red arrow) was closed (yellow arrow) then all 3 pending buy orders (blue arrows) were instantly closed (pink arrows)
What i would wish to happen is for the last/lowest (closest) pending buy (blue arrow) to be closed when the sell is closed leaving the other 2 pending buys open until their sell orders are closed.
-
@fxgjg Sounds like you are more opening and deleting pending orders than trade them. However, is the number of pending orders fix or variable? You might count through the open orders and close that much that you no need anymore. But I need to understand what's the intention first - especially static vs variable rules.
-
@fxgjg said in How/what blocks can i use the blocks to structure this problem?:
Thanks @roar
I'll give it a try now.
I think i have to explain a bit more...
As you can see above, once the sell order (red arrow) was closed (yellow arrow) then all 3 pending buy orders (blue arrows) were instantly closed (pink arrows)What i would wish to happen is for the last/lowest (closest) pending buy (blue arrow) to be closed when the sell is closed leaving the other 2 pending buys open until their sell orders are closed.
So, in a nutshell: buys and sells are done in pairs. This is why I would use some specific group number for each pair.
I wouldn't care to keep such a precise track myself, though.
I would just limit the number of pending orders, using the "check pending orders count" block.
