1. There is no need to compile the mqh separately
2. Change
#include <Lite_EXPERT1.mqh>
to
#include <"Lite_EXPERT1.mqh">

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Please, I need help from members to kindly solve some problems in Expert Advisor with an #Include file.
A compiled MetaEditor result indicate the following messages: .
Description
Compiling 'Exp_8.mq4'...
Function "DeleteOrder1" is not referenced and will be removed from exp-file
Function "OpenBuyLimitOrder1" is not referenced and will be removed from exp-file
Function "OpenSellLimitOrder1" is not referenced and will be removed from exp-file
0 error(s), 3 warning(s)
Description
Compiling 'Lite_EXPERT1.mqh'...
Start function not found and cannot be run
Function "OpenBuyOrder1" is not referenced and will be removed from exp-file
Function "OpenSellOrder1" is not referenced and will be removed from exp-file
Function "GetFreeMargin" is not referenced and will be removed from exp-file
Function "StopCorrect" is not referenced and will be removed from exp-file
Function "MarginCheck" is not referenced and will be removed from exp-file
Function "CloseOrder1" is not referenced and will be removed from exp-file
Function "DeleteOrder1" is not referenced and will be removed from exp-file
Function "OpenBuyLimitOrder1" is not referenced and will be removed from exp-file
Function "OpenBuyStopOrder1" is not referenced and will be removed from exp-file
Function "OpenSellLimitOrder1" is not referenced and will be removed from exp-file
Function "OpenSellStopOrder1" is not referenced and will be removed from exp-file
Function "Make_TreilingStop" is not referenced and will be removed from exp-file
0 error(s), 13 warning(s)
My major problem is with the 'Lite_EXPERT1.mqh' file. And my two main questions includes:
A) Start function not found and cannot be run.
1) How can I solve this problem so that the START FUNCTION can be found and RUN ?
2) And where in the program can I effect this correction ?
3) Is it in the Exp_8.mq4 Expert Advisor or #Include Lite_EXPERT1.mqh file ?
B) Function "OpenBuyOrder1" is not referenced and will be removed from exp-file
1) How can I reference the "OpenBuyOrder1" function to avoid removal from the exp-file ?
2) And where in the program can I effect this correction
3) Is it in the Exp_8.mq4 Expert Advisor or #Include Lite_EXPERT1.mqh file ?
The remaining questions falls under section B and appaers to have similar solution. I do not actually need all the functions.
EXPERT ADVISORS BASED ON POPULAR TRADING SYSTEMS AND ALCHEMY OF TRADING ROBOT OPTIMIZATION
CONT.....Article 4
EXPERTS.Zip (“Exp_8.mq4” Expert Advisor) and INCLUDE.Zip (“Lite_EXPERT1.mqh” #Include file).
Ref: MQL4, Articles, Page 2, article No 4, Parabolic SAR Expert Advisor.
THE 'Exp_8.mq4' Expert Advisor
#property copyright "Copyright © 2008, Nikolay Kositsin"
#property link "farria@mail.redcom.ru"
//----+ +------------------------------------------------------------+
//---- EA INPUT PARAMETERS FOR BUY TRADES
extern bool Test_Up = true;//filter of trade calculations direction
extern int Timeframe_Up = 240;
extern double Money_Management_Up = 0.1;
extern double Step_Up = 0.02;
extern double Maximum_Up = 0.2;
extern int STOPLOSS_Up = 50; // stop loss
extern int TAKEPROFIT_Up = 100; // take profit
extern int TRAILINGSTOP_Up = 0; // trailing stop
extern int PriceLevel_Up =40; // difference between the current price and
// pending order triggering price
extern bool ClosePos_Up = true; // forced position closing
//is allowed
//----+ +------------------------------------------------------------+
//---- EA INPUT PARAMETERS FOR SELL TRADES
extern bool Test_Dn = true;//filter of trade calculations direction
extern int Timeframe_Dn = 240;
extern double Money_Management_Dn = 0.1;
extern double Step_Dn = 0.02;
extern double Maximum_Dn = 0.2;
extern int STOPLOSS_Dn = 50; // stop loss
extern int TAKEPROFIT_Dn = 100; // take profit
extern int TRAILINGSTOP_Dn = 0; // trailing stop
extern int PriceLevel_Dn = 40; // difference between the current price and
// pending order triggering price
extern bool ClosePos_Dn = true; // forced position closing
//is allowed
//----+ +------------------------------------------------------------+
//---- Integer variables for the minimum of calculation bars
int MinBar_Up, MinBar_Dn;
//+==================================================================+
//| TimeframeCheck() functions |
//+==================================================================+
void TimeframeCheck(string Name, int Timeframe)
{
//----+
//---- Checking the correctness of Timeframe variable value
if (Timeframe != 1)
if (Timeframe != 5)
if (Timeframe != 15)
if (Timeframe != 30)
if (Timeframe != 60)
if (Timeframe != 240)
if (Timeframe != 1440)
Print(StringConcatenate("Parameter ",Name,
" cannot ", "be equal to ", Timeframe, "!!!"));
//----+
}
//+==================================================================+
//| Custom Expert Functions |
//+==================================================================+
#include <Lite_EXPERT1.mqh>
//+==================================================================+
//| Custom Expert Initialization Function |
//+==================================================================+
int init()
{
//---- Checking the correctness of Timeframe_Up variable value
TimeframeCheck("Timeframe_Up",Timeframe_Up);
//---- Checking the correctness of Timeframe_Dn variable value
TimeframeCheck("Timeframe_Dn", Timeframe_Dn);
//---- Initialization of variables
MinBar_Up = 5;
MinBar_Dn = 5;
//---- end of initialization
return(0);
}
//+==================================================================+
//| Expert Deinitialization Function |
//+==================================================================+
int deinit()
{
//----+
//---- End of the EA deinitialization
return(0);
//----+
}
//+==================================================================+
//| Custom Expert Iteration Function |
//+==================================================================+
int start()
{
//----+ Declaring local variables
double SAR1, SAR2, CLOSE1, CLOSE2;
//----+ Declaring static variables
//----+ +---------------------------------------------------------------+
static datetime StopTime_Up, StopTime_Dn;
static int LastBars_Up, LastBars_Dn;
static bool BUY_Sign, BUY_Stop, SELL_Sign, SELL_Stop;
//----+ +---------------------------------------------------------------+
//----++ CODE FOR LONG POSITIONS 1
if (Test_Up)
{
int IBARS_Up = iBars(NULL, Timeframe_Up);
if (IBARS_Up >= MinBar_Up)
{
if (LastBars_Up != IBARS_Up)
{
//----+ Initialization of variables
BUY_Sign = false;
BUY_Stop = false;
LastBars_Up = IBARS_Up;
StopTime_Up = iTime(NULL, Timeframe_Up, 0)
+ 60 * Timeframe_Up;
//----+ CALCULATING INDICATOR VALUES AND UPLOADING THEM TO BUFFERS
SAR1 = iSAR(NULL, Timeframe_Up, Step_Up, Maximum_Up, 1);
SAR2 = iSAR(NULL, Timeframe_Up, Step_Up, Maximum_Up, 2);
//---
CLOSE1 = iClose(NULL, Timeframe_Up, 1);
CLOSE2 = iClose(NULL, Timeframe_Up, 2);
//----+ ÎÏÐÅÄÅËÅÍÈÅ ÑÈÃÍÀËÎÂ ÄËß ÑÄÅËÎÊ
if (SAR2 > CLOSE2)
if (SAR1 < CLOSE1)
BUY_Sign = true;
if (SAR1 > CLOSE1)
BUY_Stop = true;
}
//----+ EXECUTION OF TRADES
if (PriceLevel_Up == 0)
{
if (!OpenBuyOrder1(BUY_Sign, 1,
Money_Management_Up, STOPLOSS_Up, TAKEPROFIT_Up))
return(-1);
}
else
{
if (!OpenBuyStopOrder1(BUY_Sign, 1,
Money_Management_Up, STOPLOSS_Up, TAKEPROFIT_Up,
PriceLevel_Up, StopTime_Up))
return(-1);
}
if (ClosePos_Up)
if (!CloseOrder1(BUY_Stop, 1))
return(-1);
if (!Make_TreilingStop(1, TRAILINGSTOP_Up))
return(-1);
}
}
//----+ +---------------------------------------------------------------+
//----++ CODE FOR SHORT POSITIONS 1
if (Test_Dn)
--- continuation similar to uptrend
THE #Include 'Lite_EXPERT1.mqh' file
int LastTime;
//+==================================================================+
//| OpenBuyOrder1() |
//+==================================================================+
bool OpenBuyOrder1
(bool& BUY_Signal, int MagicNumber,
double Money_Management, int STOPLOSS, int TAKEPROFIT)
{
//----+
if (!BUY_Signal)
return(true);
//---- Ïðîâåðêà íà èñòå÷åíèå ìèíèìàëüíîãî èíòåðâàëà âðåìåíè
//ìåæäó äâóìÿ òîðãîâûìè îïåðàöèÿìè
if (TimeCurrent() - LastTime < 11)
return(true);
int total = OrdersTotal();
//---- Ïðîâåðêà íà íàëè÷èå îòêðûòîé ïîçèöèè
//ñ ìàãè÷åñêèì ÷èñëîì ðàâíûì çíà÷åíèþ ïåðåìåííîé MagicNumber
for(int ttt = total - 1; ttt >= 0; ttt--)
if (OrderSelect(ttt, SELECT_BY_POS, MODE_TRADES))
if (OrderMagicNumber() == MagicNumber)
return(true);
string OpderPrice, Symb = Symbol();
int ticket, StLOSS, TkPROFIT;
double LOTSTEP, MINLOT, MAXLOT, MARGINREQUIRED;
double FreeMargin, LotVel, Lot, ask, Stoploss, TakeProfit;
//----+ ðàñ÷¸ò âåëè÷èíû ëîòà äëÿ îòêðûâàíèÿ ïîçèöèè
LOTSTEP = MarketInfo(Symb, MODE_LOTSTEP);
if (LOTSTEP <= 0)
return(false);
if (Money_Management > 0)
{
MARGINREQUIRED = MarketInfo(Symb, MODE_MARGINREQUIRED);
if (MARGINREQUIRED == 0.0)
return(false);
LotVel = GetFreeMargin()
* Money_Management / MARGINREQUIRED;
}
else
LotVel = MathAbs(Money_Management);
//---- íîðìèðîâàíèå âåëè÷èíû ëîòà äî áëèæàéøåãî ñòàíäàðòíîãî çíà÷åíèÿ
Lot = LOTSTEP * MathFloor(LotVel / LOTSTEP);
//----+ ïðîâåðêà ëîòà íà ìèíèìàëüíîå äîïóñòèìîå çíà÷åíèå
MINLOT = MarketInfo(Symb, MODE_MINLOT);
if (MINLOT < 0)
return(false);
if (Lot < MINLOT)
return(true);
//----+ ïðîâåðêà ëîòà íà ìàêñèìàëüíîå äîïóñòèìîå çíà÷åíèå
MAXLOT = MarketInfo(Symb, MODE_MAXLOT);
if (MAXLOT < 0)
return(false);
if (Lot > MAXLOT)
Lot = MAXLOT;
//----+ ïðîâåðêà âåëè÷èíû ëîòà íà äîñòàòî÷íîñòü ñðåäñòâ íà ñ÷¸òå
if (!MarginCheck(Symb, OP_BUY, Lot))
return(false);
if (Lot < MINLOT)
return(true);
//----
ask = NormalizeDouble(Ask, Digits);
if (ask == 0.0)
return(false);
//----
StLOSS = StopCorrect(Symb, STOPLOSS);
if (StLOSS < 0)
return(false);
//----
Stoploss = NormalizeDouble(ask - StLOSS * Point, Digits);
if (Stoploss < 0)
return(false);
//----
TkPROFIT = StopCorrect(Symb, TAKEPROFIT);
if (TkPROFIT < 0)
return(false);
//----
TakeProfit = NormalizeDouble(ask + TkPROFIT * Point, Digits);
if (TakeProfit < 0)
return(false);
Print(StringConcatenate
("Îòêðûâàåì ïî ", Symb,
" ïîçèöèþ íà ïîêóïêó ñ ìàãè÷åñêèì ÷èñëîì ", MagicNumber));
//----+ Îòêðûâàåì ïîçèöèþ íà ïîêóïêó
ticket=OrderSend(Symb, OP_BUY, Lot, ask, 3,
Stoploss, TakeProfit, NULL, MagicNumber, 0, Lime);
//----
if(ticket>0)
if (OrderSelect(ticket, SELECT_BY_TICKET))
{
BUY_Signal = false;
OpderPrice = DoubleToStr(OrderOpenPrice(), Digits);
Print(StringConcatenate(Symb, " BUY îðäåð ñ òèêåòîì ¹",
ticket, " è ìàãè÷åñêèì ÷èñëîì ", OrderMagicNumber(),
" îòêðûò ïî öåíå ",OpderPrice));
//----
LastTime = TimeCurrent();
return(true);
}
else
{
Print(StringConcatenate("Íå óäàëîñü îêðûòü ", Symb,
" BUY îðäåð ñ ìàãè÷åñêèì ÷èñëîì ", MagicNumber, "!!!"));
LastTime = TimeCurrent();
return(true);
}
return(true);
//----+
}
//+==================================================================+
//| OpenSellOrder1() |
//+==================================================================+
--- continuation similar to OpenBuyOrder()