ClickerBO/ClickerBO.mq5

113 lines
8 KiB
MQL5
Raw Permalink Normal View History

2025-05-30 14:46:21 +02:00
<EFBFBD><EFBFBD>//+------------------------------------------------------------------+
//| ClickerBO.mq5 |
//| Copyright 2022, Alexey Vochanskiy |
//| https://www.mql5.com/ru/users/vdev |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
#property strict
#define AU3_INTDEFAULT (-2147483647) // "Default" value for _some_ int parameters (largest negative number)
struct PointXY
{
int x;
int y;
};
#import "AutoItX3_x64.dll "
int AU3_PixelGetColor(int nX, int nY);
void AU3_MouseGetPos(PointXY &lpPoint);
// int AU3_MouseClick(/*[in,defaultvalue("LEFT")]*/LPCWSTR szButton, int nX = AU3_INTDEFAULT, int nY = AU3_INTDEFAULT, int nClicks = 1, int nSpeed = -1);
int AU3_MouseClick(/*[in,defaultvalue("LEFT")]*/string szButton = "LEFT", int nX = AU3_INTDEFAULT, int nY = AU3_INTDEFAULT, int nClicks = 1, int nSpeed = 0);
#import
input int MSTimerInterval = 500;
input int PutX = 0;
input int PutY = 0;
input int CallX = 0;
input int CallY = 0;
int mX = 0, mY = 0;
PointXY lpPoint;
int MaxTicket = -1;
int OnInit()
{
if(!ChartSetInteger(
0, // 845=B8D8:0B>@ 3@0D8:0
CHART_EVENT_MOUSE_MOVE, // 845=B8D8:0B>@ A2>9AB20
true // 7=0G5=85
))
{
Print(__FUNCTION__+", Error Code = ",GetLastError());
return(false);
}
AU3_MouseGetPos(lpPoint);
EventSetMillisecondTimer(MSTimerInterval);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
EventKillTimer();
}
//+------------------------------------------------------------------+
//| Timer function |
//+------------------------------------------------------------------+
void OnTimer()
{
//---
}
//+------------------------------------------------------------------+
//| ChartEvent function |
//+------------------------------------------------------------------+
/*void OnChartEvent(const int id,
const long &lparam,
const double &dparam,
const string &sparam)
{
}*/
void OnChartEvent(const int id, // 845=B8D8:0B>@ A>1KB8O
const long& lparam, // ?0@0<5B@ A>1KB8O B8?0 long
const double& dparam, // ?0@0<5B@ A>1KB8O B8?0 double
const string& sparam )
{
if(id == CHARTEVENT_MOUSE_MOVE)
{
AU3_MouseGetPos(lpPoint);
mX = (int)lparam;
mY = (int)dparam;
Comment("mX = ", mX, " mY = ", mY, " lpPoint.x = ", lpPoint.x, " lpPoint.y = ", lpPoint.y);
}
}
//+------------------------------------------------------------------+
//| Trade function |
//+------------------------------------------------------------------+
void OnTrade()
{
}
//+------------------------------------------------------------------+
//| TradeTransaction function |
//+------------------------------------------------------------------+
/*void OnTradeTransaction(const MqlTradeTransaction& trans,
const MqlTradeRequest& request,
const MqlTradeResult& result)
{
//---
}*/
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
}