советник не удаляет селл-стоп при срабатывании бай-стоп. Продолжает открывать и закрывать селл-стоп на текущем баре(4016 ордера было вкл/выкл).
//+------------------------------------------------------------------+
//| CvetFona.mq4 |
//| Copyright 2018, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, AM2"
#property link "http://www.forexsystems.biz"
#property version "1.00"
#property strict
#property indicator_chart_window
#import "user32.dll"
int GetDC(int hwnd);
int ReleaseDC(int hwnd,int hdc);
#import "gdi32.dll"
color GetPixel(int hdc,int x,int y);
#import
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
color ButtonColor(color clr)
{
color cl=clrNONE;
switch(clr)
{
case clrWhite:
cl=clrRed;
break;
case clrBlack:
cl=clrBlue;
break;
}
return(cl);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---
int hwnd=WindowHandle(Symbol(),Period());
int hdc=GetDC(hwnd);
color back_ground=GetPixel(hdc,1,2);
ReleaseDC(hwnd,hdc);
Comment("\n Цвет фона: "+(string)back_ground,
"\n Цвет кнопки: "+(string) ButtonColor(back_ground));
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
AM2