Forex



Go Back   Forex Trading > Programming > MetaTrader
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
  #981 (permalink)  
Old 06-04-2008, 02:05 PM
Member
 
Join Date: Mar 2008
Posts: 46
mauro269 is on a distinguished road
Need the code to stop the open of positions after a certain time

I've already seen all the posts in this section and I've made a research on all the forum using the google search tool at the top of the forum, but what I've found is not exactly what I'm looking for.

What I need is a code that I have to implement in my EA that stops to open new position after a certain hour, for example after 15 GMT. This parameter should be a setting that I can modify from the user panel.
It would be great if I could set a period of time in which the EA can open the positions, so

Open from X hours until Y hours

Thanks for your help.
Regards
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
  #982 (permalink)  
Old 06-04-2008, 04:40 PM
Senior Member
 
Join Date: Feb 2007
Posts: 986
FerruFx is on a distinguished road
Quote:
Originally Posted by mauro269 View Post
I've already seen all the posts in this section and I've made a research on all the forum using the google search tool at the top of the forum, but what I've found is not exactly what I'm looking for.

What I need is a code that I have to implement in my EA that stops to open new position after a certain hour, for example after 15 GMT. This parameter should be a setting that I can modify from the user panel.
It would be great if I could set a period of time in which the EA can open the positions, so

Open from X hours until Y hours

Thanks for your help.
Regards
Here's how I do:

Quote:
extern bool Use.Time.Filter = false;
extern string Server.Time.To.Start = "08:00";
extern string Server.Time.To.Stop = "16:00";
Quote:
start_time = StrToTime(TimeToStr(TimeCurrent(), TIME_DATE) + " " + Server.Time.To.Start);
end_time = StrToTime(TimeToStr(TimeCurrent(), TIME_DATE) + " " + Server.Time.To.Stop);

if(Use.Time.Filter && (TimeCurrent() < start_time || TimeCurrent() >= end_time)) return(0);
Hope that helps.

FerruFx
__________________
FerruFx / www.ervent.net - Professional Coding Services (EAs/Indicators/Alerts)

BBVPS.com - Reliable Windows VPS For MT4 Hosting
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
  #983 (permalink)  
Old 06-04-2008, 07:06 PM
Member
 
Join Date: Mar 2008
Posts: 46
mauro269 is on a distinguished road
Thanks Ferru, this is what I needed!

You are great!
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
  #984 (permalink)  
Old 06-04-2008, 09:00 PM
Senior Member
 
Join Date: Jun 2006
Posts: 278
giapel is on a distinguished road
translate this metastock-function

hi,
can you code this function in mql from metastock-language ?

ThroughtBars(1,MACD(),29)

thanks in advance

giapel
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
  #985 (permalink)  
Old 06-04-2008, 09:46 PM
Junior Member
 
Join Date: Aug 2007
Posts: 8
Matrix 78 is on a distinguished road
I use trend envelope but during up movement the buffer about trendenvelope short write 254564115 strange number so i use a simple code to put it at zero, there is another way withouth force it to 0?

Code:
TrendEnvUp         = iCustom(NULL,0,IndicatorName4,2,0,0,0,0,0,0,0); // trendenvelopes 
   TrendEnvDown         = iCustom(NULL,0,IndicatorName4,2,0,0,0,0,0,1,0); // trendenvelopes 
   
   if (TrendEnvUp > 10)
       TrendEnvUp=0; 
   if (TrendEnvDown > 10)
       TrendEnvDown=0;
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
  #986 (permalink)  
Old 06-04-2008, 10:20 PM
Member
 
Join Date: Mar 2008
Posts: 46
mauro269 is on a distinguished road
I have another simple questio, that I can't solve.
I would like to open multiposition for every signal that I receive. Exactly I would like to open 3 position for every signal, what's the code to do this.
Regards
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
  #987 (permalink)  
Old 06-08-2008, 07:40 PM
Junior Member
 
Join Date: Oct 2006
Posts: 25
natsirte is on a distinguished road
problem with [i]

hi

in my EA , I try to print my two variables but it's not working:



************************************************** ********



