EA Hospital - EMERGENCY ROOM

 

Hi, Guys,

I just got into coding 2 days ago and now adapted an easy ea to my own strategy but it dosn't want to do what I'm telling it to.

So here is what it should do:

Entry

1.It shall only open one order per bar.

1. Go short if the Extrapolator falls the next bar and the Price gets above the current value of the Extrapolator.

2. Go long if the Extrapolator rises the next bar and the Price gets below the current value of the Extrapolator.

Exit

1. We exit a position if the price rises above the Value of the next extrapolated bar.

or

2. We exit if the next bar is against our current direction.

That's what it does now

1. It doesn't trade at all and gives me the Warning "zero divide".

That's something I tried to do and the result. But it doesn't work. May the negative shift be the problem ?

Please don't be confused when looking at the code...I tried everything possible with my (still) little knowledge ;)

thx in advance

Files:
 

Please don't be confused when looking at the code...I tried everything possible with my (still) little knowledge ;)

Ah, but you haven't tried everything possible since you have only one Print statement.


Have lots of Print statements all over the place, including Print-ing out the values of the variables to check whether they are what you assumed them to be.

 

Ok, so you mean I shall do something like this:

futa=iCustom(NULL,0,"Extrapolator",Extrapolationmethod,0,Lookback,0.6,80,25,0.00016,0,0,0) {Print(futa)};
right?...
 

That's the general idea... It's probably more useful to put Print at decision points, eg if(futa > futb) so that you know whether the condition has been satisfied or not, and why...


For the "zero divide" problem, you would want to Print the values before the division so you know exactly which line is the real problem if you have more than one division statement.

 

HMM,

there's the Problem with the division statements. I've adapted the Part including the Division statements (Lot calculations) from another ea to different eas and it works without problems on them with the same settings I use on this one.

So it has divide something by 0 there without having any order executed. I'm a little confused...

Reason: