• Overview
• Reviews

# MarkovChains EA

This is an EA/indicator which counts the past bars for relevant price patterns and calculates the up and down price action probabilities. The algorithm can count bars for up to 5 chains and can work with every asset. It categorizes the price action into 8 groups with customizable points thresholds.

The EA can show you the signals with arrows, can alert you to Buy/Sell or do the job for you and trade automatically. For your convenience it prints relevant information on the screen. The upper right corner shows you the past and current price action via the groups with user-defined points threshold (e.g., B5: -200/-100 means on fifth past bar price decreased from 10 to 20 pips). B0 is the current bar. If you follow the signal on the screen, just sell as soon as you see the down arrow and buy when you see the up arrow.

The lower right corner shows the pattern counts and the predicted probabilities. First two lines are the number of patterns counted on that group. Pu and Pd are the predicted probabilities for up and down price actions.

### Example

Suppose in the corner we have the following readings:

• B5: 0/100—The past fifth bar increased from 0 to 10 pips
• B4: -100/0—The past forth bar decreased from 0 to 10 pips
• B3: 0/100—The past third bar increased from 0 to 10 pips
• B2: 0/100—The past second bar increased from 0 to 10 pips
• B1: -100/0—The past first bar decreased from 0 to 10 pips
• B0: 0/100—Current bar is increasing from 0 to 10

Suppose the price action thresholds are -300/-200/-100/0/100/200/300.

U//D=T: 6/3/41/378//351/26/4/5=814 (with the current price pattern B5 to B1, in the past bars right after the pattern, 6 bars increased (Up) more than 30 pips, 3 bars increased from 20 to 30 pips, 41 bars increased from 10 to 20 pips, 378 bars increased from zero (//) to 10 pips, 351 bars decreased (Down) from zero (//) to 10 pips, 26 bars decreased from 10 to 20 pips, 4 bars decreased from 20 to 30 pips, and 5 bars decreased more than 30 pips, with Total of 814 bars counted with the current price pattern)

• U//D=T: 428//386=814—Similar to the previous one but counts just the Ups and Downs
• Pu: 0.52580—Probability of increasing prices
• Pd: 0.47420—Probability of decreasing prices
• Bars: 50000—Number of counted bars for the price pattern

### Input parameters

• show_signal—Set it to true if you like to see the Buy/Sell signals with up/down arrows.

• alert_signal—Set it to true if you like the platform to alert you of the signals.

• number_of_past_bars—Set a sufficiently large amount where the EA searches the price patterns on.

• number_of_chains—Set it to 1–5 where the price pattern occurs on past prices.

• buy_probability (sell_probability)—The threshold probability where the buy (sell) signal occurs above.

• sufficient_pattern_count—Set it to a positive number so that if the total count of price pattern on the past bars is above this number, EA allows a signal.

• PriceAction_Thresholds—The levels for bins by what you want to categorize the price actions. If you get "MarkovChain Bin Thresholds are not acceptable" error, that means you need to check the order of the thresholds (Threshold1<Threshold2, Threshold2<Threshold3, etc.).

• auto_trade—Set it to true if you want the EA trade automatically based on the signals. The true option overrides the show_signal and alert_signal inputs to false.

• lot_size—Lot size used for automated trading.

• magic_number—ID for the automated trades.

• price_slippage—Maximum allowed slippage during opening and closing trades.

• ea_comment—String that identifies the trades done by this EA.

Demo version is available here https://www.mql5.com/en/market/product/6645.

No reviews