Orders Execution
0
Views
0
Downloads
0
Favorites
__________ TakeProfit
//+------------------------------------------------------------------+
//| _TakeProfitMove.mq4 |
//| "ÑÊÐÈÏÒÛ ÄËß ËÅÍÈÂÎÃÎ" |
//| Ñêðèïò ïåðåìåùàåò TakeProfit íà Distance îò ðûíêà |
//| Bookkeeper, 2006, yuzefovich@gmail.com |
//+------------------------------------------------------------------+
#property copyright ""
#property link ""
//#property show_inputs
//+------------------------------------------------------------------+
extern int Distance=5; // Ðàññòîÿíèå îò ðûíêà |
extern bool UpDoun=true; //äëÿ òîëüêî "ïîäòàñêèâàíèÿ" ê ðûíêó =false |
//äëÿ è "ïîäòàñêèâàíèÿ" ê ðûíêó è "îòñêîêà" îò ðûíêà =true |
//+------------------------------------------------------------------+
void start()
{
double NewPrice;
int i,Total,Dist;
int Dgts=MarketInfo(Symbol(),MODE_DIGITS);
bool GoGo;
//+------------------------------- ÓÇÍÀÒÜ ÎÃÐÀÍÈ×ÅÍÈÅ ÑÂÎÅÃÎ ÄÖ -----+
// if(Distance<10) Dist=10;
// else
Dist=Distance;
//+------------------------------------------------------------------+
Total=OrdersTotal();
if(Total>0)
{
for(i=Total-1; i>=0; i--)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)==true)
{
if(OrderSymbol()==Symbol() && OrderType()==OP_SELL)
{
NewPrice=Bid-Dist*Point;
if(UpDoun==true) GoGo=true;
else
{
if(OrderTakeProfit()<NewPrice) GoGo=true;
else GoGo=false;
}
if(GoGo==true) if(OrderModify(OrderTicket(),
OrderOpenPrice(),
OrderStopLoss(),
NormalizeDouble(NewPrice,Dgts),
OrderExpiration(),
CLR_NONE)!=TRUE)
Print("LastError = ", GetLastError());
}
if(OrderSymbol()==Symbol() && OrderType()==OP_BUY)
{
NewPrice=Ask+Dist*Point;
if(UpDoun==true) GoGo=true;
else
{
if(OrderTakeProfit()>NewPrice) GoGo=true;
else GoGo=false;
}
if(GoGo==true) if(OrderModify(OrderTicket(),
OrderOpenPrice(),
OrderStopLoss(),
NormalizeDouble(NewPrice,Dgts),
OrderExpiration(),
CLR_NONE)!=TRUE)
Print("LastError = ", GetLastError());
}
}
}
}
}
//+------------------------------------------------------------------+
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---