Ask! - page 53

 

Alarm

How write an alarm for having it only 1 time and not again and again ?

Thanks for help.

Jo

 

Many functions are here https://www.mql5.com/en/forum/174329

And alert_once thread is here https://www.mql5.com/en/forum/172885

 

Please check this statement - Need confirmation Please!

iLow(NULL,0,Lowest(NULL,0,MODE_LOW,1,4)<=0)

Does this say that the Lowest of my indicator (4 bars back) should be less than or equal 0?? If not, how should it be stated?

Dave Thanks in advance!
 
iscuba11:
iLow(NULL,0,Lowest(NULL,0,MODE_LOW,1,4)<=0)

Does this say that the Lowest of my indicator (4 bars back) should be less than or equal 0?? If not, how should it be stated?

Dave Thanks in advance!

that's not right, you can look post 516 on page 52

the way you calculate lowest of indicator is not correct

 
asmdev:
that's not right, you can look post 516 on page 52 the way you calculate lowest of indicator is not correct
double lowestFG=9999, highestFG=-9999;//FG short for Forex_Grail, the name of my indicator histogram file.

int currentBar=0;

int endBar=4;

for(currentBar=0;currentBar<endBar; currentBar++)

lowestFG=MathMin(lowestFG, iForex_Grail(Symbol(),0,17,PRICE_CLOSE,currentBar)); //0 = anytime, 17 = maperiod of indicator.

if lowestFG <= 0 then go to next statement
Does this read right?? Dave

When I put this into my EA program, it says the iForex_Grail - function is not defined?? Forex_Grail is the name of my custom indicator.

Maybe it is to be stated: lowestFG=MathMin(lowestFG, iCustom(NULL,0,"Forex-Grail Trade Indicator",period,PRICE_CLOSE,currentBar)); ??

 

Found my error!

Dave

 

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
 
double lowestFG=9999, highestFG=-9999;

int currentBar=0;

int lastBar=4;

for(currentBar=0;currentBar<lastBar; currentBar++)

lowestFG=MathMin(lowestFG, iCustom(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

 

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

 
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 ...)