Hello everybody!
I'm a new user of this forum and I'm trying to learn MQL4 to build a my own EA, but now I have a little problem with my code.
The MT4 doesn't read this part :
"
int H = OrdersTotal();
//CORREZIONE BUY
if (H>0)
{
OrderSelect(H-1,SELECT_BY_POS);
if(OrderType()==0 && OrderMagicNumber()==MG_BUY && OrderLots()==LOT && OrderStopLoss()==(OrderOpenPrice()-SL*Point) &&
OrderOpenPrice()>=(Ask+40*Point))
{
OrderSelect(H-1,SELECT_BY_POS);
OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss()+1*Point,OrderTakeProfit(),0,Green);
OrderSend(Symbol(),1,LOT*10,Bid,5,Bid+SL2*Point,Bid-TP2*Point,"DIS+3",MG_SELL,0,Red);
}
}
//CORREZIONE SELL
else if (H>0)
{
OrderSelect(H-1,SELECT_BY_POS);
if(OrderType()==1 && OrderMagicNumber()==MG_SELL && OrderLots()==LOT && OrderStopLoss()==(OrderOpenPrice()+SL*Point) &&
OrderOpenPrice()<=(Bid-40*Point))
{
OrderSelect(H-1,SELECT_BY_POS);
OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss()+1*Point,OrderTakeProfit(),0,Red);
OrderSend(Symbol(),0,LOT*10,Ask,5,Ask-SL2*Point,Ask+TP2*Point,"DIS+3",MG_BUY,0,Green);
}
}
"
I think the problem is this part of code : "OrderOpenPrice()>=(Ask+40*Point) / OrderOpenPrice()<=(Bid-40*Point)"
So I Tried also to change this part
with: "OrderOpenPrice()-(Ask+40*Point)>=0 / OrderOpenPrice()-(Bid-40*Point)<=0"
and with : " OrderOpenPrice()>=NormalizeDouble((Ask+40*Point),8) / OrderOpenPrice()<=NormalizeDouble((Bid-40*Point),8)"
and with : " NormalizeDouble(OrderOpenPrice(),8)>=NormalizeDouble((Ask+40*Point),8) / NormalizeDouble(OrderOpenPrice(),8)<=NormalizeDouble((Bid-
40*Point),8)
but It doesn't work !!
Can You Help Me , please ?
Thank You in Advance !
- Depth of Market - MetaTrader 5 for iPhone
- Depth of Market - MetaTrader 5 for Android
- Real and Generated Ticks - Algorithmic Trading, Trading Robots
Don't double post: http://forum.mql4.com/70922 Even here use the SRC button for your code!
Help me with a simple code that doesn't work, please ! - MQL4 forum
- www.mql5.com
Help me with a simple code that doesn't work, please ! - MQL4 forum
calli:
Don't double post: http://forum.mql4.com/70922 Even here use the SRC button for your code!
It's not a double post, it's an other forum.
Don't double post: http://forum.mql4.com/70922 Even here use the SRC button for your code!
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