Control of trades, new trades and add to volume - help!
-
Hi
Yes, I do use a group number in the "Start trades loop" in the full EA, although this wasn't shown in my example, and the screen dumps I show you are the ones generated by the full EA.
So, in my example, I have updated to show what's going on in the full EA. You can see it here: http://fxdreema.com/shared/veNl0Hdnc.
What seems to happen is this:
*Group 1 buy is placed, and its own SL is trailed.
Group 2 waits till GoGroup2=1, then when the condition is met, places a buy, and its own SL is trailed.
During the course of the above 2 actions, the SL of Group 1 moves above the buy prices of both group 1 and group 2.
The variable GoGroup3 is then prematurely set to 1, whereas I'm trying to make it wait until the SL of group 2 > open price of group 2.[/list:u:380d1y9b]I can't see any other way in fxDreema of measuring when a SL is above its "mother" buy price; only with either a "Condition" block or the "Check the distance between two levels" block. And as I don't seem to be able to stop this premature setting of GoGroup3, this led me to wondering if it might be possible to add an "Origin of trades" to the "Check the distance between two levels" block so that it could optionally be made to look at a given group only.
Maybe I've missed something obvious, and can do the measurement of distance between a group's open price and its own SL differently. I'm also very happy that you have an idea to resolve this another way later on, but I just wondered if this would provide a workaround for now without causing you too much extra work! And the reason for that is my wish to get my EA running live soon!

Thanks again.

-
Do you try to do something like this? http://fxdreema.com/shared/1LVMmIh7 (it can be made with less blocks using variables, but I'm leaving it like this to show all the steps as independent)
-
Hi
Many thanks for the suggestion. I'll return to this next week after I've finished the block of work I'm doing just now.

-
Hello

No. I'm afraid I don't think your above example will do it because...
*- the add to volume style of the area called "Group #3" will get its own stop loss, whereas I'd like to use the fxDreema "Add to volume" block style, whereby the added volume utilises the original order's SL;- a new trade must not be placed until break even is achieved on the last trade placed, which is why in my example I used "Check distance between two levels" block, but the problem with this is that the block can't differentiate between different groups, and simply looks at all levels and stops;
- this "pony-ing" must continue ad infinitum, trade upon trade.[/list:u:18qca0zu]
This is why I wondered if it would be possible to have the "Check distance between two levels" block optionally do so within groups - see mine of Tue Oct 22, 2013 5:06 pm. However, I understand that this may not be possible, and I'll have to come up with another method of checking if the SL of the latest trade is above its own opening price. Quite how, I don't yet know! Maybe writing something to a file is the answer.
Therefore I may have to revert to having multiple groups within one EA, and estimate how many trades ("Sell/Buy now" block) may come along at any give time; probably somewhere around 20, which will make the EA quite large. But that's just the way it goes sometimes!

-
James, I will say this again - "Check distance between two levels" was not made to check only trade parameters, it was made to check two levels... no matter what levels. One level can be manually written 1 and the other can be manually written 2. This block does not select trades or orders and does not filter trades or orders, it just does not work with trades or orders, it works with two mathematical values coming from somewhere which in this block are called "levels".
What filters and selects trades is "Start trades loop" block, and it load only the last trade of any group, if needed. Then in "Check distance between two levels" you can choose parameters from "(in loop)...." category and this will be valid.
I can see that you are using trailing stop, so if you open fresh trade with fixed SL equal to the trailing stop... what's the difference, the stop is there anyway.
I used 3 groups because I understood it that way - everything starts with trade 1, trade 2 is placed by some rule (x pips above the 1st trade) and trade 3 is placed by another different rule (when SL of trade 1 is above OP). If trades 1, 2, 3 are closed everything starts again. So, maximum 3-trades strategy, or I can't see the rule to create more than 3. But I could be wrong. If the rule to open every trade is the same as for the previous trade, then no groups are needed.
-
Hi, and thank you very much for the reply. As always, I'm grateful.
I'm sorry that I've been somewhat slow on the uptake, but I think I have now better understood the machinations of "Check distance between two levels" when combined with the "Start trades loop" block.
I think I need to go back to the drawing board with this one. As I say, I've proven the method and outcome using minute data going back around 30 years and a spreadsheet. What I have to do is re-interpret and transfer the logic in the spreadsheet to fxDreema and thence to MT4. I believe my difficulty encountered thus far may be born of a confusion of logic and perhaps my attempt to make the odd short-cut.
But thank you again for shining a light into my darkness! Much appreciated. I'll let you know how I get on, and yes, the trailing stop thing is important to how the strategy works. The example I provided was a somewhat simplified version of the full EA so that you didn't have to spend hours trying to decipher my arcane logic! Therefore it may have seemed to be a 3 trade only scenario. Added to which, a part of the strategy relies on material which I can't disperse.
Doubtless I'll be back with a query or two as I re-work this - so my apologies and grateful thanks in advance.
Thanks again,
James.

-
If it's really 3-trades scenario, I think it's better to group trades. If each trade is manipulated in the same way, then there is no need for groups.
"Start trades loop" may sound as something that creates loop (and it does that), but because you can choose to "loop" only one trade, after this trade is selected the loop will not continue with another trade. So, this block in this context can be named "Load last trade" or just "Load trade".
This block loads some trade, it reads it's parameters, and then you can modify some of them with pink blocks with names starting with "(in loop)". That's why I added this "(in loop)" - to know that this block should be used inside loop.
Also, parameters of that loaded trade can be accessed in the "(in loop)" section in "Condition" block or in other blocks that have options "Dynamic...".These "(in loop)" parameters are somehow isolated, so you can use other blocks inside the loop - blocks that also have loops inside like "Close each trade".
Because "Start trades loop" is designed to be able to self-execute itself many times (for each filtered trade), when all this ends it goes to the yellow output, so the yellow output can be used to connect blocks that must be executed after the loop ends.
For MT4 I really recommend to always use "Start trades loop" (or other 2 loop blocks, if needed) before using "(in loop)" blocks or parameters.
In MT5 because position is selected by it's symbol this is not that mandatory, but in MT4 where you can have so many trades around, the EA must know with which one of them to work.