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
  #981 (permalink)  
Old 06-04-2008, 10:20 PM
Member
 
Join Date: Mar 2008
Posts: 45
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
__________________
I'm studing to become an MQL Programmer!
The best strategy to use ForexKiller. Try it: http://forex-killerallday.blogspot.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #982 (permalink)  
Old 06-08-2008, 07:40 PM
Junior Member
 
Join Date: Oct 2006
Posts: 24
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!
Reply With Quote
  #983 (permalink)  
Old 06-08-2008, 08:02 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 558
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!
Reply With Quote
  #984 (permalink)  
Old 06-09-2008, 01:33 AM
Senior Member
 
Join Date: Feb 2007
Posts: 943
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
__________________
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
  #985 (permalink)  
Old 06-09-2008, 10:18 AM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 558
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!
Reply With Quote
  #986 (permalink)  
Old 06-09-2008, 11:17 AM
Senior Member
 
Join Date: Mar 2006
Location: La Verne,CA
Posts: 553
MrPip is on a distinguished road
Quote:
Originally Posted by mauro269 View Post
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
Just use 3 OrderSend calls instead of 1.

Robert
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #987 (permalink)  
Old 06-09-2008, 04:30 PM
Junior Member
 
Join Date: Dec 2005
Posts: 11
graemenash is on a distinguished road
Variable problem

Hi,

I am currenty programming an expert which does calculations based on the OHLC of the previous bar.

My problem is this:

I have a variable called "var5".

For the first bar that is counted, var5 is the open of that bar.

For every subsequent bar, var5 is the value of var5 on the previous bar, divided by 2.

I have no idea how to code this into MQL, and was wondering if anyone could show me an example of how this might be done?

Thanks in advance for any replies.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #988 (permalink)  
Old 06-09-2008, 05:51 PM
Junior Member
 
Join Date: Jun 2008
Posts: 9
panteraschoice is on a distinguished road
only buy, no sell

creating a profitable ea, but it could be twice as good (maybe) for now only buys are placed, never sellorders.
Anyone knows why?

//+------------------------------------------------------------------+
//| Signal Begin |
//+------------------------------------------------------------------+

double sig_buy = iCustom(NULL, 0, "Slope Direction Line",40, 2, 0, 0, 0);
double sig_sell = iCustom(NULL, 0, "Slope Direction Line",40, 2, 0, 1, 0);

double Sg=iCustom(NULL,0,"RSIFilter_v1",5,5,0,1);




if (sig_buy>0 && Sg>0) Order = SIGNAL_BUY;
if (sig_sell>0 && Sg<0 ) Order = SIGNAL_SELL;

//+------------------------------------------------------------------+
//| Signal End |
//+------------------------------------------------------------------+
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #989 (permalink)  
Old 06-09-2008, 07:05 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 558
Blog Entries: 1
IN10TION is on a distinguished road
publish the total code, there is another thing wrong...
the second step is perhaps your iCustom() functions.

Quote:
Originally Posted by panteraschoice View Post
creating a profitable ea, but it could be twice as good (maybe) for now only buys are placed, never sellorders.
Anyone knows why?

//+------------------------------------------------------------------+
//| Signal Begin |
//+------------------------------------------------------------------+

double sig_buy = iCustom(NULL, 0, "Slope Direction Line",40, 2, 0, 0, 0);
double sig_sell = iCustom(NULL, 0, "Slope Direction Line",40, 2, 0, 1, 0);

double Sg=iCustom(NULL,0,"RSIFilter_v1",5,5,0,1);




if (sig_buy>0 && Sg>0) Order = SIGNAL_BUY;
if (sig_sell>0 && Sg<0 ) Order = SIGNAL_SELL;

//+------------------------------------------------------------------+
//| Signal End |
//+------------------------------------------------------------------+
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #990 (permalink)  
Old 06-10-2008, 04:01 AM
Junior Member
 
Join Date: Sep 2006
Posts: 1
valoncross is on a distinguished road
Question Placing & Viewing Objects on Future Dates?

Hi, does anyone know if MQL4 supports placing an indicator object into the future and viewing the future object? I tried ObjectMove to a future date (no error return), but the display stops at the last tick date. Thanks
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 07:37 AM.



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