HELP !!!! convert an indicator from MT4 to MT5. - page 4

 
George Merts:

Yes, imagine, what you are proposing costs a certain amount of effort, and therefore money.

Everyone understands Russian perfectly well, but very few people are interested in doing this "for a thank you".

But if you had a successful experience in trading, in which you would need an indicator, maybe someone would agree to do something without money in exchange for a profitable trading idea. In the meantime - purely for the sake of "good name" - I'm afraid there won't be many people willing to do it...

My personal experience has nothing to do with it.

So the legendary Ishimoku is not familiar to you? Hasn't it proven itself over many years?

It's not a question of a trading robot that will or won't lose a deposit.

It's a traditional Ishimoku with an alert screwed on. The decision is up to the trader.

That's how you got the misunderstanding of the Russian language - you haven't even read my post.

I even added theIchimokuAlert_v3.mq4 indicator for mt4 and wrote that I use it.

Here is the code for mt4 indicatorIchimokuAlert_v3.mq4 for those who can not download

//+------------------------------------------------------------------+
//|                                             IchimokuAlert_v2.mq4 |
//|                                  Copyright © 2006, Forex-TSD.com |
//|                         Written by IgorAD,igorad2003@yahoo.co.uk |
//|                           Adapted and improved by Snowski © 2009 |  
//+------------------------------------------------------------------+

#property copyright "Copyright © 2006, Forex-TSD.com "
#property link      "http://www.forex-tsd.com/"

#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 SandyBrown
#property indicator_color4 Thistle
#property indicator_color5 Lime
#property indicator_color6 SandyBrown
#property indicator_color7 Thistle

//---- input parameters
extern int Tenkan             = 9;
extern int Kijun              = 26;
extern int Senkou             = 52;
extern bool UseAlerts         = true;
extern bool MsgAlerts         = true;
extern bool SoundAlerts       = true;
extern bool eMailAlerts       = false;
extern int AlertType          = 1;
extern string Alert_Setting   = "--- Alert Type:---";
extern string A_S0            = "0 = no alert";
extern string A_S1            = "1 = Tenkan crosses Kjiun";
extern string A_S2            = "2 = Kijun crosses Price";
extern string A_S3            = "3 = both";
extern bool Show_Tenkan       = true;
extern bool Show_Kijun        = true;
extern bool Show_Senkou       = true;
extern bool Show_Kumo         = true;
//---- buffers
double Tenkan_Buffer[];
double Kijun_Buffer[];
double SpanA_Buffer[];
double SpanB_Buffer[];
double Chinkou_Buffer[];
double SpanA2_Buffer[];
double SpanB2_Buffer[];
//----
int a_begin;
bool UptrendAlert1,DntrendAlert1,UptrendAlert2,DntrendAlert2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//----
   if(Show_Tenkan==true){
      SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
      SetIndexBuffer(0,Tenkan_Buffer);
      SetIndexDrawBegin(0,Tenkan-1);
      SetIndexLabel(0,"Tenkan Sen");
   }  
//----
   if(Show_Kijun==true){
      SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
      SetIndexBuffer(1,Kijun_Buffer);
      SetIndexDrawBegin(1,Kijun-1);
      SetIndexLabel(1,"Kijun Sen");
      }
//----
   if(Show_Kumo==true){
      a_begin=Kijun; if(a_begin<Tenkan) a_begin=Tenkan;
      SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_DOT);
      SetIndexBuffer(2,SpanA_Buffer);
      SetIndexDrawBegin(2,Kijun+a_begin-1);
      SetIndexShift(2,Kijun);
      SetIndexLabel(2,NULL);
      SetIndexStyle(5,DRAW_LINE,STYLE_SOLID);
      SetIndexBuffer(5,SpanA2_Buffer);
      SetIndexDrawBegin(5,Kijun+a_begin-1);
      SetIndexShift(5,Kijun);
      SetIndexLabel(5,"Senkou Span A");
   }
//----
   if(Show_Kumo==true){
      SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_DOT);
      SetIndexBuffer(3,SpanB_Buffer);
      SetIndexDrawBegin(3,Kijun+Senkou-1);
      SetIndexShift(3,Kijun);
      SetIndexLabel(3,NULL);
      SetIndexStyle(6,DRAW_LINE,STYLE_SOLID);
      SetIndexBuffer(6,SpanB2_Buffer);
      SetIndexDrawBegin(6,Kijun+Senkou-1);
      SetIndexShift(6,Kijun);
      SetIndexLabel(6,"Senkou Span B");
   }
