Hans123_Trader
Download scriptThis script is an automated trading expert designed for the MetaTrader 5 platform. It functions as a systematic trading tool that manages trade entries, exits, and risk management based on predefined price levels and time constraints.
Core Trading Logic
1. Entry Strategy: Breakout Detection The script operates by identifying historical extremes within a specific timeframe. Instead of entering trades immediately, it looks for the highest high and the lowest low over the last 80 bars (candles) on your current chart.
- Buy Orders: If the price moves above a certain threshold relative to the "highest high," the script places a Buy Stop order. This means the trade will only trigger if the market continues to move upward, confirming a bullish breakout.
- Sell Orders: Conversely, if the price drops below a certain level relative to the "lowest low," it places a Sell Stop order. This targets bearish breakouts where the market momentum is moving downward.
2. Time and Environment Constraints The script does not trade constantly. It includes specific filters to ensure operations only occur during your preferred windows:
- Trading Hours: You can define specific start and end hours (e.g., a morning or afternoon session). The bot will remain inactive outside of these periods.
- Volume Validation: Before placing a trade, the script automatically checks if your requested lot size is valid for that specific currency pair (ensuring it isn't too small or too large for the broker's rules).
3. Dynamic Risk Management The tool includes several automated "safety nets" to protect your capital:
- Stop Loss & Take Profit: Every trade initiated by the script is automatically assigned a fixed target for profit and a maximum limit for loss, based on your input settings (measured in pips).
- Trailing Stop: This is a dynamic protection feature. Once a trade moves into a profitable state, the script can "drag" your stop loss along with the price. If the market moves in your favor by a certain amount, the stop loss follows it; if the market reverses, the trade closes to lock in those gains.
- Order Cleanup: To keep your trading environment organized, the script includes a function to automatically delete any pending orders that were not triggered, ensuring you don't have "ghost" orders hanging in the market.
4. Technical Adjustments To ensure accuracy across different brokers, the script automatically detects if you are trading on a 3-digit or 5-digit price feed (common with JPY pairs or standard Forex pairs). It adjusts its internal math to ensure that your "pips" settings translate correctly to the actual price movements of those specific markets.
ÿþ/ / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
/ / | H a n s 1 2 3 _ T r a d e r ( b a r a b a s h k a k v n '