Head and global vaiables are the first piece of code of the expert advisor where you must set the copyright information, the variables that you are going to use in some functions and the externs variables that you are going to use in some functions and you want to be able for after compile changes.
Let go to comment this piece of code:
Head with copyright information:
#property copyright "Copyright 2008, http://cablebot.blogspot.com/"
#property link "http://cablebot.blogspot.com/"
stdlib library call:
#include <stdlib.mqh>
external variables:
extern string Version = "CyberEA"; This is a comment asociate to all orders open by this expert advisor. This comment can be used to identify all orders from the EA.
extern string Settings="Settings"; Here start the external variables that you can chage in the experts properties window at the time of use. Set the default values before compile.
Trading hours:
extern int StartHour = 0;
extern int EndHour = 24;
extern int Expiration = 24;
Slippage:
extern int Slippage = 5;
Order take profit and stoploss:
extern double TakeProfit =450;
extern double StopLoss = 150;
Trainling stop:
extern bool UseTrailingStop = false;
extern int TrailingStart = 80;
extern int TrailingStop =100;
BreakEven or Profit Protect variables:
extern bool UseBreakEven = false;
extern int ProfitProtectStart1 = 60;
extern int ProfitToProtect1 =30;
extern int ProfitProtectStart2 = 120;
extern int ProfitToProtect2 =60;
extern int ProfitProtectStart3 = 180;
extern int ProfitToProtect3 =90;
extern int ProfitProtectStart4 = 240;
extern int ProfitToProtect4 =120;
Money Management tool:
extern string MM = "Money Management";
extern bool UseMoneyManagement=true;
extern bool UseMicroLots = false;
extern int MaximumRisk = 5;
extern string FixedLot = "Fixed Lots";
extern double FixedLots = 0.1;
Magic Number: This number is used to identify singles orders from the EA, be sure that is different for each chart and for each currencies pair you trade.
extern int MagicNumber = 852745962;
Indicators settings:
extern int FastMAPeriod = 57;
extern int FastMAShift = 2;
extern int FastMAMode = MODE_EMA;
extern int FastMAApplyPrice = PRICE_CLOSE;
extern int SlowMAPeriod = 19;
extern int SlowMAShift = 12;
extern int SlowMAMode = MODE_EMA;
extern int SlowMAApplyPrice = PRICE_CLOSE;
extern int Bar = 1;
Others global variables the EA use to calculate some parameters in several loops of the automated system.The next variables can not been change after compilation.
int Number = 20;
int Kumo = 1;
bool signalBuy;
bool signalSell;
bool goShort;
bool goLong;
int ordersent;
int Arko;
int time_now;
double fastMA;
double slowMA;
int conditionalcheck = 0;
double LotSize;
If you want to change the name of some variables you can do but make sure you change it every time the same variable appear in the expert advisor code.
In the next posts I will comment all the loops and functions of the EA line by line.
0 coments:
Post a Comment