Pls help correct the code where necessary and at iRSi calculation showing error - page 2

 
Vladimir Karputov #:

Where is your MQL5 code? You are attaching some empty files. Please describe in detail what is wrong with you. Paste your code into a forum post (use the button   )

For some reason, the OP (Dotia2u) attached a Microsoft Word file ".docx" and renamed the file extension to ".mqh". The Word file contains the code itself (see below). I have no idea why he would do it this way.

EDIT: Please note that this is the OP's code as is. I made no corrections or changes.

#include<Trade\Trade.mqh>
CTrade trade;
void onTick()
{
        double Ask=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);
        double RSIValue=iRSI(_Symbol,_Period,7,PRICE_CLOSE,0);
        string Signal="";
        string TimeTillNextBar(ENUM_TIMEFRAMES tf=PERIOD_M1)
  {
   datetime now=TimeCurrent();
   datetime bartime=iTime(NULL,tf,0);
   datetime remainingTime=bartime+PeriodSeconds(tf)-now;
  }
  if((Open[0]-Ask<0) && (Open[1]-Close[1]>0) && ((Open[0]-Ask)>=2*(Open[1]-Close[1])) && RSIValue<=80 && (Open[0]-Low[0])>=(High[0]-Ask) && remainingTime<=2)
  {
          Signal="buy";
          if(Signal=="buy" && PositionTotal()<2)
          trade.Buy(0 001,NULL,Ask(Ask-1600*_Point),(Ask+10000*_Point),NULL);
          CheckTrailingStop(Ask);
 }
}
void CheckTrailingStop( double Ask)
{
        double SL=NormalizeDouble(Ask-150*_Point,Digits);
        for(int i=PositionTotal()-1; i>=0; i--)
        {
                string symbol=PositionGetSymbol(i);
                if(Symbol=symbol)
                {
                        ulong PositionTicket=PositionGetInteger(POSITION_TICKET);
                        double CurrentStopLoss=PositionGetDouble(POSITION_SL);
                        if(CurrentStopLoss<SL)
                        {
                                trade.PositionModify(PositionTicket,(CurrentStopLoss+10*_Point),0);
                        }
                }
        }
}
 
Fernando Carreiro # :

For some reason, the OP ( Dotia2u ) attached a Microsoft Word file ".docx" and renamed the file extension to ".mqh". The Word file contains the code itself (see below). I have no idea why he would do it this way.

The code contains a gross error: the handle of the RSI indicator is created on each tick!

Remember: according to the MQL5 style, the indicator handle is created ONCE and it is done in OnInit. An example of how to create an indicator and how to get a value from the indicator: 

An example of get values from the iRSI indicator

How to start with MQL5
How to start with MQL5
  • 2020.07.05
  • www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...
 
Vladimir Karputov #:

The code contains a gross error: the handle of the RSI indicator is created on each tick!

Remember: according to the MQL5 style, the indicator handle is created ONCE and it is done in OnInit. An example of how to create an indicator and how to get a value from the indicator: 

An example of get values from the iRSI indicator

Pls can you help make the nescessary correction plssssss
 
Dotia2u #:
Pls can you help make the nescessary correction plssssss
Vladimir Karputov #:

The code contains a gross error: the handle of the RSI indicator is created on each tick!

Remember: according to the MQL5 style, the indicator handle is created ONCE and it is done in OnInit. An example of how to create an indicator and how to get a value from the indicator: 

An example of get values from the iRSI indicator

Pls Sir, can you help me correct it all and compile it, before sending it, pls and pls
 
Dotia2u #: Pls Sir, can you help me correct it all and compile it, before sending it, pls and pls

Besides the error that that @Vladimir Karputov pointe out, there are also too many other errors. It is mixing MQL4 with MQL5 code.

It needs to be properly rewritten, so hire someone to code it for you, or dedicate yourself to learning how to code in MQL5.

 
Fernando Carreiro #:

Besides the error that that @Vladimir Karputov pointe out, there are also too many other errors. It is mixing MQL4 with MQL5 code.

It needs to be properly rewritten, so hire someone to code it for you, or dedicate yourself to learning how to code in MQL5.

Pls am beging you help me do the necessary correction. Pls and plssss
 
Dotia2u #:
Pls Sir, can you help me correct it all and compile it, before sending it, pls and pls
Pls and pls, I really have to do this, pls and plssssss
 
Dotia2u #: Pls am beging you help me do the necessary correction. Pls and plsss.  Pls and pls, I really have to do this, pls and plssssss

Then do it yourself by putting the effort into learning how. This forum is for helping those that wish to learn how to code themself. It is not for granting wishes!

I have no intention of becoming your underling or slave. Place a job request at the Freelance section of the site, and negotiate the terms with whomever wishes to take on the job.

 
Dotia2u #:
How I wish am financially buoyant enough, I would have love to do just exactly as you've said. I do understand.
 
Dotia2u #: Pls and pls, I really have to do this, pls and plssssss

Pls and plsssss are not English words. This is an international English forum; post in English on this part of the forums.
          Please don't write ur - it's "you are" or "your" - MQL4 programming forum (2014)

You have only four choices:

  1. Search for it (CodeBase or Market). Do you expect us to do your research for you?

  2. Beg at:

  3. MT4: Learn to code it.
    MT5: Begin learning to code it.

    If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.

  4. Or pay (Freelance) someone to code it. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum (2019)

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
          No free help (2017)