There are several issues with this function.
First: you assume that a pip is always "Points() * 10". This is not always true as it depends on the particular symbol: PIPs are specific to currency pairs only (and not to stocks and indices).
Second: you don't always calculate the t/s correctly. For a buy order the issue arises when the s/l is below the order opening price. This is because you have the "if (OrderStopLoss() >= OrderOpeningPrice())". You probably meant to do "if (OrderStopLoss() == 0.0)". A similar thing applies to sell orders.
Third: you may consider to return the result of the OrderModify(...) statement.
There are several issues with this function.
First: you assume that a pip is always "Points() * 10". This is not always true as it depends on the particular symbol: PIPs are specific to currency pairs only (and not to stocks and indices).
Second: you don't always calculate the t/s correctly. For a buy order the issue arises when the s/l is below the order opening price. This is because you have the "if (OrderStopLoss() >= OrderOpeningPrice())". You probably meant to do "if (OrderStopLoss() == 0.0)". A similar thing applies to sell orders.
Third: you may consider to return the result of the OrderModify(...) statement.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Trailing Function:
This Is a Normal Trailing Function For All Open Order In MT4. Just paste The Whole Function in Global And To Use The Function Paste The Name Of The Function In OnTick and also give input for pips to Trail.
Author: Kailash Bai Mina