Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
If we assumed that the EX4 will not be decompiled then the best way is Client - Server Authentication!
Where the MetaTrader connects to a DLL
the DLL connects to a Server (web server build in PHP)
the Server connects to a database to check the user data (account number - reg number - trial period etc)
This is the perfect method providing the cracker will not crack the EX4 and know the idea of the indicator or the expert advisor!
Quote:
Originally Posted by cja
This works by allowing the indicator or EA to work only on 1 account, sample of code in mq4 posted below, this works but there may be a better way to do it ???
void CloseOrder(int minutes)
{
int total = OrdersTotal();
for (int cnt = 0 ; cnt < total ; cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if ((CurTime()-OrderOpenTime())>minutes*60)
{
if(OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots(),Bid,Slippage, Violet);
if(OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),Ask,Slippage, Violet);
}
}
}
This is code that I am trying to incorporate into an EA but am having problems when compiling. I get this error: Function "CloseOrder" is not referenced and will be removed from exp-file
This code was posted by codersguru from this post: How to close trades after a certain amount of time has passed
What I am trying to do is to develop a system that will close all trades after x amount of time since opening of the most recent trade.
I have very little knowledge in coding but am trying to learn.
If this type of problem has been addressed before then could someone please point me to the proper thread as I have not been able to find one on this forum using the search function. Thank you.
void CloseOrder(int minutes)
{
int total = OrdersTotal();
for (int cnt = 0 ; cnt < total ; cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if ((CurTime()-OrderOpenTime())>minutes*60)
{
if(OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots(),Bid,Slippage, Violet);
if(OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),Ask,Slippage, Violet);
}
}
}
This is code that I am trying to incorporate into an EA but am having problems when compiling. I get this error: Function "CloseOrder" is not referenced and will be removed from exp-file
This code was posted by codersguru from this post: How to close trades after a certain amount of time has passed
What I am trying to do is to develop a system that will close all trades after x amount of time since opening of the most recent trade.
I have very little knowledge in coding but am trying to learn.
If this type of problem has been addressed before then could someone please point me to the proper thread as I have not been able to find one on this forum using the search function. Thank you.
It's easy: the code above is a function, so you need to call it somewhere. If you never call it, this function will never run, so it's useless to keep it in the compiled file; that's the meaning of the error you get.
i'm using an ea, and i always received the error on the meta journal like this:
12:11:32 Old tick USDJPY30 110.77000/110.80000
12:11:32 Old tick USDJPY240 110.77000/110.80000
12:41:07 Old tick EURUSD30 1.46730/1.46760
12:41:07 Old tick EURUSD240 1.46730/1.46760
13:40:33 Old tick USDJPY30 110.90000/110.93000
13:40:33 Old tick USDJPY240 110.90000/110.93000
i already reinstall the metatrader,and still got the error
what can i do to solve this problem ?
I wonder if there's a way to remove the banner, coz it sometimes block view from other indicator.
Too bad, it's .ex4
The indicator, I attached below
You can ask cja to make it smaller on this thread Signal_Bars_v7
Why cja is posting ex4 codes only with banner - please read those 2 threads: eBay Interesting ????
It's easy: the code above is a function, so you need to call it somewhere. If you never call it, this function will never run, so it's useless to keep it in the compiled file; that's the meaning of the error you get.
I tried this but get a big '0' value on the graph. How do I get the indicator to place the spread on the graph of the currency it is being overlayed on?
Your wisdom and knowledge is needed!
Dave
Dave,
The problem is with this line of code.
ObjectSetText("Spread_Label", DoubleToStr(spread,0), 14, "Ariel", Yellow);
When using DoubleToStr the second option is rounding, ie how many decimal places to round to. In your case you are rounding a two or 4 decimal place number back to "Zero" decimal places.
See Below:
string DoubleToStr( double value, int digits)
Returns text string with the specified numerical value converted into a specified precision format.
Parameters:
value - Floating point value.
digits - Precision format, number of digits after decimal point (0-8).
The correct code should read:
ObjectSetText("Spread_Label", DoubleToStr(spread,Digits), 14, "Ariel", Yellow);
NOTE: Digits is an internal function that returns the number of decimal places for the current symbol.
This should now show you the Spread.
Cheers,
Hiachiever
Last edited by hiachiever; 01-18-2008 at 09:55 PM.