Compare Proposal

Nothing to compare.

MQL4 to MQL5 conversion of Script Expert consultant

  • Posted at : 2 months ago
  • Post Similar Project
10

Budget
2
Proposals
69
Views
Open
Status
Skills Required

Posted By -

KB

0.0
Projects Posted : 1
Projects Paid : 0
Services Purchased : 0
Total Spent :
0
Feedbacks : 0 %

Project Details show (+) hide (-)

I need to convert my script from mql4 to mql5. 

//+------------------------------------------------------------------+
//|                                                    bot achat.mq4 |
//|                                                            kevin |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "kevin"
#property link      ""
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int order;

int OnInit()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {

   double PriceBid=Close[0];
   double movingAverage = iMA(NULL,0,15,0,MODE_SMA,PRICE_MEDIAN,0);
   // double currentPrice = Open[0]; ne fonctionne plus depuis 23/12/2020
   double lastPrice = Open[1];
   double Price=(Ask+Bid)/2;  // Taris entre prix d'achat et de vente, a tester permet davoir un achat au plus juste
 
   if ( (PriceBid > movingAverage) && (PriceBid < lastPrice) ) {
     //sell
     order = OrderSend(NULL,OP_SELL,0.01,PriceBid,0,NULL,250,NULL,0,0,NULL);
     } 
     
     else if ( ( PriceBid < movingAverage) && (PriceBid > lastPrice) ) {
       //buy
       order = OrderSend(NULL,OP_BUY,0.01,PriceBid,0,NULL,250,NULL,0,0,NULL);
       }
       
       Alert("Dernier Prix: "+lastPrice+" Prix moyen: "+movingAverage+" Prix actuel: "+PriceBid);
  }
//+------------------------------------------------------------------+