النتائج 1 إلى 4 من 4
الموضوع: From mql4 to mql5 subroutines
- 16-09-2017, 01:32 AM #1
From mql4 to mql5 subroutines
============
لاحقا
https://www.mql5.com/en/articles/81آخر تعديل بواسطة فيلسوف البادية ، 16-09-2017 الساعة 02:01 AM
- 16-09-2017, 04:44 AM #2
ماهو بديل iLow في MQ5 ؟؟
ج:
كود PHP:double Low[];
int count; // number of elements to copy
ArraySetAsSeries(Low,true);
CopyLow(_Symbol,_Period,0,count,Low);
نريد ان يبقى الوضع في MQ5 كأنك في MQ4
ببساطة نسوي subroutine خاص بمعطيات وفق ماتعونا عليها في MQ4 وتكون تحت INCLUDE
سنسميه Time_Series.mqh
الخديعة هنا ان اسم الدالة سيكون iLow وهي في mq5 دالة مستخدم بينما في mq4 دالة اساسية موجودة اساسا-built-inآخر تعديل بواسطة فيلسوف البادية ، 16-09-2017 الساعة 04:47 AM
- 16-09-2017, 05:07 AM #3كود PHP:
#define OP_BUY 0 //Buy
#define OP_SELL 1 //Sell
#define OP_BUYLIMIT 2 //Pending order of BUY LIMIT type
#define OP_SELLLIMIT 3 //Pending order of SELL LIMIT type
#define OP_BUYSTOP 4 //Pending order of BUY STOP type
#define OP_SELLSTOP 5 //Pending order of SELL STOP type
//---
#define MODE_OPEN 0
#define MODE_CLOSE 3
#define MODE_VOLUME 4
#define MODE_REAL_VOLUME 5
#define MODE_TRADES 0
#define MODE_HISTORY 1
#define SELECT_BY_POS 0
#define SELECT_BY_TICKET 1
//---
#define DOUBLE_VALUE 0
#define FLOAT_VALUE 1
#define LONG_VALUE INT_VALUE
//---
#define CHART_BAR 0
#define CHART_CANDLE 1
//---
#define MODE_ASCEND 0
#define MODE_DESCEND 1
//---
#define MODE_LOW 1
#define MODE_HIGH 2
#define MODE_TIME 5
#define MODE_BID 9
#define MODE_ASK 10
#define MODE_POINT 11
#define MODE_DIGITS 12
#define MODE_SPREAD 13
#define MODE_STOPLEVEL 14
#define MODE_LOTSIZE 15
#define MODE_TICKVALUE 16
#define MODE_TICKSIZE 17
#define MODE_SWAPLONG 18
#define MODE_SWAPSHORT 19
#define MODE_STARTING 20
#define MODE_EXPIRATION 21
#define MODE_TRADEALLOWED 22
#define MODE_MINLOT 23
#define MODE_LOTSTEP 24
#define MODE_MAXLOT 25
#define MODE_SWAPTYPE 26
#define MODE_PROFITCALCMODE 27
#define MODE_MARGINCALCMODE 28
#define MODE_MARGININIT 29
#define MODE_MARGINMAINTENANCE 30
#define MODE_MARGINHEDGED 31
#define MODE_MARGINREQUIRED 32
#define MODE_FREEZELEVEL 33
//---
#define EMPTY -1
int iBarsMQL4(string symbol,int tf)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
return(Bars(symbol,timeframe));
}
int iBarShiftMQL4(string symbol,
int tf,
datetime time,
bool exact=false)
{
if(time<0) return(-1);
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
datetime Arr[],time1;
CopyTime(symbol,timeframe,0,1,Arr);
time1=Arr[0];
if(CopyTime(symbol,timeframe,time,time1,Arr)>0)
{
if(ArraySize(Arr)>2) return(ArraySize(Arr)-1);
if(time<time1) return(1);
else return(0);
}
else return(-1);
}
double iCloseMQL4(string symbol,int tf,int index)
{
if(index < 0) return(-1);
double Arr[];
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
if(CopyClose(symbol,timeframe, index, 1, Arr)>0)
return(Arr[0]);
else return(-1);
}
double iHighMQL4(string symbol,int tf,int index)
{
if(index < 0) return(-1);
double Arr[];
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
if(CopyHigh(symbol,timeframe, index, 1, Arr)>0)
return(Arr[0]);
else return(-1);
}
int iHighestMQL4(string symbol,
int tf,
int type,
int count=WHOLE_ARRAY,
int start=0)
{
if(start<0) return(-1);
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
if(count<=0) count=Bars(symbol,timeframe);
if(type<=MODE_OPEN)
{
double Open[];
ArraySetAsSeries(Open,true);
CopyOpen(symbol,timeframe,start,count,Open);
return(ArrayMaximum(Open,0,count)+start);
}
if(type==MODE_LOW)
{
double Low[];
ArraySetAsSeries(Low,true);
CopyLow(symbol,timeframe,start,count,Low);
return(ArrayMaximum(Low,0,count)+start);
}
if(type==MODE_HIGH)
{
double High[];
ArraySetAsSeries(High,true);
CopyHigh(symbol,timeframe,start,count,High);
return(ArrayMaximum(High,0,count)+start);
}
if(type==MODE_CLOSE)
{
double Close[];
ArraySetAsSeries(Close,true);
CopyClose(symbol,timeframe,start,count,Close);
return(ArrayMaximum(Close,0,count)+start);
}
if(type==MODE_VOLUME)
{
long Volume[];
ArraySetAsSeries(Volume,true);
CopyTickVolume(symbol,timeframe,start,count,Volume);
return(ArrayMaximum(Volume,0,count)+start);
}
if(type>=MODE_TIME)
{
datetime Time[];
ArraySetAsSeries(Time,true);
CopyTime(symbol,timeframe,start,count,Time);
return(ArrayMaximum(Time,0,count)+start);
//---
}
return(0);
}
double iLowMQL4(string symbol,int tf,int index)
{
if(index < 0) return(-1);
double Arr[];
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
if(CopyLow(symbol,timeframe, index, 1, Arr)>0)
return(Arr[0]);
else return(-1);
}
int iLowestMQL4(string symbol,
int tf,
int type,
int count=WHOLE_ARRAY,
int start=0)
{
if(start<0) return(-1);
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
if(count<=0) count=Bars(symbol,timeframe);
if(type<=MODE_OPEN)
{
double Open[];
ArraySetAsSeries(Open,true);
CopyOpen(symbol,timeframe,start,count,Open);
return(ArrayMinimum(Open,0,count)+start);
}
if(type==MODE_LOW)
{
double Low[];
ArraySetAsSeries(Low,true);
CopyLow(symbol,timeframe,start,count,Low);
return(ArrayMinimum(Low,0,count)+start);
}
if(type==MODE_HIGH)
{
double High[];
ArraySetAsSeries(High,true);
CopyHigh(symbol,timeframe,start,count,High);
return(ArrayMinimum(High,0,count)+start);
}
if(type==MODE_CLOSE)
{
double Close[];
ArraySetAsSeries(Close,true);
CopyClose(symbol,timeframe,start,count,Close);
return(ArrayMinimum(Close,0,count)+start);
}
if(type==MODE_VOLUME)
{
long Volume[];
ArraySetAsSeries(Volume,true);
CopyTickVolume(symbol,timeframe,start,count,Volume);
return(ArrayMinimum(Volume,0,count)+start);
}
if(type>=MODE_TIME)
{
datetime Time[];
ArraySetAsSeries(Time,true);
CopyTime(symbol,timeframe,start,count,Time);
return(ArrayMinimum(Time,0,count)+start);
}
//---
return(0);
}
double iOpenMQL4(string symbol,int tf,int index)
{
if(index < 0) return(-1);
double Arr[];
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
if(CopyOpen(symbol,timeframe, index, 1, Arr)>0)
return(Arr[0]);
else return(-1);
}
datetime iTimeMQL4(string symbol,int tf,int index)
{
if(index < 0) return(-1);
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
datetime Arr[];
if(CopyTime(symbol, timeframe, index, 1, Arr)>0)
return(Arr[0]);
else return(-1);
}
long iVolumeMQL4(string symbol,int tf,int index)
{
if(index < 0) return(-1);
long Arr[];
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
if(CopyTickVolume(symbol, timeframe, index, 1, Arr)>0)
return(Arr[0]);
else return(-1);
}
ENUM_TIMEFRAMES TFMigrate(int tf)
{
switch(tf)
{
case 0: return(PERIOD_CURRENT);
case 1: return(PERIOD_M1);
case 5: return(PERIOD_M5);
case 15: return(PERIOD_M15);
case 30: return(PERIOD_M30);
case 60: return(PERIOD_H1);
case 240: return(PERIOD_H4);
case 1440: return(PERIOD_D1);
case 10080: return(PERIOD_W1);
case 43200: return(PERIOD_MN1);
default: return(PERIOD_CURRENT);
}
}
- 17-09-2017, 04:31 PM #4
مراقبة العديد من الأطر الزمنية في نافذة واحدة
http://tol64.blogspot.com/2013/03/ne...dnom-okne.html