Crawling grid cm_EA_TrailingStopOrders 3r
It is one of the versions of the “Creeping grid” Expert Advisor.
Algorithm of operation:
When running the Expert Advisor, it will place Buy Stop and Sell Stop orders at the pre-defined distance from the price (distance_from_price_to_the_first_order). Depending on the price direction, one of the orders becomes a market one, and the other one starts to “crawl” after the price. When the price pulls back, the latter order also becomes a market one.
When one of these orders hits a pre-set profit, then it will be closed, and a new “crawling” pending order will be placed in the same direction.
If the profit is not hit, and the price goes the other way, the Expert Advisor will average trades by placing “crawling” pending orders, until a grid of all orders has ultimately a profit and closes by total pre-set profit.
This is how the given version of the Expert Advisor works.
The Expert Advisor has very flexible settings and a great many methods of opening and closing orders.
You can allow the Expert Advisor to trade only in one direction which you can set by yourself (allow_Buy_trades and allow_Sell_trades) or disallow it to place the first pending order at all, when running it (disallow_the_first_order). After doing that, it will become your assistant in manual trading.
In other words, the Expert Advisor will be activated and manage orders, if only you have placed them manually in accordance with your trading system.
Orders can be placed by a signal generated by RSI indicator (Indicator_settings = “RSI”).
The Expert Advisor features a function that allows trailing orders based on candlesticks, fractals or points. It also closes orders in various ways.
If you wish to learn more about the Expert Advisor, please read comments for all its settings carefully. There you will find out in details what every setting is responsible for.
extern bool allow_Buy_trades = true; //allows Buy trades extern bool allow_Sell_trades = true; //allows Sell trades extern bool disallow_the_first_order = true; //disallows placing the first order; allows placing the first order, if there is a market order with a magic number (Magic). extern bool place_orders_in_the_trend_direction = false; //places orders in the trend direction extern int distance_from_price_to_the_first_order = 10; //distance from the current price to the first order expressed in the number of pips extern int MinDistance = 30; //disallows placing pending orders at the distance less than the value of OrdersMinSart expressed in pips away from the current price extern int order_step = 5; //step for moving a pending order extern int distance_between_orders = 30; //distance between orders in pips extern double max_loss = 100000; //maximum loss of orders placed in one direction, after which trades opened in this direction cannot be placed extern double LossClosebyTotalProfit = 10.0; //maximum loss of orders placed in one direction, after which trades will be closed by total profit only extern double order_volume = 0.1; //order volume extern double add_order_volume = 0.0; //adds the value to the lot size of each subsequent trade extern double multiply_order_volume = 1.5; //multiplies the lot size of each subsequent trade by the value extern int round_lots = 2; //lots of orders to be rounded: 1 – up to one decimal place (0.1), 2 – up to two decimal places (0.01) extern double profit_for_closing_2_directions = 10.0; //profit in deposit currency by which orders placed in all directions will be closed //(when orders placed in one direction have a loss, then a total profit locked in after closing of all orders will be defined by this parameter) extern double profit_for_closing_1_direction = 50.0; //profit in deposit currency by which orders placed in one direction will be closed extern int К_autocalculation_of_profit = 50; //coefficient for automatic calculation of profit extern double LossClose = 100000.0; //loss in deposit currency by which orders placed in one direction will be closed extern string ____________________ = ""; extern string Trailing_settings = "0 – disabled, 1 – candlesticks, 2 – fractals, >2 – points"; extern int trailing_length = 1; // length of trailing extern int trailing_step = 0; // step of trailing – moves stop-loss at the distance not less than the trailing step extern int trailing_min_profit = 10; // minimum profit in pips to trail extern int distance_from_fractal_candlestick = 0; // distance from a fractal, a candlestick, etc. extern int candlestick_or_fractal_timeframe = 15; // timeframe of a candlestick or a fractal chart to trail (0 – the current timeframe) extern string __________________ = ""; extern string Other_settings = ""; extern int Magic = 777; //integer number extern int размер_шрифта = 10; //font size in units extern color info_color = Lime; //color of displayed information extern int Stoploss = 0; //stop-loss in points extern int Takeprofit = 0; //take-profit in points extern string ___________________ = ""; extern string indicator_settings = "RSI"; extern bool open_1_order_by_indicator = false; //if false, places market orders regardless of the indicator’s signals extern int oversold_area = 15; //when the price enters the area, places the first order extern int overbought_area = 85; // when the price enters the area, places the first order extern int RSI_Period = 5; extern int indicator_timeframe = 0; // 0 – the current timeframe, 1 – minute timeframe, 60 – hourly timeframe … extern int Key = 0;
This is a demo-version of the Expert Advisor. You may use it in a Strategy Tester and on demo accounts without any limits. You need to enter a key to start trading on a real account. Learn more ….
Why it does pay to make use of an affiliate program, if you want to get the key. Read here.