السلام عليكم ورحمة الله وبركاته
شكرا لك الستاذ سامي العوامي على دروس البرمجة
أنا قمت بتنفيذ الاكسبيرت في الحلقة التاسعة وكان في ملاحظتين من البرنامج، حاولت شغل الاكسبيرت الا انه لم يعمل ولا أعرف السبب.
//+------------------------------------------------------------------+
//| MA_crose_EA.mq4 |
//| Copyright 2016, MetaQuotes Software Corp. |
//|
https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
extern string s1 ="fast MA sittings";
extern int Fperiod = 10;
extern int Fshift = 0;
extern int Fmethod = 0;
extern int Fapplied = 0;
extern string s2="slow MA sittings";
extern int Speriod = 20;
extern int Sshift = 0;
extern int Smethod = 0;
extern int Sapplied = 0;
extern string s3="EA manegmend";
extern int TakeProfit=50;
extern int StopLoss=30;
extern double lot=0.01;
extern int magic=12345;
double t;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
double ticksize = MarketInfo(Symbol(),MODE_TICKSIZE);
if (ticksize== 0.00001 ||0.001)
t=ticksize*10;
else
t=ticksize;
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//--- destroy timer
EventKillTimer();
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
double Fmalast = iMA(NULL,0,Fperiod,Fshift,Fmethod,Fapplied,2);
double Fmanow = iMA(NULL,0,Fperiod,Fshift,Fmethod,Fapplied,1);
double Smalast = iMA(NULL,0,Speriod,Sshift,Smethod,Sapplied,2);
double Smanow = iMA(NULL,0,Speriod,Sshift,Smethod,Sapplied,1);
if (Fmalast<Smalast && Fmanow>Smanow)
if (OrdersTotal()==0)
OrderSend(Symbol(),OP_BUY,lot,Ask,3,Ask-(StopLoss*t),Ask+(TakeProfit*t),NULL,magic,0,Blue) ;
if (Fmalast>Smalast && Fmanow<Smanow)
if (OrdersTotal()==0)
OrderSend(Symbol(),OP_SELL,lot,Bid,3,Bid+(StopLoss *t),Bid-(TakeProfit*t),NULL,magic,0,Red);
}
//+------------------------------------------------------------------+
//| Timer function |
//+------------------------------------------------------------------+
void OnTimer()
{
//---
}
//+------------------------------------------------------------------+
//| ChartEvent function |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
const long &lparam,
const double &dparam,
const string &sparam)
{
//---
}
//+------------------------------------------------------------------+