Rewrite code of the STD (of symbol) in the indicator and EA for the spread formula with the STD of returns instead
Input parameters
Symbol A
Symbol B
Sign of beta (1 for positive value and
-1 for negative value)
Enter positions threshold
Exit positions threshold
Symbol A Lots
Symbol B Lots
Maximum loss in account currency
Maximum profit in account currency
Period for returns
Period of STD
Stoploss A (in pips)
Stoploss B (in pips)
The algorithm
Making a
Robot on JForex which can take positions on several pairs trading at a time or
one robot per pairs trading.
All calculations and trades take place
at bar opening (when the first tick of new bar occurs at any symbol) and only
close prices are used in calculations.
1. Calculate the returns of both symbols:
Return = (P – Pt) / Pt
P – close price of previous bar,
Pt – close price Period for returns bars ago.
2. Calculate standard deviations of “Close” prices for Period
of STD bars for both symbols.
3. Calculate the spread using the following formula:
Spread = Return(Symbol A) / STD(Return(Symbol A)) -
Return(Symbol B) / STD(Return(Symbol B))
4. Trading.
If the beta is positive:
If the spread amount at previous
bar reaches Enter positions threshold (positive), send SELL
market order for Symbol A and BUY market order for Symbol B.
If the spread amount at previous
bar reaches minus Enter positions threshold (negative), send BUY
market order for Symbol A and SELL market order for Symbol B.
If the beta is negative:
If the spread amount at previous
bar reaches Enter positions
threshold (positive), send BUY
market order for Symbol A and BUY market order for Symbol B.
If the spread amount at previous
bar reaches minus Enter
positions threshold (negative),
send SELL market order for Symbol A and SELL market order for Symbol B.
5. The EA should close both positions in one of the following
cases:
- total result of the positions reaches Maximum loss in account currency;
- total result of the positions reaches Maximum profit in account currency;
- the spread value at previous bar decreases
to Exit positions threshold (in absolute value).
6. Open a position for each crossing of a
threshold, even if a position was opened before.
7. The
EA will have to find all open positions, sort them by pairs, check whether a
position in each pair is closed by stop-loss or not, if so - close another
position of the pair...
8. Calculating the profit
or loss for a pairs trading position independently for each position. If the
trading account don't have enough marging, don't take the position, and put a
message on the message box on the trading platform.
類似した注文
I need an MT5 Expert Advisor built as a high-precision volumizer for Forex. Its core purpose is to generate controlled trading volume for rebates, while still maintaining low-risk account growth. I am not looking for aggressive profit chasing. I am looking for a stable, intelligent EA that can produce volume in a disciplined way without damaging the account. The ideal system should trade major currency pairs, avoid
1. IF price forms: - Higher highs + higher lows → TREND = BUY - Lower highs + lower lows → TREND = SELL ELSE → NO TRADE 2. IF: - Trend = BUY - Price retraces to support zone - Bullish engulfing candle forms - TDI green crosses above red (optional) THEN: - Execute BUY 3. IF: - Trend = SELL - Price retraces to resistance - Bearish engulfing forms - TDI confirms THEN: - Execute SELL 4. Risk per trade = 1% of account Lot
I need a high frequency trading robot for gold in one or 5 minute timeframe the robot should have spread filter where it should only open trades below a set spread should have news filter to allow trading during fundal news or not the robot should have input in number of minutes to close all open trades and remove pending orders before fundamental news as part of news filter. It should also have the number of minutes
Hello! I want to programm EA that uses volume profile indicator, but I am not sure if this is possible. Only experienced programmers please, I will not select a programmer who did only few jobs. Before starting I need to make sure you understand everything and that this is for sure technically possible
Hello, I am looking for a professional trading system including: 1- Trading Bot (Expert Advisor): - Good profit performance - High security and strong risk management - Works efficiently during high market volatility (news and strong movements) - Works on all pairs (Forex + Gold) 2- Signal Indicator: - Provides clear Buy and Sell signals - Includes Take Profit and Stop Loss - No repaint (signals must not change or
Hi, I’m looking for a top-tier, profit-optimized EA that has the potential to scale trading returns significantly. My goal is to maximize growth over time. Can you help develop a bespoke EA that could potentially scale to high six or seven figures
max amount grid step for magic number do keep deleting .only when it is in negative floating .but when it is profit allow to go over the max and replays to grid step
Apply with a screen of your work . Symbol Specific Logic . Live Chart Optimization Check the Core logic . [back tests as well] Change points to pips . Create buffer for the zone
I will pay 3000+ USD (negotiable) for an EA for existing MT5 that generates a minimum of 15-20% or higher a month consistently (provide source code after final deal) Looking for a highly profitable EA Please send demo version directly subject (Buying profitable EA Budget up to $ 3000 USD), past results and optimal settings so I can test, if it performs in a strategy tester i will also need option to forward test it