Can anybody please tell me what is wrong with this short Martingale code? - page 2

 
WHRoeder:
You said " back test refuses to start." MAKE UP YOUR MIND.
What happens when count goes negative - infinite loop

William,

I am extremely grateful for your help (and also that of forexcoder).

If you read my earlier post to Roy you would have found this explanation; "EA does not want to run, except if I set the external variable == true and compile the EA." (meaning of course the MartingaleFunc)

Another strange thing. If I set the MartingaleFunc == false the EA would run and the code inside that function would still run and give me values for OrdersHistoryTotal, LossCount and WinCount. I would have thought it would skip the code inside the function when it found the function set to "false"!

I am surprised to hear there is an infinite loop (forexcoder has confirmed it) since I was under the understanding that if the loop reached the value of pos == 0 it would stop.

Man, I am learning all the time! This programming is tricky! I really respect you guys that can look at a piece of code and see the problem without any difficulty.

Cannot wait to try your recommended code! Will let you know what transpires.

 

Yes, it didn't run when you set the MartingaleF. to true, because it entered an infinite loop there. It didn't otherwise.

If anything else goes wrong or if you have additional questions, past more code here (well, below) :P

 
WHRoeder:
You said " back test refuses to start." MAKE UP YOUR MIND.
What happens when count goes negative - infinite loop

William,

I have tried your code but the problem persists. If I set MartingaleFunc == false the EA runs but as soon as I set it to == true it refuses to budge.

 
forexCoder:

Yes, it didn't run when you set the MartingaleF. to true, because it entered an infinite loop there. It didn't otherwise.

If anything else goes wrong or if you have additional questions, past more code here (well, below) :P


Forexcoder,

Thanks for your offer to help.

I fixed the infinite loop, but the problem is still there.

You ask for more code. Any particular area or the whole EA?

 
just attach the EA and let us fix it.
 

You guys will not believe this!

I deleted all the lines of code in the Martingale function and retyped it.

Now the bloody thing is working!

How can you explain that? There must have been some invisible character or something that caused the problem.

 

Lol:) congrats on the working EA, wish we could help more :)

Why are people so afraid to post code? It's not like you guys are developing soomething that 1337 people havent tried before, using help from these forums. Most of the code in this forum either IS or should be left in code base, it's so standard :)

 
i
Reason: