New free code from MQL5: indicators, EAs, and scripts for traders.

Depending on the value of UpDoun =true or =false, the script either drags the TakeProfit closer to the market or pushes it away from the market holding the same Distance in points.
Reduce lag and improve accuracy with the NonLagMA Expert Advisor for MT4/MT5. Discover it.
If a DC limits placing Stops and Limits "for the market" (usually it's 10 points) you should
//+------------------------------- FIND OUT ABOUT THE LIMITS OF YOUR DC -----+ // if(Distance<10) Dist=10; // else Dist=Distance; //+--------------------------------------------------------------------------+
remove the comment in the block and set the Dist value.
//+------------------------------- FIND OUT ABOUT THE LIMITS OF YOUR DC -----+ if(Distance<10) Dist=10; else Dist=Distance; //+--------------------------------------------------------------------------+
Thanks for reading. Discover premium MetaTrader solutions at RobotFX.
8408