Trade by lines
Trade By Lines Expert Advisor automatically opens orders from trend lines. It works only with the lines of the selected color. Color of lines is set in the settings.
As soon as the price crosses one of the lines having a specified color, Buy or Sell market order is opened immediately depending on the operation mode.
There are several modes of operation.The direction of deals is set in TradeDirection parameter.
- for breakthrough TradeDirection = 0
In this mode, Sell order is opened if the price crosses the line downwards and Buy one is opened if the price crosses the line upwards.
- for rollback TradeDirection = 1
In this mode, Buy order is opened if the price crosses the line downwards and Sell one is opened if the price crosses the line upwards.
You can set each line to be used for opening an order only once. Use SingleLineUse parameter for this.
- SingleLineUse = true
Only one order will be opened by a line, after that the line will not be used.
- SingleLineUse = false
Each line can be used for several orders.
- OneOpenedOrder = true
The Expert Advisor can open only one working order at a time. Touching other lines is ignored until the current order is closed.
- OneOpenedOrder = false
The Expert Advisor can open as many order as the number of working lines.
In real trading, the price may jump over the line without touching it during strong movements. LinePriceOffset parameter is provided to deal with that case. The maximum number of points the price can jump over for a deal to be opened is set in this parameter.
- MagicNumber - unique number of the Expert Advisor.
- LinesColor - color of the lines the Expert Advisor will trade from.
- Lot - order volume.
- TradeDirection - trading direction, breakthrough or rollback.
- OpenBuy - whether Buy orders should be opened.
- OpenSell - whether Sell orders should be opened.
- TakeProfit - take profit in points.
- StopLoss - stop loss in points.
- LinePriceOffset - maximum distance (in points) the price can jump over for a deal to be opened.
- Slippage - slippage in points.
- UseBreakeven - whether break-even should be used.
- BreakevenProfit - necessary profit level in points, at which the stop loss is moved to the break-even level.
- BreakevenStep - break-even level relative to the Open price.
- UseTrailing - whether trailing stop should be used.
- TrailingProfit - necessary profit level in points, at which the trailing stop starts moving the stop loss following the price.
- TrailingStep - trailing step.
Added SingleLineUse mode. In this mode, the EA opens no more than one order for each line, then the line changes its color and doesn't work anymore..