why zero divide?

 
Symb = Symbol();

   RefreshRates();                              // Refresh rates
   Min_Lot=MarketInfo(Symb,MODE_MINLOT);        // Minimal number of lots 
   Free   =AccountFreeMargin();                 // Free margin
   One_Lot=MarketInfo(Symb,MODE_MARGINREQUIRED);// Price of 1 lot
   Step   =MarketInfo(Symb,MODE_LOTSTEP);       // Step is changed
   Step = 1;
   Print(Step);
   if (Lots < 0)                                // If lots are set,
      Lts =Lots;                                // work with them
   else                                         // % of free margin
      Lts=MathFloor(Free*Prots/One_Lot/Step)*Step;// For opening

Why am I getting zero divide in the above code please? I believe is the Step.

This is the example code that I download from https://book.mql4.com/samples/expert , as I am self learning MQL4 language.

I have attached my mq4 file, this is modified on tradingexpert.mq4 from the tutorial page above.

Many thanks 

Simple Expert Advisor - Simple Programs in MQL4 - MQL4 Tutorial
Simple Expert Advisor - Simple Programs in MQL4 - MQL4 Tutorial
  • book.mql4.com
Simple Expert Advisor - Simple Programs in MQL4 - MQL4 Tutorial
Files:
Morning_EA.mq4  25 kb
 
  1. Use the debugger or print out your variables, including _LastError and find out why. We have no idea what One_Lot is.
  2. Don't use MarketInfo in OnInit. The terminal may not yet be connected to the broker.
  3. Risk depends on your initial stop loss and lot size.
    • You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
    • Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the SPREAD, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
    • Do NOT use TickValue by itself - DeltaPerLot
    • You must normalize lots properly and check against min and max.
    • You must also check FreeMargin to avoid stop out
 
Check that in the division the result is 0, because if it is 0 you will have the zero divide error. Try to see if this Tipic can be useful to you.
Reason: