Orders Execution
Miscellaneous
0
Views
0
Downloads
0
Favorites
TL
//+------------------------------------------------------------------+
//| Ñèòíèêîâ Âàëåðèé ßêîâëåâè÷ valerasva@mail.ru |
//+------------------------------------------------------------------+
extern double Lot = 0.1;
extern double TrSt = 300;
extern double Slippage = 50;
extern double Risk = 0.1;
extern bool Îòîáðàæåíèå = true;
extern bool Çâóê = false;
extern double MAGICMA = 11;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
double line=0;
double line1=0;
double Lots=(NormalizeDouble(AccountFreeMargin()*Risk/1000.0,1));
if(Lots<Lot) Lots=Lot;
//+-----------------------------------------------------------------
for(int i = 0; i <= OrdersTotal(); i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol()==Symbol() && OrderMagicNumber() == MAGICMA) bool BuyOp=true;
}
//+-----------------------------------------------------------------
int obj_total=ObjectsTotal();
for(int k=0;k<obj_total;k++)
{
string name=ObjectName(k);
line1=ObjectGetValueByShift(name, 0);
{
if(Bid>line1-Slippage*Point && Bid<line1+Slippage*Point) line=line1;
}
}
//+-----------------------------------------------------------------
if(BuyOp==false)
{
if(Bid>line && Bid<line+Slippage*Point)
{
if(Îòîáðàæåíèå==false) OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Bid-TrSt*Point,0,"",MAGICMA);
if(Îòîáðàæåíèå==true) OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Bid-TrSt*Point,0,"",MAGICMA,0,Green);
if(Çâóê) PlaySound("alert.wav");
}
if(Ask<line && Ask>line-Slippage*Point)
{
if(Îòîáðàæåíèå==false) OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Ask+TrSt*Point,0,"",MAGICMA);
if(Îòîáðàæåíèå==true) OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Ask+TrSt*Point,0,"",MAGICMA,0,Red);
if(Çâóê) PlaySound("alert.wav");
}
}
//+-----------------------------------------------------------------
for(int cnt=0;cnt<OrdersTotal();cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==MAGICMA)
{
if(OrderType()<=OP_SELL && OrderType()==OP_BUY)
{
if(Ask<line && Ask>line-Slippage*Point)
{
if(Îòîáðàæåíèå==false) OrderClose(OrderTicket(),OrderLots(),Bid,Slippage);
if(Îòîáðàæåíèå==true) OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,Violet);
}
if(OrderStopLoss()<(Bid-Point*TrSt) && (Bid-OrderOpenPrice())>Point*TrSt)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrSt,OrderTakeProfit(),0);
}
}
else
{
if(Bid>line && Bid<line+Slippage*Point)
{
if(Îòîáðàæåíèå==false) OrderClose(OrderTicket(),OrderLots(),Ask,Slippage);
if(Îòîáðàæåíèå==true)OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Violet);
}
if(OrderStopLoss()>(Ask+Point*TrSt) && (OrderOpenPrice()-Ask)>Point*TrSt)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrSt,OrderTakeProfit(),0);
}
}
}
}
}
return(0);
}
// the end.
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
---