Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course > Questions
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
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.
See more

Reply
 
Thread Tools Display Modes
  #931 (permalink)  
Old 01-17-2008, 01:27 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Wink Client - Server Authentication!

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 View Post
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 ???

int Account = 12345;

if (Account != AccountNumber()){
Comment("Incorrect account : "+AccountNumber()+" Price Display Indicator Deactivated !");
return(0);
}else {Comment(" Price Display Indicator Activated");}


Attachment 52095
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #932 (permalink)  
Old 01-17-2008, 09:08 PM
Junior Member
 
Join Date: Dec 2007
Posts: 2
RaidenDSI is on a distinguished road
Help with coding

Can anyone help me with this code:

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #933 (permalink)  
Old 01-17-2008, 11:17 PM
Senior Member
 
Join Date: Feb 2006
Posts: 587
Michel is on a distinguished road
Quote:
Originally Posted by RaidenDSI View Post
Can anyone help me with this code:

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #934 (permalink)  
Old 01-18-2008, 02:55 AM
TheRumpledOne's Avatar
Banned
 
Join Date: Nov 2006
Posts: 802
TheRumpledOne is an unknown quantity at this point
Drop Down Menu For Inputs

Is there a way to code a dropdown menu for indicator inputs?

For example, if the input was myPeriod, I would like to have:

PERIOD_M1
PERIOD_M5
.
.
.
PERIOD_W1
PERIOD_MN1

appear.

Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #935 (permalink)  
Old 01-18-2008, 04:10 AM
Junior Member
 
Join Date: Dec 2007
Posts: 3
zeptron is on a distinguished road
can u tell me....

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 ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #936 (permalink)  
Old 01-18-2008, 06:48 AM
ANCOLL's Avatar
Senior Member
 
Join Date: Nov 2006
Location: Indonesia
Posts: 252
ANCOLL is on a distinguished road
I wonder..

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
Attached Files
File Type: ex4 #Signal_Bars_v71.ex4 (46.2 KB, 19 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #937 (permalink)  
Old 01-18-2008, 07:14 AM
Administrator
 
Join Date: Sep 2005
Posts: 20,058
Blog Entries: 241
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
Quote:
Originally Posted by ANCOLL View Post
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 ????
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #938 (permalink)  
Old 01-18-2008, 03:00 PM
Junior Member
 
Join Date: Dec 2007
Posts: 2
RaidenDSI is on a distinguished road
Quote:
Originally Posted by Michel View Post
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 figured it out and got it working. Thank you.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #939 (permalink)  
Old 01-18-2008, 09:49 PM
Member
 
Join Date: Jan 2006
Posts: 59
hiachiever is on a distinguished road
Need to use Digits

Quote:
Originally Posted by Dave137 View Post
PHP Code:

#property indicator_chart_window


double spread=Ask-Bid;
   
 
   
{
  
   
ObjectCreate("Spread_Label"OBJ_LABEL000);
   
ObjectSetText("Spread_Label"DoubleToStr(spread,0), 14"Ariel"Yellow);
   
ObjectSet("Spread_Label"OBJPROP_CORNER3);
   
ObjectSet("Spread_Label"OBJPROP_XDISTANCE50);
   
ObjectSet("Spread_Label"OBJPROP_YDISTANCE55);
  } 
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #940 (permalink)  
Old 01-18-2008, 09:55 PM
TheRumpledOne's Avatar
Banned
 
Join Date: Nov 2006
Posts: 802
TheRumpledOne is an unknown quantity at this point
Quote:
Originally Posted by ANCOLL View Post
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
Yes, I wrote and posted code so you can build your own meters.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks

Tags
forex, histogram, JMASlope, ToR 1.20, ZUP_v1.mq4


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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


All times are GMT. The time now is 06:15 AM.



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