Standard deviation of returns on EA and indicator made

MQL4 Indicatori Esperti

Lavoro terminato

Tempo di esecuzione 1 giorno

Specifiche

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.

 

Con risposta

1
Sviluppatore 1
Valutazioni
(187)
Progetti
367
56%
Arbitraggio
45
22% / 56%
In ritardo
188
51%
Gratuito
Pubblicati: 1 articolo, 6 codici
2
Sviluppatore 2
Valutazioni
(128)
Progetti
206
49%
Arbitraggio
29
28% / 48%
In ritardo
33
16%
Gratuito
Pubblicati: 1 codice
3
Sviluppatore 3
Valutazioni
(34)
Progetti
80
34%
Arbitraggio
13
31% / 54%
In ritardo
19
24%
Gratuito
4
Sviluppatore 4
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
5
Sviluppatore 5
Valutazioni
Progetti
0
0%
Arbitraggio
2
0% / 100%
In ritardo
0
Gratuito
Ordini simili
Looking for a Proven Non-Repainting Gold Indicator (XAUUSD) – High Accuracy & Ready-Made Solutions Only 📌 Project Description: I am looking for a high-quality, non-repainting indicator specifically for XAUUSD (Gold) that is already developed and tested. ⚠️ Important: I am NOT looking for a new indicator to be built from scratch. I want an existing, proven system that you have already created and are confident in. 🎯
The Advisor should stop trading if the spread exceeds a selected value. Source code is unavailable. Decompilation may be necessary or any other suggested working solution may be acceptable. Testing should be thorough with proven demonstrable results
Convert Time Range Breakout Indicator to Strategy (Pine Script) I have an existing Time Range Breakout indicator on TradingView. I need a developer to convert it into a fully functional strategy with proper trade execution logic. Strategy Logic: Time Range: Define a specific time range (e.g., 03:00 – 04:30) During this time, the indicator marks the High and Low range Entry Conditions Buy when price touches the range
Hello, I’m looking for an experienced MQL4 developer to build a custom MT4 Expert Advisor based on a Koncorde-style indicator strategy. Here are the main requirements: 🔹 General Overview The EA must be a master EA , running on a single chart and managing multiple currency pairs simultaneously No need to attach EA to each chart Must support a configurable list of symbols 🔹 Indicator Requirement Develop a custom
I want to find a Developer to perform this work and settle payments in this Application. I undertake not to communicate with Applicants anywhere else except this Application, including third-party
Hi guys I’m looking for a coder who’s experienced in one script. The candidate must be familiar with fractals and self similarity. If you can’t code self similarity, please don’t bother contacting me ( respectfully). I just don’t want us to waste each others time. My budget is 100$. If that’s too low for you please, don’t contact me. Only contact me if you can code self similarity and can accept 100$. I will provide
I hope to acquire a profitable and existing expert advisor (EA) from the gold market, with complete source code, to add to our client portfolio. you can WECHAT: Faca7898 Please note EA when adding friends. It should be clarified that this does not require you to formulate or design new strategies. If you already have a verified, consistent, and production-ready EA, I am willing to purchase it immediately and engage
Core Requirements: Platform: MetaTrader 5 (MT5). Symbol: XAUUSD (Gold). Timeframes: M1 and M5 (user selectable). Trading Style: Scalping with controlled risk (not aggressive or high-risk strategies) -> adjustable, even better. Execution: Fast execution, optimized for gold market conditions. Frequence = adjustable, but there should be 10-20 trades per day. Strategy Logic: Use a reliable and conservative strategy
Eu preciso disso. A linha central do TMA (17,5,1.5) será a principal referência. Outra linha de média móvel (AVG) de 3 períodos decrescentes 2. As ordens serão as seguintes: abaixo, somente compra de TMA; acima, somente venda de TMA. O sinal de entrada será o seguinte: se o preço estiver acima da Média Móvel Tarifária (TMA), será apenas para venda; quando o preço se mantiver abaixo da Média Móvel Tarifária (AVG)
I am looking for non-repainting indicator to run in all sessions for scalping gold , happy to discuss if you have developed such indicators which can show profit and stop loss levels

Informazioni sul progetto

Budget
10 USD
Scadenze
da 1 a 2 giorno(i)