指定
"""
Fast Multi-Pair RSI Trading Bot
Supports:
- BTCUSDT
- XAUUSD
- GBPUSD
Opens fast buy or sell trades based on RSI signals
Closes trades after 5, 10, or 15 minutes
"""
import asyncio
import time
from dataclasses import dataclass, field
from typing import Dict, List, Optional
import pandas as pd
import numpy as np
# ===== RSI calculation ===== #
def compute_rsi(close: pd.Series, period: int = 14) -> pd.Series:
delta = close.diff()
gain = delta.clip(lower=0)
loss = -delta.clip(upper=0)
avg_gain = gain.ewm(alpha=1 / period, adjust=False).mean()
avg_loss = loss.ewm(alpha=1 / period, adjust=False).mean()
rs = avg_gain / avg_loss
return 100 - (100 / (1 + rs))
# ===== Position structure ===== #
@dataclass
class Position:
id: str
symbol: str
side: str
entry_price: float
size: float
opened_at: float
duration_min: int
# ===== Config ===== #
@dataclass
class BotConfig:
symbols: List[str] = field(default_factory=lambda: ["BTCUSDT", "XAUUSD", "GBPUSD"])
rsi_period: int = 14
rsi_oversold: int = 30
rsi_overbought: int = 70
durations_min: List[int] = field(default_factory=lambda: [5, 10, 15])
account_equity: float = 2000.0
risk_pct: float = 0.5
lot_size: Optional[float] = None
paper: bool = True
# ===== Trading Bot ===== #
class MultiPairRSIBot:
def __init__(self, cfg: BotConfig):
self.cfg = cfg
self.data: Dict[str, pd.DataFrame] = {sym: pd.DataFrame() for sym in cfg.symbols}
self.positions: Dict[str, Dict[str, Position]] = {sym: {} for sym in cfg.symbols}
self._id = 0
# ========== Fake 1-minute feed for PAPER mode ========== #
def get_fake_ohlcv(self, symbol):
now = int(time.time()) * 1000
df = self.data[symbol]
last_close = df["close"].iloc[-1] if not df.empty else 1000 + np.random.rand() * 10
change = np.random.normal(0, 0.0008)
close = last_close * (1 + change)
high = max(last_close, close)
low = min(last_close, close)
return (now, last_close, high, low, close, 0)
# ========== Append new candle ========== #
def append_candle(self, symbol, ohlc):
ts, o, h, l, c, v = ohlc
row = {"timestamp": pd.to_datetime(ts, unit="ms"),
"open": o, "high": h, "low": l, "close": c, "volume": v}
self.data[symbol] = pd.concat([self.data[symbol], pd.DataFrame([row])], ignore_index=True)
if len(self.data[symbol]) > 2000:
self.data[symbol] = self.data[symbol].iloc[-2000:]
# ========== Timeframe aggregation ========== #
def to_tf(self, symbol, minutes):
df = self.data[symbol]
if df.empty:
return pd.DataFrame()
df["bucket"] = df["timestamp"].dt.floor(f"{minutes}T")
out = df.groupby("bucket").agg({
"open": "first",
"high": "max",
"low": "min",
"close": "last",
"volume": "sum"
}).reset_index().rename(columns={"bucket": "timestamp"})
return out
# ========== Position sizing ========== #
def get_size(self, price):
if self.cfg.lot_size:
return self.cfg.lot_size
risk_amount = self.cfg.account_equity * (self.cfg.risk_pct / 100)
return round(risk_amount / price, 4)
# ========== Check RSI signals and enter trades ========== #
async def process_signals(self, symbol):
for dur in self.cfg.durations_min:
df = self.to_tf(symbol, dur)
if len(df) < self.cfg.rsi_period + 2:
continue
df["rsi"] = compute_rsi(df["close"], self.cfg.rsi_period)
prev = df["rsi"].iloc[-2]
last = df["rsi"].iloc[-1]
price = df["close"].iloc[-1]
# BUY: RSI cross up
if prev <= self.cfg.rsi_oversold and last > prev:
size = self.get_size(price)
await self.open_position(symbol, "buy", price, size, dur)
# SELL: RSI cross down
if prev >= self.cfg.rsi_overbought and last < prev:
size = self.get_size(price)
await self.open_position(symbol, "sell", price, size, dur)
# ========== Open position ========== #
async def open_position(self, symbol, side, price, size, duration):
self._id += 1
pid = f"{symbol}_{self._id}"
print(f"[{symbol}] OPEN {side.upper()} @ {price:.2f} | {duration}m | size {size}")
pos = Position(
id=pid,
symbol=symbol,
side=side,
entry_price=price,
size=size,
opened_at=time.time(),
duration_min=duration
)
self.positions[symbol][pid] = pos
# ========== Close expired trades ========== #
async def close_expired(self, symbol):
now = time.time()
to_close = []
for pid, pos in self.positions[symbol].items():
if (now - pos.opened_at) / 60 >= pos.duration_min:
to_close.append(pid)
for pid in to_close:
await self.close_position(symbol, pid)
# ========== Close position ========== #
async def close_position(self, symbol, pid):
pos = self.positions[symbol][pid]
last_price = self.data[symbol]["close"].iloc[-1]
pnl = (last_price - pos.entry_price) * pos.size if pos.side == "buy" else (pos.entry_price - last_price) * pos.size
print(f"[{symbol}] CLOSE {pos.side.upper()} @ {last_price:.2f} | PnL = {pnl:.3f}")
self.cfg.account_equity += pnl
del self.positions[symbol][pid]
# ========== Main loop ========== #
async def start(self):
print("Starting multi-pair RSI bot...")
print("Symbols:", self.cfg.symbols)
while True:
try:
for symbol in self.cfg.symbols:
# new candle
ohlcv = self.get_fake_ohlcv(symbol)
self.append_candle(symbol, ohlcv)
# signal scan
await self.process_signals(symbol)
# manage trades
await self.close_expired(symbol)
except Exception as e:
print("Error:", e)
await asyncio.sleep(1)
# ========== Launch Example ========== #
async def main():
cfg = BotConfig(
symbols=["BTCUSDT", "XAUUSD", "GBPUSD"],
account_equity=3000.0,
paper=True,
lot_size=None
)
bot = MultiPairRSIBot(cfg)
task = asyncio.create_task(bot.start())
await asyncio.sleep(60 * 5) # run 5 minutes demo
task.cancel()
if __name__ == "__main__":
asyncio.run(main())
応答済み
1
評価
プロジェクト
1008
47%
仲裁
33
36%
/
36%
期限切れ
99
10%
仕事中
パブリッシュした人: 6 codes
2
評価
プロジェクト
28
7%
仲裁
9
33%
/
33%
期限切れ
1
4%
仕事中
3
評価
プロジェクト
68
43%
仲裁
15
27%
/
60%
期限切れ
1
1%
仕事中
4
評価
プロジェクト
6
0%
仲裁
4
25%
/
75%
期限切れ
2
33%
暇
5
評価
プロジェクト
11
0%
仲裁
8
25%
/
75%
期限切れ
2
18%
暇
6
評価
プロジェクト
35
23%
仲裁
4
0%
/
50%
期限切れ
2
6%
仕事中
7
評価
プロジェクト
2
0%
仲裁
2
0%
/
50%
期限切れ
0
暇
8
評価
プロジェクト
2
0%
仲裁
0
期限切れ
0
暇
9
評価
プロジェクト
22
18%
仲裁
9
33%
/
44%
期限切れ
3
14%
仕事中
パブリッシュした人: 1 code
10
評価
プロジェクト
743
34%
仲裁
49
53%
/
39%
期限切れ
14
2%
取り込み中
11
評価
プロジェクト
32
38%
仲裁
4
50%
/
25%
期限切れ
5
16%
仕事中
12
評価
プロジェクト
3
33%
仲裁
2
0%
/
100%
期限切れ
0
暇
13
評価
プロジェクト
3424
68%
仲裁
78
49%
/
14%
期限切れ
343
10%
暇
パブリッシュした人: 1 code
14
評価
プロジェクト
3
0%
仲裁
0
期限切れ
0
暇
15
評価
プロジェクト
0
0%
仲裁
1
0%
/
100%
期限切れ
0
暇
16
評価
プロジェクト
1
100%
仲裁
0
期限切れ
0
暇
17
評価
プロジェクト
269
29%
仲裁
2
50%
/
0%
期限切れ
3
1%
仕事中
パブリッシュした人: 2 codes
18
評価
プロジェクト
33
27%
仲裁
20
10%
/
50%
期限切れ
11
33%
暇
19
評価
プロジェクト
12
0%
仲裁
3
33%
/
33%
期限切れ
0
暇
20
評価
プロジェクト
478
40%
仲裁
105
40%
/
24%
期限切れ
82
17%
取り込み中
パブリッシュした人: 2 codes
21
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
22
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
23
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
類似した注文
Titolo: Cerco sviluppatore per EA su XAUUSD M1 per conto reale Cerco uno sviluppatore MQL5 per creare un Expert Advisor per MetaTrader 5 su XAUUSD M1, da utilizzare su conto reale con deposito iniziale di 100–200 €. La strategia prevede un Buy Stop a 1,00 sopra l’Ask e un Sell Stop a 1,00 sotto il Bid, entrambi con stop loss iniziale di 1,00 e senza take profit fisso. I pendenti devono restare fermi: quando uno viene
Master Scalping EA
30+ USD
// Meta Scalper EA - RSI + Breakout + Lot Management #property strict #include <Trade\Trade.mqh> CTrade trade; input int RSI_Period=14; input double RSI_Overbought=70; input double RSI_Oversold=30; input int Breakout_Period=20; input int ATR_Period=14; input double ATR_Multiplier_SL=1.5; input double ATR_Multiplier_TP=3.0; input bool UseRiskPercent=true; input double RiskPercent=2.0; input double FixedLot=0.1; input
BUDGET: 100-120 USD - FIXED - includes source code .mq5 + .ex5 I will test demo first on 100$ demo account. If good, I pay. WHAT I WANT: 1. SIGNAL STRENGTH LOGIC: - WEAK SIGNAL = 1 position only. - STRONG SIGNAL = 2,3,4,5 positions (more positions because signal is strong). - Signal strength calculated by indicators. 2. ADAPTIVE TO CAPITAL: - Lot auto = Balance / 100 * 0.01. Example 100$ = 0.01 lot, 300$ = 0.03 lot
Project: MT5 Expert Advisor — Dual-Sided Hedging Grid with Fibonacci Lot Progression I need a custom Expert Advisor (EA) developed in MQL5 for MetaTrader 5. 1. Trading Strategy The EA must open both Buy and Sell market positions when a new trading cycle starts, provided the broker account supports hedging. The EA must manage the Buy and Sell directions independently. When the market moves downward against the Buy
I currently use nt8 trading platform. I trade with kelterband channel indicator and 80sma. Would like a custom indicator added to chart trader to get into trade manually when band crosses sma, 3 separate buttons for buy sell close of yellow band, mid band (blue) and 80 sma (purple). also need contract size button and tick offset button. when i enter a trade i want it to trail the band until price hits it and gets me
News trading made simple
30+ USD
Hello lovies, I’m reaching out because I’m working on a specialized macroeconomic intelligence service focused on major economic releases and their potential impact on gold (XAUUSD), the US dollar, and the wider financial markets. My approach goes beyond simply following the economic calendar. I focus on understanding the information behind upcoming events, market expectations, and the potential implications for
Platform: MT5 only (no MT4 needed). Deliverable: an MT5 Expert Advisor with full source code (.mq5) that replicates the attached TradingView strategy (Pine Script v6, based on LuxAlgo's "ICT Killzones Toolkit" order blocks) as exactly as possible. Pasting the code into TradingView shows how it operates. I normally trade GBPUSD on the 5-minute chart Expected behavior: - Order block detection must match the Pine code
Requirements Specification: Debug & Error Fixing: Review the entire source code of the MQL expert advisor. Identify and fix all logical errors, bugs, and performance issues that cause trades to close prematurely or yield extremely low profits. Strategy Restructuring & Optimization: Fully analyze and optimize the current entry and exit strategy for USDJPY and GBPUSD. Modify, upgrade, or completely rewrite the entry
Independent MQL5 Code Audit for an Existing MT5 EA
100 - 200 USD
I am looking for an MQL5 developer to independently review an existing EA’s execution and position management logic. The review should focus on duplicate orders, trade isolation by symbol and magic number, broker price and volume constraints, error handling, and recovery after a terminal restart. This order is for an audit report. Please do not modify the source or change the trading strategy. For each finding
I have an existing compiled MetaTrader 5 Expert Advisor (EX5) designed for automated XAUUSD scalping. I want an experienced developer to assess and implement a solution to execute the EA’s original trading strategy through my broker’s FIX API. Requirements: Confirm the technical feasibility of connecting an existing MT5 EA to a broker FIX API. Explain how to obtain FIX API access and credentials from the broker
プロジェクト情報
予算
50+ USD