How to start the trailing stop in the next Candle open time
-
Radoslav,
I really need you help in the following problem. I want to have the "trailing stop" to start at the "open" of the next candle. In other words, when I put a pending order and it is triggered then a new trade is created in a specific candle but I don't want the trailing stop to start immediately, but wait till the open of the next candle and then the EA can start to trail the trade.
For now the only thing I can do is to set the age in minutes where I want the trailing stop to start (You can see this at https://fxdreema.com/shared/h7fambhJb) but this doesn't work in the right way. If for example I am working in the 30 minutes timeframe, each candle lasts for 30 minutes. If the new trade is opened for example at the 12 minutes after the start of the candle , with the above code and the 'check age' option set at 30 minutes, the trailing stop will not start at the open of the next candle but 12 minutes after the start of the next candle. I don't know if this is clear enough but it is very important for me to solve this matter. Thanks in advance. -
No, your example will not work for one very basic reason that most people don't understand. The Trailing Stop block is like a black box, it doesn't care if you put it in a "For each Trades" loop, it has it's own loop inside!
Here is an example of how to make Trailing Stop using pink blocks - https://fxdreema.com/demo/mt4-loop-trailing-stop In this case you can also check for the age of the trade. But to actually do what you want, to start trailing after the new candle... this will require more stuff to be added and it's probably not a better idea anyway. What can be done is probably to compare the Time of the current candle with the OpenTime of the trade, but not directly. OpenTime will be used only to get the Time of the candle where the trade is created. Similar to this:
http://prntscr.com/afgso9
http://i.imgur.com/nB31lXQ.png
... but in this case the accepted value for the time is "Time stamp", which is a string value in format such as "00:00" or "12:53" or something like this. The OpenTime is in different format that is numeric, like here - http://www.epochconverter.com/. In other words, there is no easy to use way to convert OpenTime of a trade to the Time of the candle where the trade is created -
Radoslav, thank you for your answer, I 've already fix the matter with the trailing time and I understand that I cannot find an easy solution for the new candle trailing.
Anyway, my real problem that brings me headache is how to set my fractal strategy to work correctly. I 've already made this project to show you what I really want to do but something is not working well in the loops .
- last edit: Yes, I already managed to make it work using custom indicator.
-
Now you have 2 for cycles one in another, not one after another. Is this your idea...
At this hour of the day my mind doesn't work very well, but these are for loops and if something is wrong, it's probably something logical. But also these loop blocks are not very useful, you probably need to break the loop at some point.You know, weeks ago I added some more options for My Indicators. These options - http://prntscr.com/aglznm The problem is that they are only for custom indicators and Fractals is a built-in indicator.