Forex



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
 
Thread Tools Display Modes
  #741 (permalink)  
Old 07-01-2009, 05:49 AM
Junior Member
 
Join Date: Apr 2006
Posts: 26
Ricx is on a distinguished road
Quote:
Originally Posted by luxinterior View Post
I'm not too clear on your question but if you're trying to phsyically change an external variable so that it will show up in your paramenters as changed then you can't do that. However if you change the value of an external variable from within your EA it stays changed until you recall the init function by either changing time frames, re-entering your external variables by looking them and pusing SAVE etc.

Not sure what you want to achieve but maybe take a look at global variables or consider writing values to a file.

Good luck

Lux
you got it right lux, sorry for not so clear... im not programmer and just learning to code this

Yes i'm trying to write the Extern variable

thank you for the save idea i like it... i'll try to make the EA save then load it nice.
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
  #742 (permalink)  
Old 07-01-2009, 08:57 PM
Junior Member
 
Join Date: Dec 2008
Posts: 1
wizardt is on a distinguished road
previous indicator data

hi all just learning to write an ea and am using 2 moving averages my second moving average on my chart will aloow me to apply price from previous indicator data but i cant find a way to do this in the code. any help here would be greatly appreciated.
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
  #743 (permalink)  
Old 07-02-2009, 10:23 PM
Junior Member
 
Join Date: Jul 2009
Posts: 1
cpips is on a distinguished road
MA Levels put into EA code?

I can set MA Levels on my charts in the dialog box settings,
so how do I put the MA Levels into an EA line of code?
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
  #744 (permalink)  
Old 07-08-2009, 11:26 AM
Junior Member
 
Join Date: Oct 2008
Posts: 2
mobucksman is on a distinguished road
Red face help: back testing unexpected behaviour

I'm trying to write a very simple EA to execute one sell order at 09:00 hrs each day. When I backtest, it seems to execute multiple orders each day at 09:00hrs, between 1-7 orders per day. I was anticipating 1 order per day of the backtest data. I am testing against H1 data. Any help would be much appreciated:


extern double StopLossPips=100.0;
extern double TakeProfitPips=100.0;
extern double Lots=0.1;
int ticket;

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
if (TimeHour(TimeCurrent()) == 09 && TimeMinute(TimeCurrent()) == 00)
{
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+S topLossPips,Bid-TakeProfitPips*Point,"My EA",12345,0,Red);
}
//----
return(0);
}
//+------------------------------------------------------------------+

example output - why isn't it just one order for 2009.07.08?

2009.07.08 11:23:28 2009.07.07 09:00 aa_dev_eurchf_1400 EURUSD,H1: open #87 sell 0.10 EURUSD at 1.3936 sl: 101.3936 tp: 1.3836 ok
2009.07.08 11:23:28 2009.07.07 09:00 aa_dev_eurchf_1400 EURUSD,H1: open #86 sell 0.10 EURUSD at 1.3934 sl: 101.3934 tp: 1.3834 ok
2009.07.08 11:23:28 2009.07.07 09:00 aa_dev_eurchf_1400 EURUSD,H1: open #85 sell 0.10 EURUSD at 1.3935 sl: 101.3935 tp: 1.3835 ok
2009.07.08 11:23:28 2009.07.07 09:00 aa_dev_eurchf_1400 EURUSD,H1: open #84 sell 0.10 EURUSD at 1.3934 sl: 101.3934 tp: 1.3834 ok
2009.07.08 11:23:28 2009.07.07 09:00 aa_dev_eurchf_1400 EURUSD,H1: open #83 sell 0.10 EURUSD at 1.3935 sl: 101.3935 tp: 1.3835 ok
2009.07.08 11:23:28 2009.07.07 09:00 aa_dev_eurchf_1400 EURUSD,H1: open #82 sell 0.10 EURUSD at 1.3936 sl: 101.3936 tp: 1.3836 ok
2009.07.08 11:23:28 2009.07.07 09:00 aa_dev_eurchf_1400 EURUSD,H1: open #81 sell 0.10 EURUSD at 1.3935 sl: 101.3935 tp: 1.3835 ok
2009.07.08 11:23:28 2009.07.07 09:00 aa_dev_eurchf_1400 EURUSD,H1: open #80 sell 0.10 EURUSD at 1.3936 sl: 101.3936 tp: 1.3836 ok
2009.07.08 11:23:28 2009.07.07 09:00 aa_dev_eurchf_1400 EURUSD,H1: open #79 sell 0.10 EURUSD at 1.3935 sl: 101.3935 tp: 1.3835 ok
2009.07.08 11:23:28 2009.07.07 09:00 aa_dev_eurchf_1400 EURUSD,H1: open #78 sell 0.10 EURUSD at 1.3936 sl: 101.3936 tp: 1.3836 ok
2009.07.08 11:23:28 2009.07.07 09:00 aa_dev_eurchf_1400 EURUSD,H1: open #77 sell 0.10 EURUSD at 1.3935 sl: 101.3935 tp: 1.3835 ok
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
  #745 (permalink)  
