Orders Execution
0
Views
0
Downloads
0
Favorites
_LimitOrders_Mouse
//+------------------------------------------------------------------+
//| óñòàíîâêà ìûøêîé îòëîæåííûõ îðäåðîâ |
//| Copyright © 2012, Õëûñòîâ Âëàäèìèð |
//| cmillion@narod.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012, Õëûñòîâ Âëàäèìèð"
#property link "cmillion@narod.ru"
#property show_inputs
//--------------------------------------------------------------------
extern int Stoploss = 0, //ñòîïëîññ îðäåðîâ
Takeprofit = 0; //òåéêïðîôèò îðäåðîâ
extern double Lot = 0.1; //ëîò
extern int Magic = 0; //óíèêàëüíûé íîìåð îðäåðîâ ýòîãî ñîâåòíèêà, åñëè 0 òî âåäåò âñå îðäåðà, â òîì ÷èñëå âûñòàâëåííûå âðó÷íóþ
extern bool comment = true; //âûâîäèòü èíôîðìàöèþ íà ýêðàí
//--------------------------------------------------------------------
int start()
{
double SL,TP;
double Price = NormalizeDouble(WindowPriceOnDropped(),Digits);
string txt=StringConcatenate("Ñêðèïò âûñòàâëåíèÿ Limit îðäåðà ",DoubleToStr(Price,Digits)," ñòàðò ",TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS));
RefreshRates();
if(Price>Ask)
{
if (Takeprofit!=0) TP = NormalizeDouble(Price - Takeprofit * Point,Digits); else TP=0;
if (Stoploss!=0) SL = NormalizeDouble(Price + Stoploss * Point,Digits); else SL=0;
if (OrderSend(Symbol(),OP_SELLLIMIT,Lot,Price,0,SL,TP,"LimitOrders",Magic,0,CLR_NONE)!=-1)
txt = StringConcatenate(txt,"\nÂûñòàâëåí SELLLIMIT ",DoubleToStr(Price,Digits));
else txt = StringConcatenate(txt,"\nÎøèáêà ",GetLastError()," âûñòàâëåíèÿ SELLLIMIT ");
}
if(Price<Bid)
{
if (Takeprofit!=0) TP = NormalizeDouble(Price + Takeprofit * Point,Digits); else TP=0;
if (Stoploss!=0) SL = NormalizeDouble(Price - Stoploss * Point,Digits); else SL=0;
if (OrderSend(Symbol(),OP_BUYLIMIT,Lot,Price,0,SL,TP,"LimitOrders",Magic,0,CLR_NONE )==-1)
txt = StringConcatenate(txt,"\nÂûñòàâëåí BUYLIMIT ",DoubleToStr(Price,Digits));
else txt = StringConcatenate(txt,"\nÎøèáêà ",GetLastError()," âûñòàâëåíèÿ BUYLIMIT ");
}
if (comment) Comment(txt,"\nÑêðèïò çàêîí÷èë ñâîþ ðàáîòó ",TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS));
return(0);
}
//--------------------------------------------------------------------
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
---