How to place order when price higher than all prices of old trades
-
Place an buy order when price is higher than all prices of existing trades of that symbol (ie. GBPUSD) ?
Any suggestions ?
-
@migen How old are those 'existing trades' supposed to be? Hours, days? And do you mean open trads right now or closed ones too?
-
Assuming you mean that when the current price is higher than the highest closing price (or perhaps the opening price) of all your trades over a given period (of your choosing):
I would store the highest trade in a variable called something like (HighestClosePrice) or (HighestOpeningPrice) depending on what you want (I’ll assume close price). Then you could create blocks that [Close Positions] when your trade exit criteria is met, and at the point of closing you could have a [Condition] block that said IF (Market Properties:Current Price) > (HighestClosePrice) THEN [Modify Variables] of (HighestClosePrice) so that (HighestClosePrice) = (Market Properties:Current Price). If it was for the opening price you could create similar blocks at the point of the trade being opened.
Then you could the have a set of blocks that said IF (Market Properties:Current Price) > (HighestClosePrice) (or open price) then BUY . Of course you would need a starting trade to start the process off.
Depending on what market conditions you want to reset the process you could build another set of blocks that would set (HighestClosePrice) to 0 and restart the process.