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
- Start Metatrader 5
- Press the F4 key to bring up the MetaEditor
- Click on File -> New -> Expert Advisor
- Click on Continue and give it the Name ExpertsHELLOMQL5TUTORIAL
- Click on Continue and ignore all the radio boxes for further functions
- Delete all the code in the text editor
- 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
In Step3 we are going to tell MetaTrader 5 that Expert Advisors should be allowed.