Experts: TP SL Trailing - page 2

 
Yui kmitokawa :
there is a small bug that i have found, while you SELL a position, it shows reduced TP as in TP - (minus) SPREADS, and SL+ SPREADS while the same does not happen with BUY position as it shows exact values of TP and SL. kindly check and please fix the bug. (also the trailing step is taken by default at 20 points which is good but if you add that as an option for users it would be interesting)!

This is old code. It works according to this specification:

If Only zero values is "true" - this means searching for positions having either stop loss, or take profit equal to zero. As soon as such a position is found:

  • If this is a BUY position
    • a stop loss is set: current price (Bid) minus stop loss
    • a take profit is set: current price (Bid) plus take profit
  • If this is a SELL position
    • a stop loss is set: current price (Ask) plus stop loss
    • a take profit is set: current price (Ask) minus take profit
 
Stop Loss and Take Profit are initially set. Trailing. How to use in strategy testing
 
zhimajin :
Stop Loss and Take Profit are initially set. Trailing. How to use in strategy testing

For strategy testers, uncomment:

   ExtStopLoss    = InpStopLoss     * m_adjusted_point;
   ExtTakeProfit  = InpTakeProfit   * m_adjusted_point;
   ExtTrailingStop= InpTrailingStop * m_adjusted_point;
   ExtTrailingStep= InpTrailingStep * m_adjusted_point;

   m_trade.Buy(2.0);
   m_trade.Sell(1.0);
//---
   return(INIT_SUCCEEDED);
  }
 

Already deleted it, still can't test it

 
zhimajin :

Already deleted it, still can't test it

Original article on Russian forum: https: //www.mql5.com/ru/code/22001 (version 1.002)

TP SL Trailing
TP SL Trailing
  • www.mql5.com
Первоначальная установка Стоп Лосс ( Stop Loss ) и Тейк Профит ( Take Profit ), если у позиции эти свойства не установлены. Трейлинг, который работает только для прибыльных позиций. Если установить параметр  Only zero values  в "true" - это означает поиск позиций, у которых или Стоп Лосс или Тейк Профит равны нулю, и как только такая позиция...
 
Added TP SL Trailing to the chart. Then test other EA's, will TP SL trailing work?
 
zhimajin:
Added TP SL Trailing to the chart. Then test another EA, will TP SL Trailing work?

Извините, я Вас не понимаю.

 
Is that right?
 
zhimajin:
Is this right?

Извините, я могу перевести текст, но я могу перевести картинку. Пожалуйста или пишите на Русском или пишите на Английском.

 
Is there an easy way to disable the Trailing Stop in your code?