Miscellaneous
0
Views
0
Downloads
0
Favorites
Schtirlitz_854
//+------------------------------------------------------------------+
//| Schtirlitz.mq4 |
//| Rosh |
//| http://forexsystems.ru/phpBB/ |
//+------------------------------------------------------------------+
#property copyright "Rosh"
#property link "http://forexsystems.ru/phpBB/"
#property show_inputs
extern int scht_ExpertMagicNumber=854;
extern bool scht_ShowProfitLabels=true;
extern bool scht_ShowTrace=true;
int scht_UpOpenArrow=1;
int scht_DownOpenArrow=2;
int scht_CloseArrow=3;
color scht_UpOpenColor=Blue;
color jd_DownOpenColor=Red;
color scht_CloseColor=White;
color scht_ProfitClose=Lime;
color scht_LossClose=DeepPink;
color scht_lastCloseColor;
int scht_TraceLabel=159;
int scht_CloseLabel=108;
int scht_traceCounter;
int scht_closeLabelShift=30;
//+------------------------------------------------------------------+
//| ïîñòàâèì ñòðåëêó |
//+------------------------------------------------------------------+
void SetArrow(datetime _time,double _price,string _Description ,int _arrowType, color _arrowColor)
{
bool res;
ObjectCreate(_Description,OBJ_ARROW,0,_time,_price);
ObjectSet(_Description,OBJPROP_ARROWCODE,_arrowType);
ObjectSet(_Description,OBJPROP_COLOR,_arrowColor);
// res=ObjectSetText(_Description,"Ïðîáà", 10, "Times New Roman", Green);
// if (!res) Print(GetLastError());
}
//+------------------------------------------------------------------+
//| ïðîòðåéñèì îðäåð |
//+------------------------------------------------------------------+
void scht_TraceOrder(int _orderTicket)
{
double priceCloseLabel;
string scht_openDescription;
string scht_closeDescription;
int scht_open_ArrowType;
int scht_orderType=OrderType();
color scht_orderColor;
if (scht_orderType==OP_BUY ||scht_orderType==OP_SELL)
{
double scht_openPrice=OrderOpenPrice();
double scht_closePrice=OrderClosePrice();
if (scht_orderType==OP_BUY) scht_open_ArrowType=scht_UpOpenArrow; else scht_open_ArrowType=scht_DownOpenArrow;
if (scht_orderType==OP_BUY) scht_orderColor=scht_UpOpenColor; else scht_orderColor=jd_DownOpenColor;
datetime scht_timeClose=OrderCloseTime();
datetime scht_timeOpen=OrderOpenTime();
if (scht_orderType==OP_BUY)
{
scht_openDescription="buy #"+_orderTicket;
}
else
{
scht_openDescription="sell #"+_orderTicket;
}
scht_closeDescription="close "+scht_openDescription;
SetArrow(scht_timeOpen,scht_openPrice,scht_openDescription,scht_open_ArrowType,scht_orderColor); // ñòðåëêà îòêðûòèÿ
SetArrow(scht_timeClose,scht_closePrice,scht_closeDescription,scht_CloseArrow,scht_CloseColor); // ñòðåëêà çàêðûòèÿ
if (scht_ShowTrace)
{
int scht_openShift=0;
int scht_closeShift=0;
while (Time[scht_openShift]>scht_timeOpen) scht_openShift++;
//scht_openShift--;
while (Time[scht_closeShift]>scht_timeClose) scht_closeShift++;
//scht_closeShift--;
if (scht_openShift-scht_closeShift>1)
{
for (int tr_shift=scht_openShift-1; tr_shift>scht_closeShift;tr_shift--)
{
SetArrow(Time[tr_shift],scht_openPrice,scht_openDescription+" "+scht_traceCounter,scht_TraceLabel,scht_orderColor);
scht_traceCounter++;
}
}
if (scht_ShowProfitLabels)
{
if (OrderProfit()>0) scht_lastCloseColor=scht_ProfitClose; else scht_lastCloseColor=scht_LossClose;
if (scht_orderType==OP_BUY) priceCloseLabel=High[scht_closeShift]+scht_closeLabelShift*Point ; else priceCloseLabel=Low[scht_closeShift]-scht_closeLabelShift*Point;
SetArrow(Time[scht_closeShift],priceCloseLabel,scht_openDescription+" "+DoubleToStr(OrderProfit(),2),scht_CloseLabel,scht_lastCloseColor);
}
}
}
}
//+------------------------------------------------------------------+
//| ïîäñ÷èòàåì êîëè÷åñòâî ñäåëîê ïî ñèìâîëó/èíñòðóìåíòó |
//+------------------------------------------------------------------+
int scht_SymbolTrades()
{
int scht_tradesOnSymbol=0;
int scht_allTrades=HistoryTotal();
int cnt;
for (cnt=0;cnt<HistoryTotal();cnt++)
{
if(OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY)==false)
{
Print("Îøèáêà ïðè äîñòóïå ê èñòîðè÷åñêîé áàçå (",GetLastError(),")");
break;
}
if ((OrderSymbol()==Symbol())&&(OrderType()==OP_BUY||OrderType()==OP_SELL)) scht_tradesOnSymbol++;
}
return(scht_tradesOnSymbol);
}
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
if (scht_SymbolTrades()==0) Alert("Ïî ñèìâîëó ",Symbol()," ñäåëîê íå íàéäåíî");
else
{
for (int cnt=0;cnt<HistoryTotal();cnt++)
{
if(OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY)==false)
{
Print("Îøèáêà ïðè äîñòóïå ê èñòîðè÷åñêîé áàçå (",GetLastError(),")");
break;
}
if ((OrderSymbol()==Symbol())&&((OrderMagicNumber()==0)||((OrderMagicNumber()!=0)&&(OrderMagicNumber()==scht_ExpertMagicNumber))))
{
Print("Ticket=",OrderTicket());
scht_TraceOrder(OrderTicket());
}
}
Comment("Äàííûå ïîëó÷åíû óòèëèòîé Øòèðëèö :) ");
}
//----
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
---