STEP2 – Build the HELLOMQL5TUTORIAL expert advisor with MetaEditor

How to make it a working Expert Advisor for MetaTrader 5

To use the code from STEP1 you must compile it. To do this please follow these steps

  1. Start Metatrader 5
  2. Press the F4 key to bring up the MetaEditor
  3. Click on File -> New -> Expert Advisor
  4. Click on Continue and give it the Name ExpertsHELLOMQL5TUTORIAL
  5. Click on Continue and ignore all the radio boxes for further functions
  6. Delete all the code in the text editor
  7. Replace it with this code
void OnTick()
 {
 int Spread;
 Spread=SymbolInfoInteger(Symbol(),SYMBOL_SPREAD);
 Comment("Spread is "+Spread);
 }

Now press the F5 key to compile the Expert Advisor

If everything went right, your MetaEditor window now should look like this

MetaEditorIn Step3 we are going to tell MetaTrader 5 that Expert Advisors should be allowed.