Correct My Code

MQL5 Experts

Termos de Referência

Hi Devs, thanks for your good works.

I have a code that worked perfectly for me on mt4. I tried converting my code to mt5 but the kernel32.dll aspect of the code is not giving the same result.

Please help me check what I am doing wrong, make corrections tell me what i did wrong.

Budget is $30

Thanks



//+------------------------------------------------------------------+

//|                                                    K32dllmt5.mq5 |

//|                        Copyright 2021, MetaQuotes Software Corp. |

//|                                             https://www.mql5.com |

//+------------------------------------------------------------------+

#property copyright "Copyright 2021, MetaQuotes Software Corp."

#property link      "https://www.mql5.com"

#property version   "1.00"

#property strict



#import   "kernel32.dll"

int CreateFileW(string Filename,int AccessMode,int ShareMode,int PassAsZero,int CreationMode,int FlagsAndAttributes,int AlsoPassAsZero);

int GetFileSize(int FileHandle,int PassAsZero);

int SetFilePointer(int FileHandle,int Distance,int &PassAsZero[],int FromPosition);

int ReadFile(int FileHandle,uchar &BufferPtr[],int BufferLength,int  &BytesRead[],int PassAsZero);

int CloseHandle(int FileHandle);

#import





double data[][2];



int BytesToRead;

string    datapath;

string    result;



union Price

  {

   uchar             buffer[8];

   double            close;

  };

Price     m_price;

//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit()

  {

//---

    string account_server=AccountInfoString(3);

    datapath=TerminalInfoString(3)+"\\history\\"

               +account_server+"\\"+Symbol()+"240"+".hst";

    ReadFileHst(datapath);

//---

   return(INIT_SUCCEEDED);

  }

//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {

//---

   

  }

//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+

void OnTick()

  {



Comment("Bytes To Read: ", BytesToRead);





   

  }

//+------------------------------------------------------------------+



//+------------------------------------------------------------------+

void ReadFileHst(string FileName)

  {

   int       j=0;;

   string    strFileContents;

   int       Handle;

   int       LogFileSize;

   int       movehigh[1]= {0};

   uchar     buffer[];

   int       nNumberOfBytesToRead;

   int       read[1]= {0};

   int       i;

   double    mm;

//----- -----

   strFileContents="";

   Handle=CreateFileW(FileName,(int)0x80000000,3,0,3,0,0);

//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

   if(Handle==-1)

     {

      Comment("");

      return;

     }

   LogFileSize=GetFileSize(Handle,0);

//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

   if(LogFileSize<=0)

     {

      return;

     }

//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

   if((LogFileSize-148)/60==BytesToRead)

     {

      return;

     }

   SetFilePointer(Handle,148,movehigh,0);

   BytesToRead=(LogFileSize-148)/60;

   ArrayResize(data,BytesToRead,0);

   nNumberOfBytesToRead=60;

   ArrayResize(buffer,60,0);

   for(i=0; i<BytesToRead; i=i+1)

      //+------------------------------------------------------------------+

      //|                                                                  |

      //+------------------------------------------------------------------+

     {

      ReadFile(Handle,buffer,nNumberOfBytesToRead,read,NULL);

      if(read[0]==nNumberOfBytesToRead)

        {

         result=StringFormat("0x%02x%02x%02x%02x%02x%02x%02x%02x",buffer[7],buffer[6],buffer[5],buffer[4],buffer[3],buffer[2],buffer[1],buffer[0]);



         m_price.buffer[0] = buffer[32];

         m_price.buffer[1] = buffer[33];

         m_price.buffer[2] = buffer[34];

         m_price.buffer[3] = buffer[35];

         m_price.buffer[4] = buffer[36];

         m_price.buffer[5] = buffer[37];

         m_price.buffer[6] = buffer[38];

         m_price.buffer[7] = buffer[39];

         mm=m_price.close;

         data[j][0] = StringToDouble(result);

         data[j][1] = mm;

         j=j+1;

         strFileContents=TimeToString(StringToTime(result),3)+" "+DoubleToString(mm,8);

        }

      else

        {

         CloseHandle(Handle);

         return;

        }

     }

   CloseHandle(Handle);

   strFileContents=DoubleToString(data[j-1][0],3)+" "+DoubleToString(data[j-1][1],8)+" "+DoubleToString(data[j-2][1],3)+" "+DoubleToString(data[j-2][1],8);

   result=strFileContents;

  }