double m_10 = iMA(NULL, 0, 10, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double m_20 = iMA(NULL, 0, 20, 0, MODE_SMA, PRICE_CLOSE, Current + 0);


for(int i=1; i<500 ; i--)
{
m_10[i] = iMA(NULL, 0, 10, 0, MODE_SMA, PRICE_CLOSE, Current + i);
m_20[i] = iMA(NULL, 0, 20, 0, MODE_SMA, PRICE_CLOSE, Current + i);
Print(m_10[i]+ " " + m_20[i]);

}


************************************************** ********



this is the message error :

'[' assignment expected



Help please!!



Thanks in advance.
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
  #988 (permalink)  
Old 06-08-2008, 08:02 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 652
Blog Entries: 1
IN10TION is on a distinguished road
something wrong in this line... for(int i=1; i<500 ; i--)
try with i++


for(int i=1; i<500 ; i++)



Quote:
Originally Posted by natsirte View Post
hi

in my EA , I try to print my two variables but it's not working:



************************************************** ********



double m_10 = iMA(NULL, 0, 10, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double m_20 = iMA(NULL, 0, 20, 0, MODE_SMA, PRICE_CLOSE, Current + 0);


for(int i=1; i<500 ; i--)
{
m_10[i] = iMA(NULL, 0, 10, 0, MODE_SMA, PRICE_CLOSE, Current + i);
m_20[i] = iMA(NULL, 0, 20, 0, MODE_SMA, PRICE_CLOSE, Current + i);
Print(m_10[i]+ " " + m_20[i]);

}


************************************************** ********



this is the message error :

'[' assignment expected



Help please!!



Thanks in advance.
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
  #989 (permalink)  
Old 06-09-2008, 01:33 AM
Senior Member
 
Join Date: Feb 2007
Posts: 986
FerruFx is on a distinguished road
Quote:
Originally Posted by natsirte View Post
hi

in my EA , I try to print my two variables but it's not working:



************************************************** ********



double m_10 = iMA(NULL, 0, 10, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double m_20 = iMA(NULL, 0, 20, 0, MODE_SMA, PRICE_CLOSE, Current + 0);


for(int i=1; i<500 ; i--)
{
m_10[i] = iMA(NULL, 0, 10, 0, MODE_SMA, PRICE_CLOSE, Current + i);
m_20[i] = iMA(NULL, 0, 20, 0, MODE_SMA, PRICE_CLOSE, Current + i);
Print(m_10[i]+ " " + m_20[i]);

}


************************************************** ********



this is the message error :

'[' assignment expected



Help please!!



Thanks in advance.
Did you declared the buffers?

double m_10[];
double m_20[];

FerruFx
__________________
FerruFx / www.ervent.net - Professional Coding Services (EAs/Indicators/Alerts)

BBVPS.com - Reliable Windows VPS For MT4 Hosting
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
  #990 (permalink)  
Old 06-09-2008, 10:18 AM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 652
Blog Entries: 1
IN10TION is on a distinguished road
This will do it.
If it's only for the print function, no arrays needed.
If you need it for drawing lines, you need something else to activate the buffers.
and the for() function needs to count up, not down.


************************************************** ********

int Current;

double m_10 = iMA(NULL, 0, 10, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double m_20 = iMA(NULL, 0, 20, 0, MODE_SMA, PRICE_CLOSE, Current + 0);


for(int i=1; i<500 ; i++){
m_10 = iMA(NULL, 0, 10, 0, MODE_SMA, PRICE_CLOSE, Current + i);
m_20 = iMA(NULL, 0, 20, 0, MODE_SMA, PRICE_CLOSE, Current + i);
Print(m_10+ " " + m_20);
}

************************************************** ********




Quote:
Originally Posted by FerruFx View Post
Did you declared the buffers?

double m_10[];
double m_20[];

FerruFx
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
#include, candle time, CHinGsMAroonCLK, code, coders guru, conditionally, dll, eli hayun, Eur_harvester.ex4, expert adviser, expert advisor, forex, higher high, how to code, indicator, I_XO_A_H, kehedge, mechanical trading, metatrader command line, mt4, MT4-LevelStop-Reverse, OrderReliable.mqh, programming, rectangle tool, trading, volty channel stop


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

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 06:19 AM.



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