KimIV, isn't there a script in your collection that would close all open Oredar: buy, sell, buystop, sellstop, buylimit, selllimit - forcibly, cyclically, to close without errors and all?
KimIV, do you have a script in your collection, like this one - ByMarketBuySymbols and ByMarketSellSymbols, only common, so that let's say the script opens 5 positions for buy and 2 for sell?
A suggestion: if possible, in the first post, post and update a list of your features/scripts with links to the relevant branch pages and a short description. Then it will be super-tool! Otherwise, someone somewhere about something "will send to Kim" and then flick here long to find ...
Moves the StopLoss price level of open positions using the TrailingStop algorithm. Function SimpleTrailing() accepts the following optional parameters:
sy - Name of the instrument. "" - any symbol, NULL - current symbol. Default value is "".
op - Trade operation. Valid values: -1, OP_BUY, OP_SELL. The default value is -1 - any trade.
mn - Trade identifier, MagicNumber. Default value -1 - any magik.
In addition, the SimpleTrailing() function implies global variables (external parameters of the script or Expert Advisor):
bool TSProfitOnly - Switches the zone in which the trawl starts. If True, the trawl will only start working when the position profit reaches the value of TStop.Buy/Sell+TrailingStep points. If False, the Expert Advisor will simply make sure that the stop position relative to the current price is always no further than TStop.Buy/Sell+TrailingStep pips. In other words, if True, the Expert Advisor works only in the profit zone of the position, while if False it works in the negative zone of the position.
int TStop.Buy - Size of the trall in points to buy.
intTStop.Sell - Trawl size in points for selling.
int TrailingStep - Trailing step in points. This is necessary to avoid frequent requests to the dealer.
//+----------------------------------------------------------------------------+//| Автор : Ким Игорь В. aka KimIV, http://www.kimiv.ru |//+----------------------------------------------------------------------------+//| Версия : 11.09.2008 |//| Описание : Сопровождение позиций простым тралом |//+----------------------------------------------------------------------------+//| Параметры: |//| sy - наименование инструмента ( "" - любой символ, |//| NULL - текущий символ) |//| op - операция ( -1 - любая позиция) |//| mn - MagicNumber ( -1 - любой магик) |//+----------------------------------------------------------------------------+void SimpleTrailing(string sy="",int op=-1,int mn=-1){double po, pp;int i, k=OrdersTotal();if( sy=="0") sy=Symbol();for( i=0; i< k; i++){if(OrderSelect( i, SELECT_BY_POS, MODE_TRADES)){if((OrderSymbol()== sy || sy=="")&&( op<0||OrderType()== op)){
po=MarketInfo(OrderSymbol(),MODE_POINT);if( mn<0||OrderMagicNumber()== mn){if(OrderType()==OP_BUY){
pp=MarketInfo(OrderSymbol(),MODE_BID);if(! TSProfitOnly || pp-OrderOpenPrice()> TStop. Buy* po){if(OrderStopLoss()< pp-( TStop. Buy+ TrailingStep-1)* po){
ModifyOrder(-1, pp- TStop. Buy* po,-1);}}}if(OrderType()==OP_SELL){
pp=MarketInfo(OrderSymbol(),MODE_ASK);if(! TSProfitOnly ||OrderOpenPrice()- pp> TStop. Sell* po){if(OrderStopLoss()> pp+( TStop. Sell+ TrailingStep-1)* po ||OrderStopLoss()==0){
ModifyOrder(-1, pp+ TStop. Sell* po,-1);}}}}}}}}
SZZ. An Expert Advisor with an example of SimpleTrailing() function use can be found here.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
There is no such function. Objects can only be created and managed on the chart to which the EA is attached.
Thank you for your prompt reply. Will it be available in Metatrader version 5?
http://forum.alpari-idc.ru/showpost.php?p=368730&postcount=24
Found it here already.
Thank you very much for a job well done.
A suggestion: if possible, in the first post, post and update a list of your features/scripts with links to the relevant branch pages and a short description. Then it will be super-tool! Otherwise, someone somewhere about something "will send to Kim" and then flick here long to find ...
Function MovingInWL().
Moves the StopLoss price level of open positions to Breakeven. Function MovingInWL() accepts the following optional parameters:
Moreover, MovingInWL() function has global variables (external parameters of script or Expert Advisor):
SZZ. You can find an Expert Advisor with an example of using the MovingInWL() function here.
If it's possible, in the first post, put and update list of your features/scripts with links to branch pages and brief descriptions.
The front page is already impossible...
I'll post it here... If the post to update gets blocked, I'll re-post it. So keep an eye on the thread :-)
SimpleTrailing() function.
Moves the StopLoss price level of open positions using the TrailingStop algorithm. Function SimpleTrailing() accepts the following optional parameters:
In addition, the SimpleTrailing() function implies global variables (external parameters of the script or Expert Advisor):
SZZ. An Expert Advisor with an example of SimpleTrailing() function use can be found here.
//------- Connection of external modules -----------------------------------------+
#include "b-Positions.mqh" // Work with positions
Where to find this file?
//------- Connection of external modules -----------------------------------------+
#include "b-Positions.mqh" // Work with positions
Where to find this file?
here