Web Trader
MetaEditor
MQL5 / Python
Compile
Deployments Monitor
GridBot.py
CustomRSI.py
RiskManager.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
""" Tech2broker WebTrader Expert Advisor: GridBot Multi-level automated grid execution with dynamic trailing stop and spread protection. """ from trading import ExpertAdvisor, OrderType, Symbol, Position class GridBot(ExpertAdvisor): def __init__(self): super().__init__() self.symbol = "EURUSD" self.timeframe = "M15" self.grid_levels = 5 self.grid_step_pips = 15.0 self.lot_size = 0.10 self.take_profit_pips = 20.0 self.stop_loss_pips = 50.0 self.max_spread = 15 def on_init(self): self.log(f"GridBot initialized on {self.symbol} {self.timeframe}") self.set_timer(seconds=60) def on_tick(self): quote = self.get_quote(self.symbol) if quote.spread > self.max_spread: return # Protect against news spread spike positions = self.get_positions(self.symbol) if len(positions) == 0: self.open_base_position(quote) def open_base_position(self, quote): self.buy( symbol=self.symbol, volume=self.lot_size, sl=quote.bid - (self.stop_loss_pips * 0.0001), tp=quote.ask + (self.take_profit_pips * 0.0001) ) self.log("Base grid position opened successfully.")
Compilation Output
Clear Output
[9:45:42 AM] Tech2broker MetaEditor ready. Compiler: Python 3.11 / MQL5 Hybrid.
[9:45:42 AM] Ready to compile Expert Advisors and Indicators.