Coding help - page 251

 

Not yet, I will if he agrees. Unfortunately there is time shift to Japan, so I have to wait till later.

 
Ovo:
Not yet, I will if he agrees. Unfortunately there is time shift to Japan, so I have to wait till later.

Night shift ________________________

My original thinking was this :

Let us assume that TimeCurrent() and CopyRates() are working correctly. In that case it would return that true result only if there was no data in the 1 minute history file at all (or just one bar was saved in that history file) which is hard to believe.

So, if for some reason, TimeCurrent() returns 0 in some cases then you would have that error

Or, if all of the above is excluded, CopyRates() can work wrongly. I did not have problems with it but in metatrader 5 there are frequent cases when very similar function (CopyTime()) does a complete nonsense : on one tick it works, on next tick it returns "invalid time frame error" and then on the next tick it works OK again (time frame variable has never changed in the mean time of course). Since the basis for both is the same now, it is not hard to assume something similar

________________________

We should keep in mind what CJA told once : "After all, we are talking about the new metatrader 4" which is anything but bug free

 
mladen:
Night shift

________________________

My original thinking was this :

Let us assume that TimeCurrent() and CopyRates() are working correctly. In that case it would return that true result only if there was no data in the 1 minute history file at all (or just one bar was saved in that history file) which is hard to believe.

So, if for some reason, TimeCurrent() returns 0 in some cases then you would have that error

Or, if all of the above is excluded, CopyRates() can work wrongly. I did not have problems with it but in metatrader 5 there are frequent cases when very similar function (CopyTime()) does a complete nonsense : on one tick it works, on next tick it returns "invalid time frame error" and then on the next tick it works OK again (time frame variable has never changed in the mean time of course). Since the basis for both is the same now, it is not hard to assume something similar

________________________

We should keep in mind what CJA told once : "After all, we are talking about the new metatrader 4" which is anything but bug free

Lol, that sounds scary. I totally depend on this command. I performed some tests and it did not behave quite logically, but neither randomly. So hopefully they did better job than with the MT5.

 

Hello,

Can somebody help me code the following:

I need the code for opening buy and sell pending orders (martingale i think is name for this) at distance "a + x + y" from starting point at a certain time "z".

distance "x" = Spread at time "z" + 0.1 pip, minimum stop allowed by my broker

distance "y" = pips for makiing pending order a market order

This way this martingale would open buy pending order at stating point ("a") + Spread + 0.1 pip ("x") + "y" pips, and setup stop loss at "x" with "y" pips SL.

"y" pips = 1 for spread higher than 35 points

"y" pips = 2 for spread lower than 35 points

the idea is to include the variable spread into the ea open pending order points and not just a buy or sell pending order with an ammount of pips for all cases.

Thanks

Daniel

 

i need a script for time control

i want ea to start at a specific time gm+2 and stop at a specific time

i mean time to start and time to close all open

 
dasssi:
i need a script for time control

i want ea to start at a specific time gm+2 and stop at a specific time

i mean time to start and time to close all open

dasssi

Fist this question : Why don't you add time filter in the EA itself?

PS: it can be done, but then it stops or enables all experts, not just one, that is why I am asking the upper question

 

Hi can some one help me why this code does not work...(it used to work well in build 509)

in build 610 it compiles without errors but my terminal just hangs and unable to load...

int start()

{

int counted_bars=IndicatorCounted();

if(counted_bars>0) counted_bars--;

int limit=Bars-counted_bars;

for(int i=0; i<limit; i++)

{

BUFFER_1 = iCustom(NULL,0,"MYindicator",Period,3,iBarShift(NULL,0,Time,false));

 

it had a compile problem but i overcome it and changed the ea

thanks

 
mladen:
Night shift ________________________

My original thinking was this :

Let us assume that TimeCurrent() and CopyRates() are working correctly. In that case it would return that true result only if there was no data in the 1 minute history file at all (or just one bar was saved in that history file) which is hard to believe.

So, if for some reason, TimeCurrent() returns 0 in some cases then you would have that error

Or, if all of the above is excluded, CopyRates() can work wrongly. I did not have problems with it but in metatrader 5 there are frequent cases when very similar function (CopyTime()) does a complete nonsense : on one tick it works, on next tick it returns "invalid time frame error" and then on the next tick it works OK again (time frame variable has never changed in the mean time of course). Since the basis for both is the same now, it is not hard to assume something similar

________________________

We should keep in mind what CJA told once : "After all, we are talking about the new metatrader 4" which is anything but bug free

Lol, finally you were right. After I replaced the TimeCurrent by integer the code is running all around the globe. It seems it depended on time zone. It took one day of my life.

 
dasssi:
it had a compile problem but i overcome it and changed the ea thanks

Btw: here is one indicator (not a script) that can enable or disable all EAs and scripts at certain time. Time limits should be you local (computer) time. It does not depend on tick, so it will disable or enable trading even if ticks are not coming in

Files: