Need to convert mt4 script to mt5 for no demand no suuply

MQL5 脚本 积分

工作已完成

执行时间2 分钟
客户反馈
very understanding and very fast
员工反馈
Great customer! thanks for your order!

指定

            //+------------------------------------------------------------------+
//|                                                  NSNDHistory.mq4 |
//|                      Copyright © 2011, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
extern int barcount=500;
extern int NSNDcount=10;
string comment[10];
static int prevtime=0;
static int prevfirstbar=0;
static double prevpricemax=0;
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------0-----------------------------+
int init()
  {
//---- indicators
f_clear();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   f_clear();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {

   int    counted_bars=IndicatorCounted();
   string Bull_or_Bear,obj_nameND;
   bool Low_Volume,Pins,Bear_Close_Below,Bull_Close_Above,Bear_Close_Above,Bull_Close_Below;
   string label;
   double chartheight=WindowPriceMax()-WindowPriceMin();
   double addhigh=6.00/100.00*chartheight;
//   Comment(WindowFirstVisibleBar(),"  ",prevfirstbar);
//----
  if(WindowFirstVisibleBar()!=prevfirstbar)
  {
   prevtime=0;
  }
  if(WindowPriceMax()!=prevpricemax)
  {
   prevtime=0;
  }
 
//  if(Time[0]!=prevtime) // | prevfirstbar!=WindowFirstVisibleBar())// && 11==2)
  {
   f_clear();
  //for(int i=barcount;i>=1;i--)
   for(int i=WindowFirstVisibleBar();i>=WindowFirstVisibleBar()-500 && i>=0 ;i--)
   {
    Bull_or_Bear=f_Bull_or_Bear(i);
    Low_Volume=f_Low_Volume(i);
    Pins=f_Pins(i,Bull_or_Bear);
  //  Comment(Bull_or_Bear," Low Volume ",Low_Volume,"  Pins ",Pins );
         Bear_Close_Below=false;
       Bear_Close_Above=false;
       Bull_Close_Above=false;
       Bull_Close_Below=false;
    for(int ix=i;ix>i-NSNDcount && ix>=0;ix--)
    {
       if(Bull_or_Bear=="Bear" && Close[ix]<Low[i] && !Bear_Close_Above)
       {
         Bear_Close_Below=true;
       }
       if(Bull_or_Bear=="Bear" && Close[ix]>High[i] && !Bear_Close_Below)
       {
         Bear_Close_Above=true;
       }
       if(Bull_or_Bear=="Bull" && Close[ix]>High[i] && !Bear_Close_Below)
       {
         Bull_Close_Above=true;
        }
       if(Bull_or_Bear=="Bull" && Close[ix]<Low[i] && !Bear_Close_Above)
       {
         Bull_Close_Below=true;
       }
    }//end for ix  
    label=TimeYear(Time[i])+DoubleToStr(TimeMonth(Time[i]),0)+DoubleToStr(TimeDay(Time[i]),0);
    label=label+DoubleToStr(TimeHour(Time[i]),0)+DoubleToStr(TimeMinute(Time[i]),0);  
    obj_nameND="No Demand - "+i+" - "+label;   ObjectDelete(obj_nameND);
    if(Bull_or_Bear=="Bull" && Low_Volume && Pins && !Bull_Close_Above && Bull_Close_Below)
    {
      ObjectCreate(obj_nameND,OBJ_TEXT,0,Time[i],High[i]+(addhigh));//+spread+0.0005);
      ObjectSetText(obj_nameND,"v",18,"Arial",Red);
      ObjectSet(obj_nameND,OBJPROP_PRICE1,High[i]+(addhigh));
      ObjectSet(obj_nameND,OBJPROP_TIME1,Time[i]);
      if(High[i]-Close[i]>Open[i]-Low[i])
      {
        ObjectSetText(obj_nameND,"v",18,"Arial",Red);
     }
    }
    obj_nameND="No Supply - "+i+" - "+label;   ObjectDelete(obj_nameND);
    if(Bull_or_Bear=="Bear" && Low_Volume && Pins && !Bear_Close_Below  && Bear_Close_Above)
    {
       string obj_nameNS="No Supply - "+i+" - "+label;
       ObjectCreate(obj_nameNS,OBJ_TEXT,0,Time[i],Low[i]);//-spread-0.0005);
       ObjectSetText(obj_nameNS,"^",22,"Arial",Lime);
       ObjectSet(obj_nameNS,OBJPROP_PRICE1,Low[i]);
       ObjectSet(obj_nameNS,OBJPROP_TIME1,Time[i]);
       if(High[i]-Open[i]<Close[i]-Low[i])
       {
       ObjectSetText(obj_nameNS,"^",18,"Arial",Lime);
       }
    }
    
   }//end for i 
   prevtime=Time[0];
   prevfirstbar=WindowFirstVisibleBar();
   prevpricemax=WindowPriceMax();
   }//endif if prevtime
//---- 

   return(0);
  }
  
string f_Bull_or_Bear(int i)
{
 string retvar;
    if(Open[i]>Close[i])
   {
       retvar="Bear";
       comment[i]=comment[i]+"Bear ";
   }
   if(Close[i]>Open[i])
   {
    retvar="Bull";
    comment[i]=comment[i]+"Bull ";
   }
 return(retvar);
}

bool f_Low_Volume(int i)
{
  bool retvar=False;
     if(Volume[i]<Volume[i+1] && Volume[i]<Volume[i+2])
     {
       retvar=True;
       comment[i]=comment[i]+"Low Vol ";
    }
 return(retvar);
}

bool f_Pins(int i,string Bull_or_Bear)
{
  bool Pins=false;
  double pip=Point*1;
  bool retval;
  if(Bull_or_Bear=="Bear" && High[i]>Open[i]+pip && Low[i]<Close[i]-pip)
  {
    retval=true;
    comment[i]=comment[i]+" Pins";
  }
  if(Bull_or_Bear=="Bull" && High[i]>Close[i]+pip && Low[i]<Open[i]-pip)
  {
    retval=true;
    comment[i]=comment[i]+" Pins";
  }
  return(retval);
}

void f_clear()
{
  for (int i=ObjectsTotal(); i>0; i--)
  
 {
   if(StringSubstr(ObjectName(i),0,2)=="No")
   {
    ObjectDelete(ObjectName(i));
   }
 }
   for (i=ObjectsTotal(); i>0; i--)
  
 {
   if(StringSubstr(ObjectName(i),0,2)=="No")
   {
    ObjectDelete(ObjectName(i));
   }
 }
}
//+------------------------------------------------------------------+

反馈

1
开发者 1
等级
(68)
项目
124
40%
仲裁
17
47% / 53%
逾期
31
25%
已载入
2
开发者 2
等级
(19)
项目
22
23%
仲裁
5
40% / 60%
逾期
2
9%
工作中
3
开发者 3
等级
(428)
项目
624
54%
仲裁
30
53% / 23%
逾期
6
1%
繁忙
4
开发者 4
等级
(85)
项目
166
43%
仲裁
3
67% / 0%
逾期
5
3%
工作中
发布者: 1 代码
5
开发者 5
等级
(152)
项目
228
80%
仲裁
22
27% / 50%
逾期
11
5%
空闲
发布者: 24 文章, 1882 代码
6
开发者 6
等级
(542)
项目
624
33%
仲裁
39
36% / 49%
逾期
11
2%
繁忙
7
开发者 7
等级
(31)
项目
35
46%
仲裁
0
逾期
0
空闲
发布者: 3 代码
8
开发者 8
等级
项目
1
0%
仲裁
1
0% / 100%
逾期
0
空闲
9
开发者 9
等级
(265)
项目
596
35%
仲裁
64
20% / 58%
逾期
147
25%
工作中
发布者: 1 文章, 22 代码
10
开发者 10
等级
(43)
项目
66
12%
仲裁
12
58% / 42%
逾期
1
2%
空闲
11
开发者 11
等级
(4)
项目
2
0%
仲裁
5
0% / 80%
逾期
1
50%
空闲
12
开发者 12
等级
(102)
项目
105
60%
仲裁
0
逾期
0
空闲
13
开发者 13
等级
(33)
项目
35
20%
仲裁
5
40% / 40%
逾期
0
空闲
发布者: 1 代码
14
开发者 14
等级
(3)
项目
6
17%
仲裁
0
逾期
3
50%
空闲
15
开发者 15
等级
(15)
项目
18
6%
仲裁
8
38% / 38%
逾期
2
11%
已载入
16
开发者 16
等级
(206)
项目
333
35%
仲裁
66
12% / 58%
逾期
87
26%
空闲
17
开发者 17
等级
(449)
项目
476
69%
仲裁
6
67% / 0%
逾期
2
0%
工作中
18
开发者 18
等级
(302)
项目
308
69%
仲裁
2
100% / 0%
逾期
0
空闲
发布者: 1 代码
19
开发者 19
等级
(568)
项目
642
40%
仲裁
2
100% / 0%
逾期
1
0%
空闲
发布者: 9 代码
20
开发者 20
等级
(295)
项目
471
39%
仲裁
102
40% / 24%
逾期
78
17%
繁忙
发布者: 2 代码
21
开发者 21
等级
项目
0
0%
仲裁
0
逾期
0
空闲

项目信息

预算
30+ USD
截止日期
 1  2 天