simple ea? - page 3

 

ubzen,

When you do your back testing there are two questions I hope you can answer:

1. Why is the EA holding its position when it is good?

2. Should it immediately take a new position when one closes?

The second question is like a two-edged sword:

Sometimes the new position produces more immediate profit, sometimes a loss.

Should the EA take a breather before taking a new position?

I note that the auto-generated code uses the long-discredited "spaghetti" code instead of breaking the thing up into functions.

I am looking forward to hearing from you and working with you, Helmut

 
engcomp:

For example, the routine for closing open positions is in this for-loop...

Shouldn't it be from last to first?

for ( int i = Total; i >=0; i-- ) {

That should be Total - 1

Counting up is fine, unless you 1) close an order, 2) delete a pending order, 3) modify the lot size (creates a new ticket/closes existing)

Counting down is always fine.

 
WHRoeder:

That should be Total - 1

Counting up is fine, unless you 1) close an order, 2) delete a pending order, 3) modify the lot size (creates a new ticket/closes existing)

Counting down is always fine.

Yes, of course, thank you. Indexes always start from zero, so if I have two orders I count back from 1.

If I do mistakenly count back from 2, the next line...

OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
would return False.
 
engcomp I hope you received my message.
 
ubzen:
engcomp I hope you received my message.

Yes, thank you.

Phillip also thought it was a MA crossover EA but I already pointed out above that it is not.

It's not even using different time frames because the current Closes of M1, M5 and M30 are all the same (being the last tick), so you only need the M30 bar.

I tested it by changing the code to...

   double Buy1_1 = iClose("EURUSD", PERIOD_M30, Current + 0);
   double Buy1_2 = iOpen("EURUSD", PERIOD_M30, Current + 0);
   double CloseBuy1_1 = iClose("EURUSD", PERIOD_M30, Current + 0);
   double CloseBuy1_2 = iOpen("EURUSD", PERIOD_M30, Current + 0);

and it produces identical results.

By the way, check the period 2010.05.17 to 2010.05.19 - it really bombs.

How did you go with building an EA using the quoted generator?

Please email me on engcomp@gmail.com

best wishes, Helmut

 

hi,

i did not lost interest. was on a short trip....

i am excited how the thread is living. many thanks to all for working on this!

regards

sven

Reason: