Edit Your Comment
Undeclared identifier error
Tham gia từ Sep 04, 2014
25bài viết
Mar 08, 2015 at 07:45
Tham gia từ Sep 04, 2014
25bài viết
Hello, could someone help me?
I have undeclared identifier line 128. I don't know how to fix it.
Thank you
//+------------------------------------------------------------------+
//| escape.mq4 |
//| Copyright © 2009, OGUZ BAYRAM |
//| [email protected] |
//+------------------------------------------------------------------+
extern double lTakeProfit = 10;
extern double sTakeProfit = 10;
extern double lStopLoss = 1000;
extern double sStopLoss = 1000;
extern color clOpenBuy = Green;
extern color clOpenSell = Red;
extern string Name_Expert = 'escape';
extern int Slippage = 1;
extern bool UseSound = false;
extern string NameFileSound = 'Alert.wav';
extern int maxOpenPositions = 70;
extern int tbet = 5;
extern int premier = 5;
extern int deuxieme = 5;
extern int Magic = 11111;
void deinit() {
}
//+------------------------------------------------------------------+
// |
datetime nextRun;
int start(){
double Account_Equity = AccountEquity();
double Lots = (Account_Equity*0.00001);
Comment(Lots);
if( nextRun > TimeCurrent() ) return(0);
nextRun = TimeCurrent() + tbet;
if(Bars<50){
Print('bars less than 50');
return(0);
}
if(lTakeProfit<1){
Print('TakeProfit less than 1');
return(0);
}
if(sTakeProfit<1){
Print('TakeProfit less than 1');
return(0);
}
double diClose0=iClose(NULL,5,0);
double diMA1=iMA(NULL,premier,deuxieme,0,MODE_SMA,PRICE_OPEN,1);
double diClose2=iClose(NULL,5,0);
double diMA3=iMA(NULL,premier,deuxieme,0,MODE_SMA,PRICE_OPEN,1);
if(AccountFreeMargin()<(150*Lots)){
Print('We have no money. Free Margin = ', AccountFreeMargin());
return(0);
}
if (!ExistPositions()){
if ((diClose0<diMA1)){
OpenBuy();
return(0);
}
if ((diClose2>diMA3)){
OpenSell();
return(0);
}
}
return (0);
}
bool ExistPositions() {
for (int i=maxOpenPositions; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol()) {
return(True);
}
}
}
return(false);
}
void OpenBuy() {
double ldLot, ldStop, ldTake;
string lsComm;
ldLot = GetSizeLot();
ldStop = GetStopLossBuy();
ldTake = GetTakeProfitBuy();
lsComm = GetCommentForOrder();
OrderSend(Symbol
(),OP_BUY,ldLot,Ask,Slippage,ldStop,ldTake,lsComm,0,0,clOpenBuy);
if (UseSound) PlaySound(NameFileSound);
}
void OpenSell() {
double ldLot, ldStop, ldTake;
string lsComm;
ldLot = GetSizeLot();
ldStop = GetStopLossSell();
ldTake = GetTakeProfitSell();
lsComm = GetCommentForOrder();
OrderSend(Symbol
(),OP_SELL,ldLot,Bid,Slippage,ldStop,ldTake,lsComm,0,0,clOpenSell);
if (UseSound) PlaySound(NameFileSound);
}
string GetCommentForOrder() { return(Name_Expert); }
double GetSizeLot()
{ return(Lots); }
double GetTakeProfitBuy() { return(Ask+lTakeProfit*Point); }
double GetTakeProfitSell() { return(Bid-sTakeProfit*Point); }
double GetStopLossBuy() { return(Bid-lStopLoss*Point); }
double GetStopLossSell() { return(Ask+sStopLoss*Point); }
I have undeclared identifier line 128. I don't know how to fix it.
Thank you
//+------------------------------------------------------------------+
//| escape.mq4 |
//| Copyright © 2009, OGUZ BAYRAM |
//| [email protected] |
//+------------------------------------------------------------------+
extern double lTakeProfit = 10;
extern double sTakeProfit = 10;
extern double lStopLoss = 1000;
extern double sStopLoss = 1000;
extern color clOpenBuy = Green;
extern color clOpenSell = Red;
extern string Name_Expert = 'escape';
extern int Slippage = 1;
extern bool UseSound = false;
extern string NameFileSound = 'Alert.wav';
extern int maxOpenPositions = 70;
extern int tbet = 5;
extern int premier = 5;
extern int deuxieme = 5;
extern int Magic = 11111;
void deinit() {
}
//+------------------------------------------------------------------+
// |
datetime nextRun;
int start(){
double Account_Equity = AccountEquity();
double Lots = (Account_Equity*0.00001);
Comment(Lots);
if( nextRun > TimeCurrent() ) return(0);
nextRun = TimeCurrent() + tbet;
if(Bars<50){
Print('bars less than 50');
return(0);
}
if(lTakeProfit<1){
Print('TakeProfit less than 1');
return(0);
}
if(sTakeProfit<1){
Print('TakeProfit less than 1');
return(0);
}
double diClose0=iClose(NULL,5,0);
double diMA1=iMA(NULL,premier,deuxieme,0,MODE_SMA,PRICE_OPEN,1);
double diClose2=iClose(NULL,5,0);
double diMA3=iMA(NULL,premier,deuxieme,0,MODE_SMA,PRICE_OPEN,1);
if(AccountFreeMargin()<(150*Lots)){
Print('We have no money. Free Margin = ', AccountFreeMargin());
return(0);
}
if (!ExistPositions()){
if ((diClose0<diMA1)){
OpenBuy();
return(0);
}
if ((diClose2>diMA3)){
OpenSell();
return(0);
}
}
return (0);
}
bool ExistPositions() {
for (int i=maxOpenPositions; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol()) {
return(True);
}
}
}
return(false);
}
void OpenBuy() {
double ldLot, ldStop, ldTake;
string lsComm;
ldLot = GetSizeLot();
ldStop = GetStopLossBuy();
ldTake = GetTakeProfitBuy();
lsComm = GetCommentForOrder();
OrderSend(Symbol
(),OP_BUY,ldLot,Ask,Slippage,ldStop,ldTake,lsComm,0,0,clOpenBuy);
if (UseSound) PlaySound(NameFileSound);
}
void OpenSell() {
double ldLot, ldStop, ldTake;
string lsComm;
ldLot = GetSizeLot();
ldStop = GetStopLossSell();
ldTake = GetTakeProfitSell();
lsComm = GetCommentForOrder();
OrderSend(Symbol
(),OP_SELL,ldLot,Bid,Slippage,ldStop,ldTake,lsComm,0,0,clOpenSell);
if (UseSound) PlaySound(NameFileSound);
}
string GetCommentForOrder() { return(Name_Expert); }
double GetSizeLot()
{ return(Lots); }
double GetTakeProfitBuy() { return(Ask+lTakeProfit*Point); }
double GetTakeProfitSell() { return(Bid-sTakeProfit*Point); }
double GetStopLossBuy() { return(Bid-lStopLoss*Point); }
double GetStopLossSell() { return(Ask+sStopLoss*Point); }
luclevesque17@
Tham gia từ Nov 21, 2011
1718bài viết
Mar 08, 2015 at 10:15
Tham gia từ Nov 21, 2011
1718bài viết
string GetCommentForOrder() { return(Name_Expert); }
double GetSizeLot()
{ double Lots; return(Lots); }
double GetSizeLot()
{ double Lots; return(Lots); }
Tham gia từ Sep 04, 2014
25bài viết
Mar 08, 2015 at 10:56
Tham gia từ Sep 04, 2014
25bài viết
Thanks a lot Crazy Trader!
luclevesque17@
*Nghiêm cấm sử dụng cho mục đích thương mại và spam, nếu vi phạm có thể dẫn đến việc chấm dứt tài khoản.
Mẹo: Đăng ảnh/url youtube sẽ tự động được nhúng vào bài viết của bạn!
Mẹo: Dùng @ để tự động điền tên người dùng tham gia vào cuộc thảo luận này.