Skip to product information
1 of 1

forexeasourcecodes

EX4 EA MiReDo

EX4 EA MiReDo

Regular price $0.00 USD
Regular price Sale price $0.00 USD
Sale Sold out
Quantity

Overview of Trading Strategy
The EA uses a grid-based approach, placing buy and sell orders when the price reaches predefined levels (set by horizontal lines LineBuy and LineSell). It employs a momentum-based entry condition (comparing the open and close prices of the current bar) and increases lot sizes for additional grid orders using a multiplier (GandaanLot). The EA includes a news filter to pause trading during significant economic news events and a drawdown control system to close all trades based on profit or loss thresholds. It is designed to trade within a specified time window and avoids placing redundant orders by checking the last trade type and open positions.
Key Components of the Trading Logic

Input Parameters:

GandaanLot: Lot size multiplier for subsequent grid orders (default: 1.2). For example, if the initial lot is 0.01, the next order would be 0.012, then 0.0144, etc.
MinProfit: Minimum profit as a percentage of account balance to close all trades (default: 0.05%, or 0.0005).
Risk: Risk percentage of account balance to determine initial lot size (default: 1%).
Jarak: Distance in points from the current price to set buy and sell lines (default: 20 points).
Langkah: Step size in points for additional grid orders (default: 10 points).
Magic: Unique magic number to identify EA trades (default: 1234).
TimeStart and TimeEnd: Trading hours (default: 3 AM to 11 PM).
closeAllControlON: Enables drawdown control (default: false).
closeBy: Mode for closing all trades (by money or account percentage).
closeAllMoney and closeAllMoneyLoss: Profit/loss thresholds in dollars to close all trades (default: +$100/-$100).
accountPerWin and accountPerLos: Profit/loss thresholds as a percentage of account balance (default: +1%/-1%).
News Filter Parameters:

NEWS_FILTER: Enables news filter (default: true).
NEWS_IMPOTANCE_LOW/MEDIUM/HIGH: Filters news by importance (default: false/true/true).
STOP_BEFORE_NEWS and START_AFTER_NEWS: Pauses trading before and after news (default: 30 minutes each).
Currencies_Check: Currencies to monitor for news (default: USD, EUR, CAD, AUD, NZD, GBP).
DRAW_NEWS_CHART and DRAW_NEWS_LINES: Displays news events and lines on the chart (default: true/false).




Initialization:

In OnInit(), the EA:

Sets the point multiplier (D) to 10 for 5-digit or 3-digit brokers (e.g., for gold, where 1 point = 0.1 in 5-digit pricing).
Creates two horizontal lines: LineBuy at Ask + Jarak points and LineSell at Bid - Jarak points.
Initializes the news filter (if enabled) to fetch news from http://calendar.fxstreet.com/.




News Filter:

The News class fetches economic news events from an external URL and stores them in a table.
Trading is paused if:

A news event of specified importance (low, medium, high) is occurring for monitored currencies (USD, EUR, etc.).
The event is within STOP_BEFORE_NEWS (30 minutes before) or START_AFTER_NEWS (30 minutes after).


Optionally draws news events on the chart or as vertical lines for visualization.


Trade Entry Logic:

Trading Window: Trades only between TimeStart (3 AM) and TimeEnd (11 PM).
Initial Trade Entry (when no open trades of the same type exist, Count(-1) == 0):

Sell: If the current bar’s open is higher than its close (Open[0] > Close[0]), the price reaches or falls below LineSell (Bid ≤ PricSellLine), and the last trade wasn’t a sell (LastType() != OP_SELL), opens a sell order at Bid.
Buy: If the current bar’s open is lower than its close (Open[0] Close[0], price is at or below LineSell, there are existing sell orders (Count(OP_SELL) > 0), and Bid is at least Langkah points above the last sell price (Bid - Langkah*D*Point > SellPric()), opens a new sell order with lot size Lot * MathPow(GandaanLot, Count(-1)).
For buy trades: If Open[0] 0), and Ask is at least Langkah points below the last buy price (Ask + Langkah*D*Point LineBuy.
LineSell is initially set at Bid - Jarak points and moves to Bid - Jarak if Bid - Jarak*D*Point > LineSell or if Bid > LineBuy and Ask + Jarak*D*Point 0, Ask ≤ LineSell, and total profit as a percentage of account balance (NewProfProc = Profit(-1)/(AccountBalance()/100)) ≥ MinProfit (default: 0.05%).
Closes all sell orders if Count(OP_SELL) > 0, Bid ≥ LineBuy, and NewProfProc ≥ MinProfit.
Closure is done in two steps:

CloseMinus(-1): Closes all losing trades (profit + swap + commission 0).




Drawdown Control (if closeAllControlON is true):

CloseByMoney: Closes all trades if:

Open profit ≥ closeAllMoney (default: $100).
Open profit Close[0]), price hits LineSell (Ask ≤ PricSellLine), and no sell orders exist, opens a sell order with lot size based on Risk (e.g., for $10,000 balance, 1% risk = 0.01 lots for XAUUSD).
If bullish (Open[0] Close[0]), Ask ≤ 1799.80, opens sell order at 1799.80, lot = 0.01, moves LineBuy to 1800.00.
Price rises to 1800.80 (10 points above last sell), opens another sell order at 1800.80, lot = 0.012.
If total profit reaches 0.05% ($5) and Bid ≥ LineBuy (1800.20), closes all sell orders (losing first, then winning).
If profit > $100 or loss Options > Expert Advisors > Allow WebRequest).
Test the news filter’s reliability, as it depends on external data.
Adjust Currencies_Check to include only the symbol’s currencies (e.g., “USD” for XAUUSD).


Broker Compatibility:

Verify the broker supports micro lots and allows multiple open orders.
Check spread sensitivity, as gold has higher spreads than forex pairs.


Optimization:

Tune Jarak and Langkah based on the symbol’s volatility (e.g., larger values for XAUUSD).
Adjust TimeStart and TimeEnd to align with active market sessions (e.g., London/New York for gold).
Test MinProfit to balance trade frequency and profitability.

View full details