Retrive the highest open price from a group of orders
-
How would I go about retrieving the highest open price from a group of buy orders?
And how would I retrieve the average open price for all these orders, balanced out for lotsize
Thanks
-
Now only possible with variables, but I'm currently working for new category of blocks to do exactly that
-
any idea for a timeline, to see if I can wait
-
I already have it, but when I do something new, I'm normally trying different ways, because in the process I can dedide that something needs to be added ot removed
-
Okay I will wait for the release
-
I uploaded this, also with other visual updates.
So, the keyword is "Bucket". You will find this group now called "Bucket of Trades &..." and I marked it as experimental, which means that I can decide to make some changes. Very often I get better idead right after upload something

There are 3 blocks inside. Each one selects a group of trades and there are very basic filters. Then in "Condition" you can find a new category with the keyword "Bucket" again. This is where you can choose what value you want to get from the selected group. Count, Profit, SL, TP, Lotsize... such things are now available and you can also choose to get the Total, Average, Maximum or Minimum value.
Additionally there is some advanced option that I just decided to use. The idea here is that you can write some condition in pure MQL4, something like:
OrderType() == OP_SELL
which will filter only sells for the actual calculations. So, the bucket can have Buys, but with this option they can be filtered. I'm not sure if it's better to keep this option over there or directly into the Bucket-blocks, but that's why this is still experimental, I will decide.Also, multiple different buckets can be selected at any given time. Each of them is identified by color (which is Bucket ID). By default in "Condition" you will work with the bucket that was selected last, but if you want you can select 2 buckets (before "Condition") and compare values from both of them in "Condition" by using those colors (Bucket ID).
I can in fact add blocks like "close", "modify stops" and everything similar to the pink blocks, but for now I don't know what new can this bring to the builder.
-
Thanks
I will have a look and start experimentingCheers
-
First observation
I retrieved the average price of all open buy orders adn all open sell orders
when I compare to iExposure it does not give the same average priceWhat is the difference in the calculations?
-
The Average... thing in the calculations should the mathematical average, which is the sum of all divided by their count. I don't know for iExposure, maybe it calculates some weighted values that depend on the type and the lotsize?
-
I checked iexposure calculates based on weighted, instead of count it use lotszies
which makes more sens as the number of trades is not relevant (unless they are all the same lotsize)
if you cahnge it for weighted it would give you the BE price of all open buy trades, which is very useful when hedging and minimizing account losslet us know whether you change it or add another option
thansk
-
I am still having issues with the bucket function
orderlotsizes and average prices are still no calculating correctly
-
I think I'm gonna stop answering to question if there is no showcase included (simple project showing the problem directly). I'm really tired of imagining what exactly could be wrong
