指定
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);
}
}
//+-------------------------------------------------
反馈
1
等级
项目
1451
45%
仲裁
49
73%
/
12%
逾期
36
2%
空闲
2
等级
项目
6
33%
仲裁
0
逾期
0
工作中
3
等级
项目
166
33%
仲裁
12
25%
/
33%
逾期
0
工作中
4
等级
项目
558
33%
仲裁
24
67%
/
8%
逾期
16
3%
空闲
项目信息
预算
30 - 35 USD
VAT (19%):
5.7
- 6.65
USD
总计:
36
- 41.65
USD
开发人员
27
- 31.5
USD
截止日期
到 5 天
客户
所下订单2
仲裁计数0