Forex
Google
New signals service!

Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-02-2007, 02:37 PM
matrixebiz's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 1,159
matrixebiz is on a distinguished road
Function not referenced warning ?

hello, when I complie an EA I get warnings like;
Function "CloseTheseTrades" is not referenced and will be removed from exp-file

is there a way to fix? or does it matter? Do I just have to define them? if so what is the code?

Thank you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-02-2007, 03:15 PM
HerbertH's Avatar
Member
 
Join Date: May 2006
Posts: 88
HerbertH is on a distinguished road
Warnings

It means that the compiler notices that pieces of code are not being used.
The warnings you see are just optimisation messages; the compiler will not include these functions in the created executable.

The original programmer may have had several reasons for writing these (now non-used) functions in the first place, but technically speaking, your expert will work without them.
__________________
Better being out, wishing to be in than being in and wishing to be out.....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-02-2007, 03:27 PM
matrixebiz's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 1,159
matrixebiz is on a distinguished road
Quote:
Originally Posted by HerbertH View Post
It means that the compiler notices that pieces of code are not being used.
The warnings you see are just optimisation messages; the compiler will not include these functions in the created executable.

The original programmer may have had several reasons for writing these (now non-used) functions in the first place, but technically speaking, your expert will work without them.
Ok, thanks. is it because the main secction of code was voided but the bottom line wasn't voided with it?
This is more of the code that references
void CloseLoosingTrades() { // included by Renato
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if ( (OrderSymbol()==Symbol()) && (OrderMagicNumber()==MagicfromSymbol()) && (OrderComment()==GetCommentForOrder()) ) {
if (OrderType()==OP_BUY)
if ( iFXAnalyser(240,MODE_DIV,0)<-DVLimit*Point )
OrderClose(OrderTicket(),OrderLots(),Bid,GetSlippage(),clCloseBuy);
if (OrderType()==OP_SELL)
if ( iFXAnalyser(240,MODE_DIV,0)>DVLimit*Point )
OrderClose(OrderTicket(),OrderLots(),Ask,GetSlippa ge(),clCloseSell);

double GetSlippage() { return((Ask-Bid)/Point); }
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-02-2007, 03:31 PM
HerbertH's Avatar
Member
 
Join Date: May 2006
Posts: 88
HerbertH is on a distinguished road
No, void here means that the function is not supposed to return anything to it's caller.
Don't worry, the function "CloseLoosingTrades" is just never being used anywhere in the main code, that's all.
__________________
Better being out, wishing to be in than being in and wishing to be out.....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-02-2007, 03:42 PM
matrixebiz's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 1,159
matrixebiz is on a distinguished road
Quote:
Originally Posted by HerbertH View Post
No, void here means that the function is not supposed to return anything to it's caller.
Don't worry, the function "CloseLoosingTrades" is just never being used anywhere in the main code, that's all.
Ok, thanks for the info. Could I be safe then in removing the code? I just like having the 0 Errors and 0 warrnings show
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 08-02-2007, 04:05 PM
HerbertH's Avatar
Member
 
Join Date: May 2006
Posts: 88
HerbertH is on a distinguished road
Comment unwanted code

Quote:
Originally Posted by matrixebiz View Post
Ok, thanks for the info. Could I be safe then in removing the code? I just like having the 0 Errors and 0 warrnings show
To save you from having to put it back if you remove too much:
Just surround the code by multi-line comment /* ... */ like the example below.

Code:
/*

void CloseLoosingTrades() { // included by Renato
{   ...
   ...

}

*/
__________________
Better being out, wishing to be in than being in and wishing to be out.....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 08-02-2007, 04:37 PM
Senior Member
 
Join Date: Nov 2006
Location: Ukraine
Posts: 491
Shinigami is on a distinguished road
Quote:
Originally Posted by matrixebiz View Post
Ok, thanks for the info. Could I be safe then in removing the code? I just like having the 0 Errors and 0 warrnings show
Can you ever be safe if you remove "close losing orders" from the code???
You can! If your aim is to blow up the account
__________________
MQL4 programming is easy ^^
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 08-02-2007, 05:25 PM
HerbertH's Avatar
Member
 
Join Date: May 2006
Posts: 88
HerbertH is on a distinguished road
Quote:
Originally Posted by Shinigami View Post
Can you ever be safe if you remove "close losing orders" from the code???
You can! If your aim is to blow up the account
Shinigami, stop scaring the man. (He is wise enough to demo first, I am sure..)
There might be dozens of unused functions which have nothing to with the code this expert is using. It could even contain much worse code that we are unaware of.
You and I do not know the functionality of this expert, so we cannot tell if this function is realy needed.

If you do not agree, would you be so kind to tell him where to put the call to this routine, without having seen any of this experts code....?

Cheers
__________________
Better being out, wishing to be in than being in and wishing to be out.....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 08-02-2007, 05:27 PM
matrixebiz's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 1,159
matrixebiz is on a distinguished road
Ok, I'll just leave it the way it is
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 08-02-2007, 08:08 PM
Senior Member
 
Join Date: Nov 2006
Location: Ukraine
Posts: 491
Shinigami is on a distinguished road
Quote:
Originally Posted by matrixebiz View Post
Ok, I'll just leave it the way it is
That piece of code is not used for some reason. If it is not used, it can be:
removed
commented out

In either case things won't change.
But I'm saying that if there is some function that is not used, take a look at the logic of the EA. Maybe its actually a bug?
__________________
MQL4 programming is easy ^^
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Warning about Interbankfx efextrader General Discussion 67 10-05-2007 03:33 PM
WARNING: note about saving files in MetaEditor phazei Metatrader 4 7 08-12-2006 09:31 AM
Warning : Do not update to 187 ahwai General Discussion 27 03-19-2006 04:04 PM


All times are GMT. The time now is 11:02 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.