The Expert Advisor is based on simple mathematics. The EA places two opposite-directed orders. Wherever the price goes, one order will always have a positive result, the second one will have negative. If we average it, then on the return movement of the price (only a few spreads) the averaged orders are closed and there is only profitable order left! The EA trades through its profit. Of course, the averaging positions also add profit due to MinProfit, especially if you use rebate programs to return the spread.
Additionally, the EA provides an MA based filter, but I usually turn it off. The easiest way to understand the work of the Expert Advisor, is to run it in the tester with visualization and see how it works at a low speed. I think even a beginner can do it.
- TF - timeframe of the candlestick chart for determining the trend direction, set in minutes 1 5 15 30 60 240...
- MinStep - the minimum spacing between orders (in terminals with 5 and 3-digit quotes should be increased 10 times)
- Lot - if = 0, then the lot will be calculated as a percentage of available funds for risk %
- risk - the percentage of available funds
- K_Martin - multiplication of subsequent lots (can be set to 1 to disable lot increase and not to use to much of the deposit)
- MA - MA filter (order is placed based on the MA: if the price is above the MA, then only BUY and vice versa. 0 - Disable filter)
- Magic - a unique number of the EA's orders
- DrawInfo - display information on the screen
- DigitsLot - rounding lots of orders, 1 - tenths (0.1), 2 - hundredths (0.01)
- slippage - slippage
- MinProfit - minimum profit in points to close all averaging orders
- Set2 - if true, immediately places a pair of orders without a signal, if false then waits when the candle closes above/below the previous one