Arquivos anexados:

JPG
MT4.jpg
45.4 Kb
JPG
MT5.jpg
181.5 Kb

Respondido

1
Desenvolvedor 1
Classificação
(137)
Projetos
160
23%
Arbitragem
7
0% / 43%
Expirado
4
3%
Carregado
2
Desenvolvedor 2
Classificação
(8)
Projetos
18
17%
Arbitragem
3
67% / 0%
Expirado
0
Livre
3
Desenvolvedor 3
Classificação
(57)
Projetos
72
22%
Arbitragem
13
46% / 15%
Expirado
5
7%
Livre
4
Desenvolvedor 4
Classificação
(42)
Projetos
62
8%
Arbitragem
12
58% / 42%
Expirado
1
2%
Livre
Pedidos semelhantes
are you aware of the Monday Range Strategy? https://www.youtube.com/watch?v=7B_yBBFx6z8 5pm EST time sunday - monday 5pm est and it has to be on the H1 chart , minimum 1:2 Risk to reward and break even function after 1:1
Strategy: 1. Identify strong supply and demand levels. Draw them in the chart in green and red. In Tradingview: Market Structure Break & Order Block by EmreKb von EmreKb --> Strong demand and supply area refer to picture below (Buy and Sell Zones). There must be a strong demand / supply zone on a higher time frame in order for the set up to be valid. The time frame can be selected in the settings. E.g. "Higher Time
Hi there, I currently have a scalping strategy based of 3 thrid party indicators that I would like automated. This would help me with running the strategy through the strategy tester. Two of the indicators dont have iCustom functionality to pull the data in, so another way would have to be devised. The strategy incorpates trading activity, sentiment in the for of the ratio of traders in profit, and a third techincal
Hi, I have a Live Data feature for my trading accounts that lets me check details like total open positions, number of lots, profits, etc. I need someone to add the number of pending orders to this live data. This is important for me to ensure that all accounts have the same number of pending orders, since I use a copy trading system. Also, there is a website where I check all the data. In this case, you would need
OK I just need 1 MOD Who can do it free There is a (Reciever EA) that receives signals from a (Sender EA) I need to ADD one mod It may even look like the option/signal is there= Ignore it Coding was wrong on that part This is simple The option in the Reicver EA will Be called "Open Copy Live" with the option to Set to True or False When set to true the Reicver EA will Watch
Hi there, I need a very highly skilled mt4 programmer to code and design an EA from scratch. The logic of the EA will be discussed with you in comments section, only reach out if you can code perfectly for mt4 using MQL4 coding solutions language, EA must be able to run well without any problems and work according to the logic thanks
I came across an indicator that's perfectly good in catching spikes in boom amd crash but i would want it to be modified and to improve accuracy As a professional you will have to go through the indicator and explain to me the strategy with which the indicator was buid and tell me the possibility of improving it better
### Summary of EA Requirements 1. **Time Period**: - The EA should operate on the H4 timeframe. 2. **RelicusRoad MACD v2 Indicator**: - **Parameters**: - Fast EMA Period: 12 - Fast EMA Type: Close price - Slow EMA Period: 24 - Slow EMA Type: Close price - Signal SMA Period: 9 - The EA should use this indicator to determine the crossover condition between the MACD line and the signal line. 3
An EA that executes when the 21 and 55 SMA Cross on certain time frame also the EA will understand supply and demand levels and executes when price reacts on this levels specified and target/stoploss levels will be predetermined...also the robot will also comprise stochastic oscillator
Ind V5 TV Strategy Requirements: Instruments: Forex pairs, Crypto and Stocks across exchanges TimeFrame: Multi-Time Frame comparisons, details below Indicators: Ichimoku Cloud, ATR & Choppiness Index Trade times: First Order: Day of Week Start Time, Day of Week First Order time, Day of Week Last Order Time and Day of Week Square Off Time Intraday TF: 1 min, 3 mins, 9 mins, 27 mins and 81 mins Position Size (Lots)

Informações sobre o projeto

Orçamento
30+ USD
Desenvolvedor
27 USD