Errors, bugs, questions - page 1776
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Compilation error
int f( const T& ) { return sizeof( T ); }
class A {};
void OnStart()
{
const A * const a = new A; //Error: 'T' - unexpected token
f( a );
}
In the Metatrader 4 Help about the iGator() indicator
[in] Источник данных, идентификатор одной из линий индикатора. Mожет быть любой из следующих величин:
MODE_GATORJAW - синяя линия (линия челюсти аллигатора),
MODE_GATORTEETH - красная линия (линия зубов аллигатора),
MODE_GATORLIPS - зеленая линия (линия губ аллигатора).
and below is an example
double diff=iGator(NULL,0,13,8,8,5,5,3,MODE_SMMA,PRICE_MEDIAN,MODE_UPPER,1);
Data source MODE_UPPER, I understand there is an error in the help
Compilation error (or rather no error message)
A() { ::ArrayResize( i1, 1 ); }
int i1[ ];
int i2[1];
void f1() const { i1[0] = 0; } //нет сообщения ошибки
void f2() const { i2[0] = 0; } //Error: 'i2' - member of the constant object cannot be modified
};
I found two errors when handling mouse button click event.
1. handling mouse wheel click event in OnChartEvent(). The idea is that the function generates the event (id == CHARTEVENT_MOUSE_MOVE) when the left mouse button is clicked (with and without holding it), the right mouse button (with and without holding it), but if the wheel is clicked, the event will be generated only when holding it. I.e. if you just press the middle key and immediately release it, the event will not be generated!
2. After processing the left mouse button press (sparam == "1") the event sparam == "0" will be generated. After the right mouse button is clicked (sparam == "2"), for some reason the event sparam == "0" is not generated. Shouldn't all mouse buttons be handled the same way? I am silent about clicking on the wheel, because, as I said in point 1 - no event is generated when the wheel is clicked.
Check code:
#property indicator_plots 0
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
ChartSetInteger(0,CHART_EVENT_MOUSE_MOVE,true);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| 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[])
{
return(rates_total);
}
//+------------------------------------------------------------------+
//| Обработка события графика |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
{
switch(id)
{
case CHARTEVENT_MOUSE_MOVE:
FuncMove(lparam,dparam,sparam);
break;
}
}
//+------------------------------------------------------------------+
//| Функция обработки события перемещения мыши |
//+------------------------------------------------------------------+
void FuncMove(const long lparam,// Х координата
const double dparam,// Y координата
const string sparam // Строковое значение статуса кнопки
)
{
Print(__FUNCTION__,": sparam = "+sparam);
}
//+------------------------------------------------------------------+
//| Функция деинициализации индикатора |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//--- Отписываемся от события передвижения мыши
ChartSetInteger(0,CHART_EVENT_MOUSE_MOVE,false);
}
//+------------------------------------------------------------------+
Compilation error (or rather no error message)
A() { ::ArrayResize( i1, 1 ); }
int i1[ ];
int i2[1];
void f1() const { i1[0] = 0; } //нет сообщения ошибки
void f2() const { i2[0] = 0; } //Error: 'i2' - member of the constant object cannot be modified
};
in the f2 function, the state of the A object changes, because the A::i2 array is not dynamic - all its elements belong to the A object
Compilation error
class B {
int A() { return 0; }
void f( int ) {}
void g() { f(A()); } //Error: 'A' - invalid cast operation
};
Dratuti. Question: how do I send a message to a user I haven't yet corresponded with on mobile browsers (android, apple)? I've looked from several different devices - nowhere is there a button "send a message", as well as "add to others". The user's page looks something like this, no buttons:
I've been saying that for a long time. so far they haven't said anything.
Found two errors in mouse button event handling.
Check.
Thank you, please check the number of the first visible bar on the chart: ChartGetInteger( 0, CHART_FIRST_VISIBLE_BAR );
The point is that if you disable chart scrolling and monitor the last visible bar, then at the moment of a new candle its number changes for some reason, although the chart does not move! The TF is M1 in order to be able to check faster. Start from the indicator:
#property indicator_plots 0
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- Подписываемся на событие движения мыши
ChartSetInteger( 0, CHART_EVENT_MOUSE_MOVE, true );
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| 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[])
{
return(rates_total);
}
//+------------------------------------------------------------------+
//| Обработка события графика |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,const long& lparam,const double& dparam,const string& sparam)
{
switch( id )
{
case CHARTEVENT_MOUSE_MOVE:
Print( __FUNCTION__," "+TimeToString( TimeCurrent(), TIME_DATE|TIME_SECONDS )+": sparam = "+sparam+", ",(int)ChartGetInteger( 0, CHART_FIRST_VISIBLE_BAR ));
break;
}
}