Agus Wahyu Pratomo:
I stopped at what could be your first problem:
if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && OrderComment()==EAComment && OrderMagicNumber()==MagicNumberSell)
Don't depend on OrderComment at all. Some brokers don't allow it or override it altogether.
But When im doing martingale script. First we buy then if price goes down it will open order buy again.
It work with same script .
void GoMartingale() { int iCount = 0; double LastOP = 0; double LastLots = 0; bool LastIsBuy = FALSE; int iTotalBuy = 0; int iTotalSell = 0; int Spread = 0; int Level = 0; Spread= MarketInfo(Symbol(), MODE_SPREAD); for(iCount=0;iCount<OrdersTotal();iCount++) { OrderSelect(iCount,SELECT_BY_POS,MODE_TRADES); if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderComment()==EAComment && OrderMagicNumber()==MagicNumberBuy) { if(LastOP==0) {LastOP=OrderOpenPrice();} if(LastOP>OrderOpenPrice()) {LastOP=OrderOpenPrice();} if(LastLots<OrderLots()) {LastLots=OrderLots();} LastIsBuy=TRUE; iTotalBuy++; if(iTotalBuy==MaxTrade) return; } } /* If Price DOWNTREND...., Check Bid (*/ if(LastIsBuy) { if(Bid<=LastOP-(Spread*Point)-(PipStepMarti*SetPoint)) { OrderSend(Symbol(), OP_BUY,NormalizeDouble((Multiply*LastLots),2), Ask, Slippage,0,0, EAComment, MagicNumberBuy); //ModifyTP(); LastIsBuy=FALSE; return; } }

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
Hi,
I want to make an EA with a strategy like the following.
Lets say I have a sell order. If the price then drops by xxx pips, it will open another order like averaging. And if the price continues to fall it will open the next order. Etc.
I made the following script, is there something wrong, why it open multiple sell order at the same time?
Maybe some one here can help me