i need some help debugging an EA which doesn't do what it should do
Don't hit me, i'm a noob creating EAs and tried creating this one on a Website (you will see this in the code).
What it should do:
if the last bar was bullish, open a sell on the open of the new candle, with an configurable TP and SL set to the high of the last bar. There should be only one trade per candle, exactly on the open of the new candle.
For a bearish candle it should be the exact opposite. if the EA is started in the middle of a candle, it should open the first trade on the new candle.
Problem:
it opens more than one trade per candle, and if the EA is activated in the middle of a candle, it instantly opens a trade.
I hope someone could help me with that.
Thanks,
Doc