Forex
Google
New signals service!

Go Back   Forex Trading > Programming > Metatrader Programming


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 (1) Thread Tools Display Modes
  #1301 (permalink)  
Old 09-25-2008, 03:11 PM
Senior Member
 
Join Date: Feb 2007
Posts: 947
FerruFx is on a distinguished road
Quote:
Originally Posted by Dave137 View Post
In my setup I use:
PHP Code:
extern Bool Show_Settings=True
//Then in coding I use:

PHP Code:
if(Show_Settings==truesubPrintDetails(); 
//Later in Coding I use:

void subPrintDetails()

PHP Code:
{
void subPrintDetails()

   
string sComment   "";
   
string sp         "----------------------------------------\n";
   
string NL         "\n";
   
sComment sComment "                           "+NL;
   
sComment sComment "RSI1   =   " DoubleToStr(RSI1,Digits) + NL;
   
sComment sComment "RSI1_1 =  " DoubleToStr(RSI1_1,Digits) + NL;
   
   
Comment(sComment);
   
return;


When I change the bool setting to false, the comments still show. If I reboot the program, the comments do not show??? How can I fix this where I can toggle back and forth the comment display in the expert setup window??

David
Modify like this:

if(Show_Settings) subPrintDetails(); else Comment("");

FerruFx
__________________
THE HEART of FOREX & THE PROBABILITY METER - Trade with 100% confidence and ... Stress Less!!!
Coding services: Experts Advisors, indicators, alerts, etc ... more info by PM
NEW: video presentation of the Probability Meter ... 24hrs action on the website
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1302 (permalink)  
Old 09-26-2008, 07:39 PM
Junior Member
 
Join Date: May 2006
Posts: 12
mach_one_man is on a distinguished road
EA variable values lost when closing MT4

Hello All,

I have searched and tried a number of solutions to my question, but can't find any that work.

I am programming an EA and the trades are handled by their ticket numbers. Ticket numbers are stored in an int variable. This runs fine in Strategy Tester or on a continuous uninterrupted MT4, however if you close MT4, ofcourse the tickets are lost and when MT4 reloads, the ticket numbers have been lost, hence the EA doesn't know which trades are currently open and starts to open new ones. Even if the pending or open orders are already trading.

I hope this makes sense.

I have tried static variables and I do know about global variables, but I would prefer not to use them, as each ticket number and variable wants to be individual to the chart TF and Symbol the EA is running on.

Does anyone have a simple solution. I do know that you could probably export the ticket numbers to a file that the EA can then open and read, but this seems a long way around. A not so neat way I am currently testing is on program start to use the SELECT_BY_POS function, looking for each trade with a Magic number the same, but this doesn't allow the full functionality of the EA I as I sometimes run 2 buys at the same time and identifiying which is which is hard.

Thanks for any replies.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1303 (permalink)  
Old 09-27-2008, 01:13 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 722
wolfe is on a distinguished road
Quote:
Originally Posted by mach_one_man View Post
Hello All,

I have searched and tried a number of solutions to my question, but can't find any that work.

I am programming an EA and the trades are handled by their ticket numbers. Ticket numbers are stored in an int variable. This runs fine in Strategy Tester or on a continuous uninterrupted MT4, however if you close MT4, ofcourse the tickets are lost and when MT4 reloads, the ticket numbers have been lost, hence the EA doesn't know which trades are currently open and starts to open new ones. Even if the pending or open orders are already trading.

I hope this makes sense.

I have tried static variables and I do know about global variables, but I would prefer not to use them, as each ticket number and variable wants to be individual to the chart TF and Symbol the EA is running on.

Does anyone have a simple solution. I do know that you could probably export the ticket numbers to a file that the EA can then open and read, but this seems a long way around. A not so neat way I am currently testing is on program start to use the SELECT_BY_POS function, looking for each trade with a Magic number the same, but this doesn't allow the full functionality of the EA I as I sometimes run 2 buys at the same time and identifiying which is which is hard.

Thanks for any replies.
Instead of ticket numbers, try keeping track of your orders using magic numbers. This is the best way that I have found.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1304 (permalink)  
Old 09-27-2008, 02:21 AM
Senior Member
 
Join Date: Oct 2007
Posts: 223
Dave137 is on a distinguished road
Smile

Quote:
Originally Posted by FerruFx View Post
Modify like this:

if(Show_Settings) subPrintDetails(); else Comment("");

FerruFx
Thanks a bunch!! I will test it Sunday evening. I really appreciate your assistance! Have a nice weekend!

Dave
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1305 (permalink)  
Old 09-27-2008, 04:27 AM
Junior Member
 
Join Date: Jul 2007
Posts: 1
Stingray2 is on a distinguished road
EA modification

Hello

Would very much appreciate if someone could help me out. There is this EA I got from another FX forum. It looks great but would appreciate if someone can help make some modifications on it.
I have tried the little I think I know but it keeps giving me errors of unbalanced brackets e.t.c
The EA opens 5lots and takes profit of 1 lot each at a specified incremental value (say 50 points/pips). So it closes 1 lot each time the profit increases by a specified number and finally allows the fifth/last lot to run till there is an opposite signal.

Modifications:

I want it to open only 3 lots,
Close 1 lot each as profit increases at a specified no. of pips
After the first two Take profit points have been reached, a trailing Stop should be used for the third.

Illustration:
3 lots
Incremental TP point= 40 pips

1st lot TP = 40, stoploss moved to BE
2nd lot TP= 80
3rd lot = Trailing stop activated

Every other thing is already in the EA, but I just need to change the lot size and add a trailing stop.

Thanks
Attached Files
File Type: txt Stoch AC.txt (6.5 KB, 0 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1306 (permalink)  
Old 09-27-2008, 04:42 PM
Senior Member
 
Join Date: Feb 2007
Posts: 947
FerruFx is on a distinguished road
Quote:
Originally Posted by Dave137 View Post
Thanks a bunch!! I will test it Sunday evening. I really appreciate your assistance! Have a nice weekend!

Dave
You're welcome Dave. Enjoy your sunday!

FerruFx
__________________
THE HEART of FOREX & THE PROBABILITY METER - Trade with 100% confidence and ... Stress Less!!!
Coding services: Experts Advisors, indicators, alerts, etc ... more info by PM
NEW: video presentation of the Probability Meter ... 24hrs action on the website
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1307 (permalink)  
Old 10-01-2008, 03:49 AM
Member
 
Join Date: Jun 2008
Posts: 72
MoreYummy is on a distinguished road
drawing a line and draw a up/down arrow on a candle

Im tring to program a very simple indicator to draw a line and draw a up/down arrow on a candle.

I cant figure out how to use those style, index, draw etc.

I have a very simple if statement inside Start(), so what else do I need to add before Start(), and within Start()'s if, to draw a line, and up arrow, and down arrow?

Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1308 (permalink)  
Old 10-02-2008, 03:43 AM
Senior Member
 
Join Date: Feb 2007
Posts: 947
FerruFx is on a distinguished road
Quote:
Originally Posted by MoreYummy View Post
Im tring to program a very simple indicator to draw a line and draw a up/down arrow on a candle.

I cant figure out how to use those style, index, draw etc.

I have a very simple if statement inside Start(), so what else do I need to add before Start(), and within Start()'s if, to draw a line, and up arrow, and down arrow?

Thanks.
Before trying to draw with some conditions in the Start() function, you have to set/initialyze the buffers[].

Code an indicator isn't a simple job. You may have to learn some basics of mql coding.

Wish you all the best in your learning process.

FerruFx
__________________
THE HEART of FOREX & THE PROBABILITY METER - Trade with 100% confidence and ... Stress Less!!!
Coding services: Experts Advisors, indicators, alerts, etc ... more info by PM
NEW: video presentation of the Probability Meter ... 24hrs action on the website
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1309 (permalink)  
Old 10-02-2008, 03:27 PM
Member
 
Join Date: Dec 2005
Posts: 62
LazyForex is on a distinguished road
help

Hello Fellow Programmers,

I have an EA that trades on EURUSD when I attach it to the EURUSD chart. Question is how can I trade multiple pairs without having to attach my EA to multiple charts?

Something like this?

string pairs = "GBPUSD;EURUSD;USDCHF;USDJPY;USDCAD;GBPJPY;EURJPY; GBPCHF;EURAUD;EURCHF;EURGBP;AUDUSD;CHFJPY";

Thanks in advance,

LF
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1310 (permalink)  
Old 10-02-2008, 05:44 PM
Member
 
Join Date: Jun 2008
Posts: 72
MoreYummy is on a distinguished road
Have your code to trade specific pair when you send your order, it is very simple, right in the documentation.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
candle time, CHinGsMAroonCLK, coders guru, expert advisor, forex, how to code, I_XO_A_H, mechanical trading, trading

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

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/metatrader-programming/554-how-code.html
Posted By For Type Date
Need an experienced programmer? - Page 2 Post #0 Refback 09-24-2008 07:24 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to code this? iscuba11 Metatrader 4 mql 4 - Development course 1 08-03-2007 05:22 PM


All times are GMT. The time now is 09:44 AM.



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