Grid RSI StopPending
This is a grid Expert Advisor with a position averaging and ability to enable/disable the martingale.
RSI is used for placing the first order. Settings and indicator levels are set by users.
Note: All distances in the EA are set in ratios from the ATR volatility indicator.
A BuyStop order is placed when a symbol is oversold, while a SellStop one is applied if the price is overbought at the Distance_pending distance from the current price.
If the price moves from a pending order, the order follows the price at a specified Distance_pending distance.
When a pending order is activated and moves into unprofitable area, the next pending order of the grid is placed not closer than the Distance_betw_ord distance from the nearest grid order and not closer than the Distance_pending of the current price if a new RSI signal arrives.
The next order lot can be opened via the Martin ratio of the previous open order of the grid. To disable the lot increase function, set Martin=1.
If the price moves the Distance_Trall_SL_start distance from the total grid breakeven price in favorable direction, a StopLoss is placed for each grid order at the Distance_Trall_SL distance of the current price. Thus, the StopLoss becomes common and the grid is closed at the same time.
Further on, the StopLoss follows the price at the Distance_Trall_SL distance increasing the profit.
No take profit is used in this strategy since it limits the potential profit.
The EA uses horizontal labels on the chart: grid breakeven price, next pending order trigger price, pending order price, StopLoss installation and trailing function trigger price, and StopLoss price.
Also, the EA features the Control_valuts function that protects a deposit against the load by opening unidirectional grids for each of the currencies of a pair that are in the corresponding Buy/Sell status.
Suppose that we have an open Buy order on EURUSD. This means that on GBPUSD, you are allowed to open a Sell grid only, while opening a Buy one is prohibited since USD is sold in the first grid and bought in the second one.
Note: I recommend disabling this function when trading instruments that do not consist of two currencies.
The AlertError and PushError parameters enable terminal alerts and push messages in case of the EA operation issues.