Please edit your post and use the code button (Alt+S) when pasting code.
EDIT your original post, please do not just post the code correctly in a new post.
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.
if(total<1){ if(dayOpen > dayClose && prevDayOpen > prevDayClose){ SellTrade(); } else if(dayOpen < dayClose && prevDayOpen < prevDayClose){ BuyTrade(); } else //Otherwise Exit <<<<<<<< This else applies to not opening. It is not called once an order is open (total >= 1) { if(dayLow < prevDayLow && dayOpen > dayClose && OrderType()==OP_BUY){ << Select and order before getting its type. OrderSelect(0,SELECT_BY_POS); OrderClose(OrderTicket(), OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),3,clrGold); }

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
Please any Help is appreciated I am new to to MQL in General and I have been trying to figure out this problem. After opening a trade It does not close with my condition and I do not why?
if(total<1){
if(dayOpen > dayClose && prevDayOpen > prevDayClose)
{
SellTrade();
}
else if(dayOpen < dayClose && prevDayOpen < prevDayClose)
{
BuyTrade();
}
else //Otherwise Exit
{
if(dayLow < prevDayLow && dayOpen > dayClose && OrderType()==OP_BUY)
{
OrderSelect(0,SELECT_BY_POS);
OrderClose(OrderTicket(), OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),3,clrGold);
}
if(dayHigh > prevDayHigh && dayOpen < dayClose && OrderType()==OP_SELL)
{
OrderSelect(0,SELECT_BY_POS);
OrderClose(OrderTicket(), OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),3,clrGold);
}
}
}