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
  #1211 (permalink)  
Old 08-26-2008, 06:53 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 569
Blog Entries: 1
IN10TION is on a distinguished road
:: then define every [if] statement what it can't be & that is NOT equal... at last use the equal statement for Yellow.

IN10TION


Quote:
Originally Posted by fireslayer26 View Post
Right now this indicator posts bar openings that are greater than or equal to the previous opening in Green and lower than in Red. My question is how would I change this code to make the openings that are EQUAL to the previous opening show up in YELLOW?

if( X01 >= X02 ) { color_X01 = Lime ; } else { color_X01 = Red ; }
if( X02 >= X03 ) { color_X02 = Lime ; } else { color_X02 = Red ; }
if( X03 >= X04 ) { color_X03 = Lime ; } else { color_X03 = Red ; }
if( X04 >= X05 ) { color_X04 = Lime ; } else { color_X04 = Red ; }
if( X05 >= X06 ) { color_X05 = Lime ; } else { color_X05 = Red ; }
if( X06 >= X07 ) { color_X06 = Lime ; } else { color_X06 = Red ; }
if( X07 >= X08 ) { color_X07 = Lime ; } else { color_X07 = Red ; }
if( X08 >= X09 ) { color_X08 = Lime ; } else { color_X08 = Red ; }
if( X09 >= X10 ) { color_X09 = Lime ; } else { color_X09 = Red ; }
__________________
..4.Nov.08.. IN10TION newsReader v09.85 Lite - the best news reader on your chart
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1212 (permalink)  
Old 08-26-2008, 08:43 PM
Member
 
Join Date: May 2008
Posts: 54
fireslayer26 is on a distinguished road
I fixed it!

if (X01 > X02) {color_X01 = Lime;} else if (X01 < X02) {color_X01 = Red;} else {color_X01 = Yellow;}
if (X02 > X03) {color_X02 = Lime;} else if (X02 < X03) {color_X02 = Red;} else {color_X02 = Yellow;}
if (X03 > X04) {color_X03 = Lime;} else if (X03 < X04) {color_X03 = Red;} else {color_X03 = Yellow;}
if (X04 > X05) {color_X04 = Lime;} else if (X04 < X05) {color_X04 = Red;} else {color_X04 = Yellow;}
if (X05 > X06) {color_X05 = Lime;} else if (X05 < X06) {color_X05 = Red;} else {color_X05 = Yellow;}
if (X06 > X07) {color_X06 = Lime;} else if (X06 < X07) {color_X06 = Red;} else {color_X06 = Yellow;}
if (X07 > X08) {color_X07 = Lime;} else if (X07 < X08) {color_X07 = Red;} else {color_X07 = Yellow;}
if (X08 > X09) {color_X08 = Lime;} else if (X08 < X09) {color_X08 = Red;} else {color_X08 = Yellow;}
if (X09 > X10) {color_X09 = Lime;} else if (X09 < X10) {color_X09 = Red;} else {color_X09 = Yellow;}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1213 (permalink)  
Old 08-27-2008, 04:24 AM
matrixebiz's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 1,174
matrixebiz is on a distinguished road
Quote:
Originally Posted by hiachiever View Post
Matrixebiz,

if you want to start at 6 and go back to 0 then use i--

(int i=6; i>0; i--)

This will start at 6, decrement by 1 on each loop for as long as I > 0.
If you want to include 0 then use i>=0.

Cheers,
Hiachiever
Thank you for your help, one more question, is i++ the actual command that I have to use or can I change the letter like m++ to do the loop?
EG: (int m=2; m<=6; m++)
and if I never need it to go lower than 2 I can just put m=2 then continue the loop upto 6 max m<=6, correct?
and once the loop gets more than m<=6 like 7 then it stops and starts over, correct?
Thanks

Last edited by matrixebiz; 08-27-2008 at 04:30 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1214 (permalink)  
Old 08-27-2008, 05:17 AM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 569
Blog Entries: 1
IN10TION is on a distinguished road
:: everything is correct, except it will stop at 6 (not 7)
Quote:
Originally Posted by matrixebiz View Post
Thank you for your help, one more question, is i++ the actual command that I have to use or can I change the letter like m++ to do the loop?
EG: (int m=2; m<=6; m++)
and if I never need it to go lower than 2 I can just put m=2 then continue the loop upto 6 max m<=6, correct?
and once the loop gets more than m<=6 like 7 then it stops and starts over, correct?
Thanks
__________________
..4.Nov.08.. IN10TION newsReader v09.85 Lite - the best news reader on your chart
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1215 (permalink)  
Old 08-27-2008, 06:35 AM
Junior Member
 
Join Date: Aug 2007
Posts: 3
bobojsza is on a distinguished road
stop and waiting reverse

Hi coders!

Have one question:

Have got to code: buy close (TP or SL) after waiting sell setup.

Process of: buy, close, waiting sell entry, sell, sell close, waiting buy entry, buy.


Thank you the assistance!

Bobojsza

Sorry the bad english!

Last edited by bobojsza; 08-27-2008 at 06:39 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1216 (permalink)  
Old 08-27-2008, 11:53 AM
matrixebiz's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 1,174
matrixebiz is on a distinguished road
Quote:
Originally Posted by IN10TION View Post
:: everything is correct, except it will stop at 6 (not 7)
Thanks but is i++ the actual command that I have to use or can I change the letter like m++ to do the loop?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1217 (permalink)  
Old 08-27-2008, 12:09 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 569
Blog Entries: 1
IN10TION is on a distinguished road
:: " i " is just a variable name so you can use whatever name. Like your " m ", use this variable name in the rest of your function.
Quote:
Originally Posted by matrixebiz View Post
Thanks but is i++ the actual command that I have to use or can I change the letter like m++ to do the loop?
__________________
..4.Nov.08.. IN10TION newsReader v09.85 Lite - the best news reader on your chart
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1218 (permalink)  
Old 08-27-2008, 01:02 PM
Junior Member
 
Join Date: Mar 2008
Posts: 4
ssvl is on a distinguished road
Action on new bar

How can you tell (in your expert advisor) when there is a new bar opened in the current timeframe?

I have some code that needs to be executed each time a new bar pops up.

TIA
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1219 (permalink)  
Old 08-27-2008, 01:49 PM
Senior Member
 
Join Date: Apr 2006
Posts: 131
InTrance is on a distinguished road
Quote:
Originally Posted by ssvl View Post
How can you tell (in your expert advisor) when there is a new bar opened in the current timeframe?

I have some code that needs to be executed each time a new bar pops up.

TIA
if (iBars>Bars) {

execute code;

Bars=iBars;

}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1220 (permalink)  
Old 08-27-2008, 01:56 PM
Junior Member
 
Join Date: Mar 2008
Posts: 4
ssvl is on a distinguished road
thx for the information, will try it out

i'm just started learning mql
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 12:13 PM.



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