Old 07-08-2009, 11:54 AM
Senior Member
 
Join Date: Nov 2006
Posts: 305
luxinterior is on a distinguished road
You need to count the number of total orders for the current symbol that have the same magic number as the EA and if it's more than one don't open any more. Take a look in some EA's you already have and you'll find numerous examples of counting orders.

Good luck

Lux
__________________
Build An Expert Advisor. FREE E-course As Seen On TV
ForexArea.com
Users of Gap Trader from 'Forex-Assistant' MUST Read This
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
  #746 (permalink)  
Old 07-13-2009, 12:00 PM
Junior Member
 
Join Date: Jun 2009
Posts: 4
Smith23 is on a distinguished road
open/close position on EMA's

Hi everyone

I'm newbie and I have another question about EA, i learned all lesson from codersguru and change a code a little bit for not using Trailing Stop, just open / close position when short EMA crosses long EMA, and I have one problem because the EA does not reverse the position. How to make code which would at the same time close Buy and open Sell ? ?

Modified code in attachment


Thanks in advance for help !
Attached Files
File Type: mq4 My_First_EA.mq4 (3.8 KB, 6 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
  #747 (permalink)  
Old 07-13-2009, 03:59 PM
Senior Member
 
Join Date: Apr 2008
Location: Rawalpindi
Posts: 106
arshadFX is on a distinguished road
Quote:
Originally Posted by Smith23 View Post
Hi everyone

I'm newbie and I have another question about EA, i learned all lesson from codersguru and change a code a little bit for not using Trailing Stop, just open / close position when short EMA crosses long EMA, and I have one problem because the EA does not reverse the position. How to make code which would at the same time close Buy and open Sell ? ?

Modified code in attachment


Thanks in advance for help !
Read these articles very helpful.
MQL4 Language for Newbies. Introduction - MQL4 Articles
MQL4 Language for Newbies. Difficult Questions in Simple Phrases. - MQL4 Articles
& follow the link there are 3-4 more grate articles
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
  #748 (permalink)  
Old 07-14-2009, 07:37 PM
Junior Member
 
Join Date: Jun 2009
Posts: 2
vendetta is on a distinguished road
MQL4 Programming Help

Hey Guys,

Been lurking here now for a while, really nice forum you've put together.

I was wondering if anyone can point me to someplace ie: a forum, website etc., or to someone who can help me with some small programming issues?

I've submitted my question on several forums and even the mql4.com website but I can't seem to find any programmers that are willing to help anyone.

If someone could point me in the right direction, or if anyone is willing to answer a couple programming questions please PM me.

Thanks a bunch.

TS
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
  #749 (permalink)  
Old 07-14-2009, 07:51 PM
Junior Member
 
Join Date: Jun 2009
Posts: 3
mach26 is on a distinguished road
Building on the previous post

Yes, I too would like to either (a) learn how to write indicators/EA's in MT4 or (b) tell someone what I need and get them written. The main issue is that I tend to use about 6 major indicators over the main currencies. It would be helpful if instead of sounds, I could get a visual alert telling me the pair and necessary action, better would be switching to the chart concerned. Most mistakes are made because you either miss the activator or you forget the entry procedure. Any help welcome
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
  #750 (permalink)  
Old 07-15-2009, 01:17 AM
Linuxser's Avatar
User Root
 
Join Date: May 2006
Location: Helliconia (Winter)
Posts: 4,407
Blog Entries: 56
Linuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond repute
You have this section (current) and this section Metatrader Programming - Forex Trading. For both, make questions and to learn
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
automated close order, close, eas, forex, learn mql4, learn mql4 video, learning mql4, mini std lotsize risk, mql4 ima, mql4 learning, mql4 video, OrderCloseBy, profit, reach, secure profit function, T101_v1.11_orest_IBFXm.mq4

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
Learning Cycles For New Traders Dan7974 General Discussion 350 01-18-2008 07:04 PM
Learning to code for autotrading GoatT Metatrader Programming 8 01-10-2007 09:55 PM
Self learning expert mrtools Expert Advisors - Metatrader 4 32 10-22-2006 06:29 PM


All times are GMT. The time now is 08:01 PM.



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