I want to start trailing stop from any point!
Hello. This is Chobitto FX.
Well, as the title suggests,EA CreateI added logic to start trailing stop from a specified pip based on the source code generated by the EA Create.
It’s perfect for when you want it to extend after securing profits, right?
Now, onto adding the logic.
EA CreateWe’ll look for where the trailing stop code configured in the options is located.
if(isTrailingStop == true) TrailingStop(TrailinStopNormalValue, Magic1);
Then write it so that it activates when the unrealized profit reaches or exceeds the specified pip value.
// If the unrealized profit is at least the specified trailing stop start value (TrailinStopNormalStartValue)
if(getOrderProfitPips("0", 0, true) >= TrailinStopNormalStartValue) {
// If trailing stop is enabled, execute
if(isTrailingStop == true) TrailingStop(TrailinStopNormalValue, Magic1); // Set the trailing stop
}“TrailInStopNormalStartValue” isinput provided.
input double TrailinStopNormalStartValue = 40;
EA Createprovides the function “getOrderProfitPips("0", 0, true),” which was prepared by a wonderful engineer at GogoJungle.
The unrealized profit is obtained with “getOrderProfitPips("0", 0, true)”, and when it reaches the specified value “TrailinStopNormalStartValue”, the trailing stop starts. That’s the idea.
Pretty simple, right.
This tooEA Createis possible because the source it outputs is highly readable and versatile, enabling customization.
Much appreciated, indeed.
See you again.
File download is available below.