-
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
Messages Editor -
if [(PRICE_CLOSE > PRICE_CLOSE[1])
Don't post code that will not compile. A constant is not an array.

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
void OnTick()
{
if [(PRICE_CLOSE > PRICE_CLOSE[1]) & (PRICE_WEIGHTED > PRICE_OPEN[1])]
{
OrderSelect(0,SELECT_BY_POS);
OrderClose(OrderTicket(),1,Bid,100,clrBlack);
OrderSend(Symbol(),OP_BUY,1,Ask,100,0,0,NULL,0,0,clrAliceBlue);
}
if ((PRICE_CLOSE < PRICE_CLOSE [1]) & (PRICE_WEIGHTED < PRICE_OPEN [1]))
{
OrderSelect(0,SELECT_BY_POS);
OrderClose(OrderTicket(),1,Bid,100,clrBlack);
OrderSend(Symbol(),OP_SELL,1,Bid,100,0,0,NULL,0,0,clrAliceBlue);
}