double Ticket; void OnTick(){ OpenOrder_Long(); CloseOrder_Long(); } void OpenOrder_Long(){ if(iClose(Symbol(), 0, 1) > iHigh(Symbol(), 0, iHighest(Symbol(), 0, MODE_HIGH, 50, 1))&& OrdersTotal() == 0){ Ticket = OrderSend(Symbol(), OP_BUY, 0.5, Ask, 0, 0, 0, 0, 0, 0, 0); } } void CloseOrder_Long(){ if(iClose(Symbol(), 0, 1) < iLow(Symbol(), 0, iLowest(Symbol(), 0, MODE_LOW, 50, 1))){ OrderClose(Ticket, OrderLots(), Ask, 0, 0); } }
ups... i'm sorry, i'm new to the forum. thanks
ludovico97: I'm not capable to understand why this simple EA doesn't work...
if(iClose(Symbol(), 0, 1) > iHigh(Symbol(), 0, iHighest(Symbol(), 0, MODE_HIGH, 50, 1))
How can the Close of bar 1 ever be higher than the highest bar [49 … 1]? How can the Close of bar 1 be higher than the High of bar 1?
William Roeder:
Oh god... Thank you so much... Now i undestand
How can the Close of bar 1 ever be higher than the highest bar [49 … 1]? How can the Close of bar 1 be higher than the High of bar 1?

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I'm not capable to understand why this simple EA doesn't work... Can someone help me? :)
the mt4 doesn't give any error but when i start the backtest there aren't opened orders... :/
EDIT: Code removed and added in a later post