How It Works
The operation of the Expert Advisor is based on exponential (EMA) and linear weighted (LWMA) moving averages. A buy position opens when EMA is above LWMA, while both MA's are going upward. A sell position opens when EMA is below LWMA, while both MA's are going downward.
When EMA gets lower than LWMA, a buy position is closed. When EMA gets higher than LWMA, a sell position is closed.
The lot size for positions to be opened can be fixed or proportional to free margin. There is an additional function to reduce the lot size at losses - the more consecutive losing trades, the smaller the lot size.
The image below shows the performance of the Expert Advisor in the strategy tester's visual mode.
Translated from Russian by MetaQuotes Software Corp.
Original code: https://www.mql5.com/ru/code/1076
The Expert Advisor operating based on the SAR and ADX indicators where the permitted trade direction is selected based on trade results.iClose_HTF
The iClose_HTF indicator plots a zigzag based on closing prices of a time frame specified in the input parameters.