Basic MT4 to MT5 help for newbie.

 
extern double MaxSpread = 3;

int start()
  {
   int SellOrder = 0;
   if(MarketInfo("GBPUSD",MODE_SPREAD) < MaxSpread)
      {
       SellOrder = OrderSend ("GBPUSD",OP_SELL,1.0,MarketInfo("GBPUSD",MODE_BID),5,0,0,"",MagicNumber);
      }
  }
I hope this isn't asking too much, but I'm hoping someone can get me started on understanding MT5.  I've been reading the documentation, but I'm just not following it very well.  I'm hoping someone will be kind enough to look at this code, then post it's equivalent in MT5.  If feel like if I saw it and compared the two, it would give me a 'kick start' to understanding MT5 a little better.  Thanks!
 
mpr:
I hope this isn't asking too much, but I'm hoping someone can get me started on understanding MT5.  I've been reading the documentation, but I'm just not following it very well.  I'm hoping someone will be kind enough to look at this code, then post it's equivalent in MT5.  If feel like if I saw it and compared the two, it would give me a 'kick start' to understanding MT5 a little better.  Thanks!

You can look at Code Base. Here some of them that develop by Integer :

- 20_200 expert_v4.2_AntS

- Eugene

- Combo_Right

- Terminator_v2.0

and more.

 
mpr:
I hope this isn't asking too much, but I'm hoping someone can get me started on understanding MT5.  I've been reading the documentation, but I'm just not following it very well.  I'm hoping someone will be kind enough to look at this code, then post it's equivalent in MT5.  If feel like if I saw it and compared the two, it would give me a 'kick start' to understanding MT5 a little better.  Thanks!

Order send in MQL5 is a little bit "detail" than MQL4 which is more simple. Here's I found some Order Send code from MQL4 to MQL5 (click here). You may want also to read Migrating from MQL4 to MQL5.

Hope that's help. 

 
mpr:
I hope this isn't asking too much, but I'm hoping someone can get me started on understanding MT5.  I've been reading the documentation, but I'm just not following it very well.  I'm hoping someone will be kind enough to look at this code, then post it's equivalent in MT5.  If feel like if I saw it and compared the two, it would give me a 'kick start' to understanding MT5 a little better.  Thanks!

This only one way to do it, in MQL5 there are always several ways :

ulong   MagicNumber = 123456789;
input   double  MaxSpread   = 3.0;

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
    bool SellOrder = false;
    MqlTradeRequest request     = {0};
    MqlTradeResult  result      = {0};
    MqlTick tick;

    if (SymbolInfoTick(Symbol(), tick) && SymbolInfoInteger("GBPUSD", SYMBOL_SPREAD) < MaxSpread) {

        request.action              = TRADE_ACTION_DEAL;            // setting a pending order
        request.magic               = MagicNumber;                  // ORDER_MAGIC
        request.symbol              = "GBPUSD";                     // symbol
        request.volume              = 1.0;                          // volume in 0.1 lots
        request.sl                  = 0;                            // Stop Loss is not specified
        request.tp                  = 0;                            // Take Profit is not specified     
        request.type                = ORDER_TYPE_SELL;              // order type
        request.price               = tick.bid;                     // open price
        request.deviation           = 5;                            // Slippage
    
        //--- send a trade request
        OrderSend(request, result);
    }
}

WARNING : DO NOT USE THIS CODE AS IS TO TRADE, THIS IS ONLY AS EDUCATION PURPOSE.

 
Thanks everyone!!  Plenty of info to get me started!
Reason: