OpenTimeTral
- Uzman Danışmanlar
- Valeriy Yastremskiy
- Sürüm: 1.0
- Etkinleştirmeler: 5
Time adviser with dynamic trailing stop and trailing profit.
The OpenTimeTral2 expert Advisor sets the selected order types at the appointed time and uses a dynamic trailing stop and trailing profit for the first market order.
Restrictions on selecting order types:
1. You can only select one type of market order, either Buy or Sell. And with the selected market order, you can't select pending orders.
2. Pending and limit orders can be selected in any combination.
After converting the first pending or limit order to a market order, the remaining pending and limit orders are deleted.
A dynamic trailing stop is used for a market order. Stoploss is modified by a distance no greater than the trailing Stop value from the current Bid price for Buy orders, and from the Ask price for Sell orders, and reduces the trailing Stop when approaching TakeProfit using the linear or feedback-accelerated formula.
For TakeProfit, a constant trailing value is also used. When the current price approaches the TakeProfit level, the TakeProfit is modified by the TralingProfit distance.
If you don't need a trailing Stop or a trailing Profit, select the corresponding values 0.
If you don't need to approximate the trailing Stop, select the value Ksl = 0
If you want to use Prots as a percentage of available funds, set the Lots value to zero.
Input parameters
Lots=0.01; //working lot
Prots=0.01; // Percentage of available funds
slippage =2; //the level of acceptable slippage - requote in points
TakeProfit=500; //take profit in points
StopLoss=200; //stop loss in points
Open_Level_St=100; //distance level from the price for stop orders
Open_Level_Lim=200; //distance level from the price for limit orders
Tral_Stop=200; // Dist. persecutions StopLoss, Tral_Stop
Tral_Profit=100; // Dist. moving away TakeProfit, Tral_Profit
Ksl = 0.2; // StopLoss reduction coefficient, when approaching TakeProfit by the formula for Buy
// linear approximation SL = Bid - (Tral - 0.2(Bid - OrderOpenPrice()))
// dynamic approximation SL = Bid - (SL - Ksl (Bid - OrderOpenPrice()))
Open_Time=D'03.01.2019 13:00:00'; //the time of opening orders must be greater than the current time.
time_op = 600; // The lifetime of pending orders, in minutes, must be more than 11 minutes.
extern int Magic=5345; //the magic number of our orders
coming=linear; // the choice of a linear approximation or a dynamic Trailing stop
extern bool Open_Buy=false; //Yes/No working with buy orders
extern bool Open_Sell=false; //Yes/No working with sell orders
extern bool Open_Buy_Limit=false; //Yes/No working with buy limit orders
extern bool Open_Sell_Limit=false; //Yes/No working with sell limit orders
extern bool Open_Buy_Stop=True; //Yes/No working with buy stop orders
extern bool Open_Sell_Stop=True; //Yes/No working with sell stop orders