Spécifications
mql4
//+------------------------------------------------------------------+
//| MA_Cross.mq4|
//| Copyright 2024, MetaQuotes Software Corp. |
//+------------------------------------------------------------------+
input int fastMA = 12; // Periode des schnellen MA
input int slowMA = 25; // Periode des langsamen MA
input double lotSize = 0.01; // Lotgröße
double fastMAValue, slowMAValue;
bool positionOpen = false;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
fastMAValue = iMA(NULL, 0, fastMA, 0, MODE_SMA, PRICE_CLOSE, 0);
slowMAValue = iMA(NULL, 0, slowMA, 0, MODE_SMA, PRICE_CLOSE, 0);
double fastMAValuePrev = iMA(NULL, 0, fastMA, 0, MODE_SMA, PRICE_CLOSE, 1);
double slowMAValuePrev = iMA(NULL, 0, slowMA, 0, MODE_SMA, PRICE_CLOSE, 1);
// Überprüfen, ob eine Position geöffnet ist
if (PositionSelect(Symbol()))
positionOpen = true;
else
positionOpen = false;
// Long-Position eröffnen
if (fastMAValue > slowMAValue && fastMAValuePrev <= slowMAValuePrev && !positionOpen)
{
OrderSend(Symbol(), OP_BUY, lotSize, Ask, 2, 0, 0, "MA Cross Long", 0, 0, clrGreen);
}
// Short-Position eröffnen
if (fastMAValue < slowMAValue && fastMAValuePrev >= slowMAValuePrev && !positionOpen)
{
OrderSend(Symbol(), OP_SELL, lotSize, Bid, 2, 0, 0, "MA Cross Short", 0, 0, clrRed);
}
}
//+-------------------------------------------------
Répondu
1
Évaluation
Projets
1451
45%
Arbitrage
49
73%
/
12%
En retard
36
2%
Gratuit
2
Évaluation
Projets
6
33%
Arbitrage
0
En retard
0
Travail
3
Évaluation
Projets
166
33%
Arbitrage
12
25%
/
33%
En retard
0
Travail
4
Évaluation
Projets
558
33%
Arbitrage
24
67%
/
8%
En retard
16
3%
Gratuit
Informations sur le projet
Budget
30 - 35 USD
TVA (19%):
5.7
- 6.65
USD
Total:
36
- 41.65
USD
Pour le développeur
27
- 31.5
USD
Délais
à 5 jour(s)
Client
Commandes passées2
Nombre d'arbitrages0