Forex
Google
New signals service!

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions


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 (2) Thread Tools Display Modes
  #531 (permalink)  
Old 03-21-2007, 06:12 PM
iscuba11's Avatar
Senior Member
 
Join Date: May 2006
Location: Houston
Posts: 399
iscuba11 is on a distinguished road
Smile

Found my error!

Dave

Last edited by iscuba11; 03-21-2007 at 06:16 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #532 (permalink)  
Old 03-21-2007, 08:00 PM
iscuba11's Avatar
Senior Member
 
Join Date: May 2006
Location: Houston
Posts: 399
iscuba11 is on a distinguished road
Thumbs up

PHP Code:
double lowestFG=9999highestFG=-9999;
int currentBar=0;
int lastBar=4;
for(
currentBar=0;currentBar<lastBarcurrentBar++)
lowestFG=MathMin(lowestFGiCustom(NULL,0,"Forex-Grail Trade Indicator",period,PRICE_CLOSE,currentBar));
Print (
"Low  =",lowestFG); 
This reads from buffer ' 0 ' of the indicator [0.00 to positive] (Works OK!). How do I get it to read from buffer ' 1 ' of the indicator [0.00 to negative]?

Statement definition: double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift) - No where does it call for a buffer number?????????????? PLEASE HELP!!!! It seems to be locked into buffer ' 0 '.


Please enlighten me!!

Dave

Last edited by iscuba11; 03-21-2007 at 10:20 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #533 (permalink)  
Old 03-21-2007, 10:09 PM
iscuba11's Avatar
Senior Member
 
Join Date: May 2006
Location: Houston
Posts: 399
iscuba11 is on a distinguished road
Smile Too many decimal places!! - Please advise.

How do I limit the amount of decimal places a comment statement shows on the graph. Right now it shows a variable result as .00347892, and I want it only to show .0035 (Rounded to the next number)??

Appreciate your input!

Dave
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #534 (permalink)  
Old 03-21-2007, 10:55 PM
Member
 
Join Date: Dec 2005
Posts: 68
asmdev is on a distinguished road
iCustom( string symbol, int timeframe, string name, ..., int mode, int shift)

'mode' is your buffer
iCustom( ... ...indicator parameters here ... , 0, currentBar) - will read from 0 buffer
iCustom( ... ...indicator parameters here ... , 1, currentBar) - will read from 1st buffer

some info here http://docs.mql4.com/indicators/iCustom


lowestFG=9999 should be OK but to be sure can write
lowestFG = iCustom(NULL,0,"Forex-Grail Trade Indicator",period,PRICE_CLOSE,1,currentBar) instead


DoubleToStr function(http://docs.mql4.com/convert/DoubleToStr) will limit # of decimal places, mostly used to get nice looking # fro Print or Alert function. The function will not round but simply cut off unneeded decimal places.

If you use your this double # to compare with another # you still have bunch of # after decimal point

use NormalizeDouble (http://docs.mql4.com/convert/NormalizeDouble) to limit number if decimal places permanently

according to your iCustom your indicator have 2 parameters period and price(PRICE_CLOSE), check if thats correct

Last edited by asmdev; 03-21-2007 at 11:06 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #535 (permalink)  
Old 03-21-2007, 11:18 PM
Member
 
Join Date: Dec 2005
Posts: 68
asmdev is on a distinguished road
Quote:
Originally Posted by iscuba11
This reads from buffer ' 0 ' of the indicator [0.00 to positive] (Works OK!).
it is coincidence that it works ok, If your FG indicator has 2 pameters (period & price) you need to add 1 more param in the iCustom like in prev post, if your FG indicator has 1 param(period) then replace PRICE_CLOSE with buffer #(0 or 1 or 2 or ...)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #536 (permalink)  
Old 03-21-2007, 11:27 PM
Member
 
Join Date: Dec 2005
Posts: 68
asmdev is on a distinguished road
possible solution for 0 buffer:

int currentBar=0;
double lowestFG=iCustom(NULL,0,"Forex-Grail Trade Indicator",period,PRICE_CLOSE,0, currentBar);
double highestFG = lowestFG;

for(;currentBar<4; currentBar++) lowestFG=MathMin(lowestFG, iCustom(NULL,0,"Forex-Grail Trade Indicator",period,PRICE_CLOSE,0,currentBar));

for(currentBar=0;currentBar<4; currentBar++) highestFG =MathMax(highestFG , iCustom(NULL,0,"Forex-Grail Trade Indicator",period,PRICE_CLOSE,0,currentBar));

you need to do all over again for buffer # 1
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #537 (permalink)  
Old 03-22-2007, 12:24 AM
Member
 
Join Date: Dec 2005
Posts: 68
asmdev is on a distinguished road
Quote:
Originally Posted by iscuba11
How do I limit the amount of decimal places a comment statement shows on the graph. Right now it shows a variable result as .00347892, and I want it only to show .0035 (Rounded to the next number)??

Appreciate your input!

Dave
function IndicatorDigits
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #538 (permalink)  
Old 03-22-2007, 01:29 AM
iscuba11's Avatar
Senior Member
 
Join Date: May 2006
Location: Houston
Posts: 399
iscuba11 is on a distinguished road
Smile

First of all, I would like to thank all of you for helping me. I believe I can now put my new EA on line for testing.

I still have a question on decimal places.

The comment statement is being generated from the EA and not the indicator. The function indicatordigits, I believe, is used in the indicator itself and not the ea. Is there not a simple rounding off up to x places of a variable that I could use. Why they make this language so complicated. Even basic language could probably do this!

As always appreciated, feedback of knowledge and wisdom is welcome. Please help if you can.

Thanks a bunch!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #539 (permalink)  
Old 03-22-2007, 02:01 AM
Member
 
Join Date: Dec 2005
Posts: 68
asmdev is on a distinguished road
I finally read your post correctly, try Comment(DoubleToStr(doubleVariable, 4));
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #540 (permalink)  
Old 03-22-2007, 02:42 AM
iscuba11's Avatar
Senior Member
 
Join Date: May 2006
Location: Houston
Posts: 399
iscuba11 is on a distinguished road
Smile

That did it! Now to tweak and test. You all blessed me - Thanks!

Peace and Love to all, in Jesus Name!

Reverend Dave
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
histogram, forex, ZUP_v1.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

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/questions/270-ask.html
Posted By For Type Date
OzFx System:) - Page 639 This thread Refback 06-21-2008 10:53 PM
Forex SRDC Sidus Sibkis EA MT4 Forum OTCSmart This thread Refback 12-08-2007 12:46 PM


All times are GMT. The time now is 03:35 AM.



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