In this post, we’re diving into the nuts and bolts of two different Expert Advisors (EAs) that utilize moving average crossovers for trade entries. The key difference? One employs a Martingale strategy when trades go south, while the other sticks to a more conservative approach.
Before we get started, I want to stress that these EAs are primarily for learning and demonstration purposes. I wouldn’t recommend using them on a live account just yet.
Inputs for the Simple Moving Average EA:
- MAPeriod: This determines the period of the Moving Average indicator.
- LotSize: This is the size of the lot for each trade.
- TPPoints: Points at which you’ll take your profit.
- SLPoints: Points at which you'll set your stop loss.
Inputs for the Moving Average EA with Martingale:
- MAPeriod: Again, this sets the period for the Moving Average indicator.
- StartingLot: This is the lot size for the first trade; it will increase after a loss.
- MaxLot: This caps the maximum lot size. The StartingLot can only grow until it hits this limit.
- TPPoints: Take profit points, which will adjust upward after a loss.
- SLPoints: Stop loss points that will also increase following a loss.
- LotMultiplier: This value determines how much your lot size will grow after a losing trade, provided you haven’t hit the MaxLot limit.
- TPMultiplier: This factor increases both the Take Profit and Stop Loss after a loss, giving you a fighting chance to recover through both position sizing and larger profit targets.
I've included comments in the code to help you grasp everything, and there's also a YouTube video where I break it all down for you.
Happy trading, and thanks for stopping by!


Comments 0