Forex
Google

Go Back   Forex Trading > Discussion Areas > Metatrader 4
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


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 Thread Tools Display Modes
  #1 (permalink)  
Old 03-23-2007, 12:17 PM
Jagg Jagg is offline
Junior Member
 
Join Date: Oct 2006
Posts: 23
Jagg is on a distinguished road
Only show smallest variable

Hi,

I have three variables (values of this variables are for example: 68, 25, 93). Now I will only show the smallest one of them in the indicator window.

How can I check this three variables so I get back the smallest one?

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-23-2007, 01:18 PM
mangman mangman is offline
Senior Member
 
Join Date: Nov 2005
Posts: 169
mangman is on a distinguished road
for example: 3 variables are var1,var2 and var3 and additional variable called smallest.

if(var1<var2) smallest=var1;
else smallest=var2;

if (var3<smallest) smallest=var3;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-23-2007, 02:04 PM
Jagg Jagg is offline
Junior Member
 
Join Date: Oct 2006
Posts: 23
Jagg is on a distinguished road
Ok, thought there is a small functionn out there for that....

Say it are five variables... how to it then?

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-23-2007, 02:25 PM
Maji Maji is offline
Senior Member
 
Join Date: Mar 2006
Posts: 787
Maji is on a distinguished road
I think that is something that is missing from MT4's math routines.

You can use the MathMin(Var1, Var2) in a loop to do this. It sucks to do something complicated for something that simple. I with MT people provide us with a built in Highest and Lowest routine for any number. Currently, it can only do that for the OHLC type of values.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 03-23-2007, 11:24 PM
ralph.ronnquist's Avatar
ralph.ronnquist ralph.ronnquist is offline
Senior Member
 
Join Date: Oct 2006
Posts: 280
ralph.ronnquist is on a distinguished road
Quote:
Originally Posted by Jagg
Ok, thought there is a small functionn out there for that....

Say it are five variables... how to it then?

Thanks
The following snippet can be used for any fixed number of variables:
PHP Code:
double values[] = { var1var2, .., varN };
double min ArrayMinimumvalues ); 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-03-2007, 08:56 AM
Jagg Jagg is offline
Junior Member
 
Join Date: Oct 2006
Posts: 23
Jagg is on a distinguished road
Quote:
Originally Posted by ralph.ronnquist
PHP Code:
double values[] = { var1var2, .., varN };
double min ArrayMinimumvalues ); 
Ok, I have PDiff, S1Diff, ... variables (double). Now I tried:
PHP Code:
double values[] = { PDiffS1DiffS2DiffR1DiffR2Diff };
double min ArrayMinimumvalues ); 
but get
Code:
'}' - comma or semicolon expected
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Show Us Your Best EA hellkas Expert Advisors - Metatrader 4 698 07-03-2008 05:42 AM
EA doesnt show symbols soundchild Setup Questions 5 09-26-2006 11:37 AM
How do you show buy and sell arrows on an EA rbowles Metatrader 4 1 07-31-2006 12:04 AM
MT4 demos wont show history don perry Expert Advisors - Metatrader 4 2 07-26-2006 11:15 PM


All times are GMT. The time now is 09:43 PM.