Problem with Pending Order-EA

 

hi

Below is my first own EA.

Unfortunately I have some problems with it.

How it should work: Every new (Daily)-Bar the EA should only set one sellstop and one buystop. 

Prices, StopLoss and TakeProfit are all calculated by a formula using the High-,Low- and Close-Value of the privious day.

Now I have two problems:

1. The EA only sets pending orders, when I don't define the SL and TP-values in the source-code.

2. If I leave SL and TP-values by 0 SellStop and BuyStops-orders are set, but not each once a day but any time the price changes.

    Actually the pending orders should only be set when a day begins i.e. a new daily candle opens.

Many thanks in advance for everyone who can help me!!!

As I said before im just starting to program so the code sure doesn't look very professional but I think (hope) the problems shouldn't

very hard to be solved for some experienced programmers.

Files:
myea.mq4  2 kb
Reason: