Cm EA TrailingStopOrders
The algorithm of the adviser's work:
When the Expert Advisor is launched at a specified distance from the price (first_step), BuyStop and SellStop orders are placed. Further, depending on which way the price went, one of them becomes market, and the other begins to crawl after the price. When the price rolls back, it also becomes market. If we have reached a set profit in some direction, the order is closed and a creeping pending order of the same direction is placed again. If the profit is not reached, and the price has turned around, we start averaging, also placing creeping pending orders, until eventually the entire averaging network comes out in plus and closes according to the total set profit.
The Expert Advisor is very flexible and has a lot of possibilities for both opening and closing orders.
You can set the trade in only one direction of your choice (allow_delky_viu and ALLOW_DELK_SELL) or even forbid him to place the first pending orders at launch (forbid_first_order) and then he turns into your assistant in manual trading.
That is, it will turn on and accompany orders only after you manually place an order using some system of your own. Orders can be placed based on the signal of the RSI indicator (Indicator settings = “RSI")
There is also a trawl, by candlesticks, fractals or points, various options for closing orders.
If you are interested in this Expert Advisor, then carefully read the comments to each of the settings – it describes in detail what it is responsible for.
- allow_delky_viu = true; //allow Buy
- transactions allow_delk_sell = true; //allow Sell
- transactions prohibit first_order = true; //prohibit placing the first order, start working only if there is a market order with Magic Magic.
- open_order to_trend = false; //open orders by trend
- first_step = 10; //the first step from the current price in pips
- is not to put the order closer = 30; //do not put the pending order closer than OrdersMinSart points from the current price
- , the step of displacement = 5; //the step of moving the pending order
- is the distance between the orders = 30; //the distance between orders in pips
- is the maximum loss = 100000; //the maximum loss of the direction, after which transactions in this direction are not opened
- ubytok_zakr.by_consult.profit = 10.0; //the maximum loss of the direction, after which there is a closure only for the total profit
- of the order volume = 0.1; //order volume
- add_to_order volume = 0.0; //add this value to the lot of subsequent orders
- multiplication of_order volume = 1.5; //multiply the lot of subsequent orders by this value
- profit_order.2_directions = 10.0; //profit for closing orders of all directions in the deposit currency (works at the moment when the maximum loss is reached loss_order.by_consult.profit of one direction)
- profit_zakr.1_direction = 50.0; //profit for closing orders of one direction in the deposit currency
- To_autoraction_profits = 50; //coefficient of auto-calculation of profit (if greater than 0, then the profit_account.1_direction is ignored)
- loss for closing = 100000.0; //loss for closing orders of one direction in the deposit currency
- Seting_trall = "0-disabled 1-candlesticks 2-fractals >2-points";
- long_trall = 1; // length of the trall_trall
- step = 0; // trall step - move the stoploss no closer than
- the step_trall minimal_profit_trall = 10; // minimum profit of the trall in pips extern
- timeframe candlesticks or fractals = 15; // timeframe candles or fractals for a thrall (0-current)
- Magic = 777; //integer font_size = 10; //font size in units
- of color_information output = Lime; //information output color
- Stoploss = 0; //stoploss in points
- Takeprofit = 0; //takeprofit in points
- Indicator settings = "RSI";
- open_1_order to the indicator = false; //if false, we open orders from the market without taking into account the
- oversold zone indicator= 15; //when entering the zone, we place the first order
- of the overbought zone = 85; //when entering the zone, we place the first order
- RSI_Period = 5; timeframe of the indicator = 0; //0 current, 1 - minute, 60 - hour ...