No additional functionality, but I have added better user feedback to the basket trade management routine. Don't bother re-downloading unless this is an issue for you - first post as usual.
BASKET TRADE Management: Using multiple trade management EA's on basket trades 9 replies
Alternative Trade Management/Money Management Methods 3 replies
multi-purpose Stoch Alert 11 replies
DislikedI have re-coded the part-close routine. Sending a part-close so soon after an updated stop loss would often cause the close to fail.
Download from the first post here.
Ignored
// Spread function.
if(IncludeSpread==false) Spread=0
else{Spread=MarketInfo(Symbol(),MODE_SPREAD);
}
// StopLoss For Modify Buy Orders.
if(StopLoss==0) SLB=0
else{SLB=NormalizeDouble(Ask-(StopLoss+Spread)*MarketInfo(OrderSymbol(),MODE_POINT),MarketInfo(OrderSymbol(),MODE_DIGITS));
}
// TakeProfit For Modify Buy Orders.
if(TakeProfit==0) TPB=0;
else{TPB=NormalizeDouble(Ask+(TakeProfit+Spread)*MarketInfo(OrderSymbol(),MODE_POINT),MarketInfo(OrderSymbol(),MODE_DIGITS));
}
Disliked[b][color=DimGray]
Thanks for the update Steve.
By the way do you have any simple script(s) like your Market Short/Long that can simply modify the SL/TP for all orders opened and or pending, regardless of currency?
I keep having problems with my script as the SL/TP points get placed way off where they should, even though I'm using the MarketInfo() request. A similar version of the code below works great for buy basket orders. But when I use the code version below with the OrderModify() functions it fails to place SL/TP properly. I have...Ignored
DislikedI have added a basket trade jumping stop loss routine that can double up as a simple break-even function. Download from post 1.
Ignored
DislikedI don't, but you are getting there yourself, Aad.
Something we all keep forgetting in the early stages of programming is that Bid and Ask refer to the Bid and Ask of the chart onto which the script is loaded. This means your stoplosstakeprofit coding will only work properly with the trades that belong to that chart.
Use MarketInfo to overcome this, just as you have with your spread coding, i.e.
if(StopLoss==0) SLB=0;
else SLB=NormalizeDouble(MarketInfo(OrderSymbol(),MODE_ASK)*MarketInfo(OrderSymbol(),MODE_POINT),MarketInfo(OrderSymbol(),MODE_DIGITS));
...Ignored
// Modify All Opened Orders.
if(ModifyAllOpenedOrders==true)
for(int maCnt=0; maCnt<mTotal; maCnt++)
{OrderSelect(maCnt,SELECT_BY_POS,MODE_TRADES);
{if(OrderType()==OP_BUY)
OrderModify(OrderTicket(),0,NormalizeDouble(OrderOpenPrice()-StopLoss*MarketInfo(OrderSymbol(),MODE_POINT),MarketInfo(OrderSymbol(),MODE_DIGITS)),
NormalizeDouble(OrderOpenPrice()+TakeProfit*MarketInfo(OrderSymbol(),MODE_POINT),MarketInfo(OrderSymbol(),MODE_DIGITS)),0,CLR_NONE);
if(OrderType()==OP_SELL)
OrderModify(OrderTicket(),0,NormalizeDouble(OrderOpenPrice()+StopLoss*MarketInfo(OrderSymbol(),MODE_POINT),MarketInfo(OrderSymbol(),MODE_DIGITS)),
NormalizeDouble(OrderOpenPrice()-TakeProfit*MarketInfo(OrderSymbol(),MODE_POINT),MarketInfo(OrderSymbol(),MODE_DIGITS)),0,CLR_NONE);
}
}
DislikedI just wanted to say thanks for your efforts here. It takes guys like you to keep this place going. I have been using swiss army EA for as long as I can remember but yours has some options I always wish I had. I will surely try it and let you know how it goesIgnored
DislikedAad, that is because your script is only looking for open buy and sell trades; you have not told it to look for pending trades.
Highlight OP_BUY and press the F1 key to call up help. This will show you how to code for options such as OP_BUYSTOP.
Ignored
DislikedIs there any way someone could add a simple stoploss function to this EA? I love most of the option in this, except I don’t use the hedging or basket functions… I just would really love to have the EA place a stoploss if one is not present.
Thanks for your help!Ignored