//----
   if(Show_Senkou==true){
      SetIndexStyle(4,DRAW_LINE);
      SetIndexBuffer(4,Chinkou_Buffer);
      SetIndexShift(4,-Kijun);
      SetIndexLabel(4,"Chinkou Span");
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Ichimoku Kinko Hyo                                               |
//+------------------------------------------------------------------+
int start()
{
   int    i,k;
   int    counted_bars=IndicatorCounted();
   double high,low,price;
//----
   if(Bars<=Tenkan || Bars<=Kijun || Bars<=Senkou) return(0);
//---- initial zero
   if(counted_bars<1)
     {
      for(i=1;i<=Tenkan;i++)    Tenkan_Buffer[Bars-i]=0;
      for(i=1;i<=Kijun;i++)     Kijun_Buffer[Bars-i]=0;
      for(i=1;i<=a_begin;i++) { SpanA_Buffer[Bars-i]=0; SpanA2_Buffer[Bars-i]=0; }
      for(i=1;i<=Senkou;i++)  { SpanB_Buffer[Bars-i]=0; SpanB2_Buffer[Bars-i]=0; }
     }
//---- Tenkan Sen
      i=Bars-Tenkan;
      if(counted_bars>Tenkan) i=Bars-counted_bars-1;
         while(i>=0)
            {
            high=High[i]; low=Low[i]; k=i-1+Tenkan;
         while(k>=i)
            {
            price=High[k];
            if(high<price) high=price;
            price=Low[k];
            if(low>price)  low=price;
            k--;
           }
         Tenkan_Buffer[i]=(high+low)/2;
         i--;
      }
//---- Kijun Sen
   i=Bars-Kijun;
   if(counted_bars>Kijun) i=Bars-counted_bars-1;
   while(i>=0)
     {
      high=High[i]; low=Low[i]; k=i-1+Kijun;
      while(k>=i)
        {
         price=High[k];
         if(high<price) high=price;
         price=Low[k];
         if(low>price)  low=price;
         k--;
        }
      Kijun_Buffer[i]=(high+low)/2;
      i--;
     }
//---- Senkou Span A
   i=Bars-a_begin+1;
   if(counted_bars>a_begin-1) i=Bars-counted_bars-1;
   while(i>=0)
     {
      price=(Kijun_Buffer[i]+Tenkan_Buffer[i])/2;
      SpanA_Buffer[i]=price;
      SpanA2_Buffer[i]=price;
      i--;
     }
//---- Senkou Span B
   i=Bars-Senkou;
   if(counted_bars>Senkou) i=Bars-counted_bars-1;
   while(i>=0)
     {
      high=High[i]; low=Low[i]; k=i-1+Senkou;
      while(k>=i)
        {
         price=High[k];
         if(high<price) high=price;
         price=Low[k];
         if(low>price)  low=price;
         k--;
        }
      price=(high+low)/2;
      SpanB_Buffer[i]=price;
      SpanB2_Buffer[i]=price;
      i--;
     }
//---- Chinkou Span
   i=Bars-1;
   if(counted_bars>1) i=Bars-counted_bars-1;
   while(i>=0) { Chinkou_Buffer[i]=Close[i]; i--; }
  
//----
   string Msg,Subj;
  
   if (AlertType == 1 || AlertType == 3)
   {
      if (Tenkan_Buffer[1]>Kijun_Buffer[1] && Tenkan_Buffer[2]<Kijun_Buffer[2] && !UptrendAlert1)
      {
         Subj = "Tenkan crosses Kijun: "+Symbol()+" on M"+Period();
         Msg = "BUY Signal --- : "+Subj+ " @ "+DoubleToStr(Close[1],Digits) + ", @ " + TimeToStr(TimeLocal(),TIME_SECONDS);
         UptrendAlert1 = true;
         DntrendAlert1 = false;
         DoAlerts(Msg,Subj);
      }
      if ( Tenkan_Buffer[1]<Kijun_Buffer[1] && Tenkan_Buffer[2]>Kijun_Buffer[2] && !DntrendAlert1)
      {  
         Subj = "Tenkan crosses Kijun: "+Symbol()+" on M"+Period();
         Msg = "SELL Signal --- : "+Subj+ " @ "+DoubleToStr(Close[1],Digits) + ", @ " + TimeToStr(TimeLocal(),TIME_SECONDS);
         UptrendAlert1 = false;
         DntrendAlert1 = true;
         DoAlerts(Msg,Subj);
      }
   }
  
   if (AlertType == 2 || AlertType == 3)
   {
      if (Close[1]>Close[1+Kijun] && Close[2]<Close[2+Kijun] && !UptrendAlert2)
      {
         Subj = "Kijun crossed Price: "+Symbol()+" on M"+Period();
         Msg = "BUY Signal --- : "+Subj+ " @ "+DoubleToStr(Close[1],Digits) + ", @ " + TimeToStr(TimeLocal(),TIME_SECONDS);
         DntrendAlert2 = false;
         UptrendAlert2 = true;
         DoAlerts(Msg,Subj);
      }
      if (Close[1]<Close[1+Kijun] && Close[2]>Close[2+Kijun] && !DntrendAlert2)
      {
         Subj = "Kijun crossed Price: "+Symbol()+" on M"+Period();
         Msg = "SELL Signal --- : "+Subj+ " @ "+DoubleToStr(Close[1],Digits) + ", @ " + TimeToStr(TimeLocal(),TIME_SECONDS);
         DntrendAlert2 = true;
         UptrendAlert2 = false;
         DoAlerts(Msg,Subj);
      }
   }
   return(0);
}

void DoAlerts(string msgText, string eMailSub)
{
   if (MsgAlerts) Alert(msgText);
   if (eMailAlerts) SendMail(eMailSub, msgText);
}
//+------------------------------------------------------------------+

 
Ваня:

My personal experience has nothing to do with it.

So the legendary Ishimoku is unfamiliar to you? Hasn't it proven itself over the years?

It's not a question of a trading robot that will or won't lose a deposit.

It's a traditional Ishimoku with an alert screwed on. The decision is up to the trader.

What is your question?

You want to be reworked. If the improvement is not too difficult, it can be done for a fee. But if they recommend you to go to Freelancer, it means that your improvements are not so small.

And there are only two bases for making major revisions. Either the trader pays for the work, or provides a really working TS.

You are offering an ishimoku indicator - but the indicator is not a system. Therefore, no one wants to bother with it.

 

Well, that's right, it's telling you errors.

Look for yourself - when the control comes to the if statement?

In both cases this operator just "hangs in the air" - that's what the compiler warns you about. "Expression is not allowed on the global level".

The if statement must stand at the point where you want the alert to be called, not "hanging in the air".

And, it makes no difference whether it's MT4 or MT5 - you can't do that in both cases. The if statement passes control to one of the branches, it cannot "just hang in the air".

Only your procedures and functions can "hang in the air" and be called either by the terminal when handling events- OnCalculte(), or by yourself - DoAlerts().

 
George Merts:

Well, that's right, it's telling you errors.

Look for yourself - when control comes to the if statement?

In both cases this operator just "hangs in the air" - that's what the compiler warns you about. "Expression is not allowed on the global level".

The if statement must stand at the point where you want the alert to be called, not "hanging in the air".

And, it makes no difference whether it's MT4 or MT5 - you can't do that in both cases. The if statement passes control to one of the branches, it cannot "just hang in the air".

Only your procedures and functions can "hang in the air", which will be called either by terminal when processing events- OnCalculte(), or by yourself - DoAlerts().

I am not a programmer

For me, it is a dark forest.

 
Ваня:

I'm not a programmer.

it's a dark forest for me.

Well, you were pointed to the service Freelance. There - live programmers who have no problem to form the TOR in consultation with you, and carry it out at a similar price.

There is a forum where they can help newbies, but really help those who are trying to grow as a programmer. Quite a lot of traders are not interested in it - and Freelance for them is very reasonable solution.

 
George Merts:

Well, you were pointed to the service Freelance. There are programmers there, who will easily form the TOR in consultation with you, and execute it at a reasonable price.

I have understood that mt5 is a real mess. But this is a forum where they can help the beginners, but to help those, who are trying to grow as a programmer. Quite a few traders are not interested in it, and Freelance is a very reasonable solution for them.

I just wanted to test mt5.

I have all the indicators on mt4. They work.

Since I cannot even comfortably test it...

Now I understand that mt5 is a real pain in the ass.

 
Ваня:

I just wanted to test the mt5.

On mt4 all the indicators are there. They work.

Since it's impossible to even test it comfortably...

Now I understand that mt5 is a real pain in the ass.

Mt5 is not a pain in the ass, neither is mql5.

I have not tested the indicator though. If you have any problems, tell me, I will test it myself and look for problems.
 
Alexey Viktorov:
Mt5 as well as mql5 is not a pain in the ass.

Only I haven't tested the indicator. If you have any problems, let me know and I will test it myself.
ArraySetAsSeries has been forgotten.
 
o_O:
ArraySetAsSeries forgotten
Yeah... I'm already fixing it.



It's fixed now, checked. The alerts are there, but I don't know if it's correct.

Vanya, please let me know the correctness of the alerts after checking them. The indicator will be in CodeBase.
Files:
 
Alexey Viktorov:
Yeah... I'm already fixing it.



It's fixed now, tested. The alerts are there, but I don't know if it is correct.

Vanya, please let me know if the alerts are correct after checking. The indicator will be in CodeBase.

Thank you! Good man! May you be HEALTHY and profitable for the rest of eternity!

I'll be testing.

Reason: