The magic number is a Metatrader concept used to track the open positions of an EA. The concept allows the Ea to distinguish the trades that it opened versus those that it did not.
Each car uses a license plate. When you detect a car in a different state or even a different country, you observer that every plate that you come across is unique. Law enforcement can utitlize the number to determine who owns the car.
Magic numbers function like the license plates for expert advisors. When an expert advisor detects an open trade, called a ticket, it repeatedly asks for its magic number. If the magic number of the ticket is identical to the number that the expert advisor expects, then it knows to manage the position.
Magic numbers are helpful, particularly when you want to trade multiple time frames of the same forex pair. Traders often use settings that differ from those on M1 prices versus those that they would use on the daily chart. If they used the Expert advisor with the same magic number on all different time frames, the result would be chaos. The expert advisor would open and close positions with no rhyme or reason. Setting every Expert advisor to emply an unique magic number disallows the robots from interfering with the others.
Magic number factoids
The magic number of a manually opened trade is 0.
The number that you use for a magic number must be a number ranging from 0 と 2147483647. The MQL programming language assigns that last number EMPTY_VALUE and protects the name as an integer value.
OneStepRemoved.com is a company that specializes in programming an 専門家アドバイザー for traders. Shaun Overton is the company owner.