Coding help - page 299

 
mladen:
AZRUL

Place this :

static datetime lastUpdated = 0; if ((TimeCurrent()-lastUpdated) < PERIOD_M5*60) return(0); lastUpdated=TimeCurrent();

as the first line of start procedure and the rest of the code of the start procedure will be executed with at least 5 minute delay between two consecutive executions

Dear SIR MLADEN,

I will try and place those codes ONLY....

Thank you VERY2 much for your time and expertise.... 5th credits

yours truly

AZRUL...

 

If I compile this code while using "strict" I get "array out of range"

if (RSI4 > RSI1 && RSI4 < RSI1) drawArrow(i,Aqua,233,false);

if (RSI4 RSI1) drawArrow(i,Tomato,234,true);

[/PHP]

This works with no errors but of course there are arrows on every candle

if (RSI4 > RSI1 ) drawArrow(i,Aqua,233,false);

if (RSI4 < RSI1 ) drawArrow(i,Tomato,234,true);

This appears to be the problem as soon as the +1 is added.

[PHP]RSI4 > RSI1

Is there a fix for this?

 
cja:
If I compile this code while using "strict" I get "array out of range"

if (RSI4 > RSI1 && RSI4 < RSI1) drawArrow(i,Aqua,233,false);

if (RSI4 RSI1) drawArrow(i,Tomato,234,true);

[/PHP]

This works with no errors but of course there are arrows on every candle

if (RSI4 > RSI1 ) drawArrow(i,Aqua,233,false);

if (RSI4 < RSI1 ) drawArrow(i,Tomato,234,true);

[/PHP]

This appears to be the problem as soon as the +1 is added.

[PHP]RSI4 > RSI1
Is there a fix for this?

cja

Try like this :

[PHP]if(i<(Bars-1))

{

if (RSI4 > RSI1 && RSI4 < RSI1) drawArrow(i,Aqua,233,false);

if (RSI4 RSI1) drawArrow(i,Tomato,234,true);

}

and it should work

 

Hello, I have a problem with an indicator fibonacci, I would like to use it on the same graph to 1440 and 2280, as in this image:

(That's why I created manually)

The problem is that I created a second version of the indicator to 2 days but when I insert it on the same graph where I have the indicator in version 1440 automatically no longer see the lines in 1440. I hope to solve with your help!

 
dany84:
Hello, I have a problem with an indicator fibonacci, I would like to use it on the same graph to 1440 and 2280, as in this image:

(That's why I created manually)

The problem is that I created a second version of the indicator to 2 days but when I insert it on the same graph where I have the indicator in version 1440 automatically no longer see the lines in 1440. I hope to solve with your help!

dany84

Try it out now : fibo_v9_1.mq4

Set the UniqueID parameter to unique value for each new instance of the indicator and then you can have as much instances as you wish

Files:
fibo_v9_1.mq4  6 kb
 
mladen:
dany84

Try it out now : fibo_v9_1.mq4

Set the UniqueID parameter to unique value for each new instance of the indicator and then you can have as much instances as you wish

Thank you Mladen!! now it works fine!

 

Strange error!!!

I have the following string: " 99.40 "

double TakeProfit = StrToDouble("99.40");

Print("TakeProfit =", TakeProfit);

Print("or TakeProfit = ", NormalizeDouble(TakeProfit,2);

And this is the Output:

TakeProfit =99.40000000000001

or TakeProfit = 99.40000000000001

Can anybody explain me this strange error and what can I do against it?!

Thank you!

 
sunshineh:
Strange error!!!

I have the following string: " 99.40 "

double TakeProfit = StrToDouble("99.40");

Print("TakeProfit =", TakeProfit);

Print("or TakeProfit = ", NormalizeDouble(TakeProfit,2);

And this is the Output:

TakeProfit =99.40000000000001

or TakeProfit = 99.40000000000001

Can anybody explain me this strange error and what can I do against it?!

Thank you!

sunshineh

How did you get the "0000000000001" part with print?

I am getting this when using that code :

Files:
pribt.gif  21 kb
 

Hi,

this is the print-Messages from two different metatrader accounts:

Files:
 
sunshineh:
Hi,

this is the print-Messages from two different metatrader accounts:

Probably the build

I used build 660 to test that

Reason: