Trouble Shooting

 
 
 

Thanks

Did as suggested, and compiles fine now. However upon running it live I noticed it did not work as specified. In other words I set the time update to 15 min and it never initialized the Close All Profitable Positions script. Any thoughts?

 
double LastUpdate = CurTime();

//----

if (MathAbs(CurTime()-LastUpdate)> UpdateInterval*60)[/PHP]

This will never work, as at each tick you assign at lastUptade the value Curtime(), then, immediately after, you check if there is a difference between both...no.

The right way is:

[PHP]if(CurTime() >= LastUpdate + UpdateInterval*60)

{

BlahBlahBlah;

LastUpdate = CurTime();

}

My 2 cents : Why this time trick ? you can check all your orders every tick and close those which have reached your target !

EDIT : sorry, I didn't see it is a Script and not an EA, so there is another reason why it doesn't work : a script is executed only once : if you want to check something periodically, you have to write some loop in the code

 
Michel:
double LastUpdate = CurTime();

//----

if (MathAbs(CurTime()-LastUpdate)> UpdateInterval*60)[/PHP]

This will never work, as at each tick you assign at lastUptade the value Curtime(), then, immediately after, you check if there is a difference between both...no.

The right way is:

[PHP]if(CurTime() >= LastUpdate + UpdateInterval*60)

{

BlahBlahBlah;

LastUpdate = CurTime();

}

My 2 cents : Why this time trick ? you can check all your orders every tick and close those which have reached your target !

EDIT : sorry, I didn't see it is a Script and not an EA, so there is another reason why it doesn't work : a script is executed only once : if you want to check something periodically, you have to write some loop in the code

Thanks Michel,

I might have to leave this one to the pros.

MM

 
Mr.Marketz:
Thanks Michel,

I might have to leave this one to the pros.

MM

No ! You will never learn if you do not try !

Just write an EA to close your trades, not a script : put your test and the close func in the "start" func without any time-trick, that's all : at every tick the start function is called, there all your trades will be checked and eventually closed.

Reason: