The point doesn't change - you are trying to delete a pending orderwith a ticket "0" on every tick.
And who says that you have a pending order with a "0" tick on every tick? Have you checked how many pending orders there are? And how do you know that ....?
With which tick is "0"??? OrderGetTicket(0) does not mean that an order with ticket 0 is selected, but returns a ticket order from the list of pending orders under index 0.
You probably need to be more specific in your task.
For example: if there is a pending order whose magic is "1" - then delete it.
In this case, the implementation will be as follows:
#include <Trade\Trade.mqh>
CTrade trader;
intOnInit()
{
trader.SetExpertMagicNumber(1);
return(INIT_SUCCEEDED);
}
voidOnDeinit(constint reason)
{
//---
}
voidOnTick()
{
for(int i=OrdersTotal()-1;i>=0;i--) // returns the number of current ordersif(OrderGetTicket(i)>0) // selects the pending order by index for further access to its propertiesif(OrderGetInteger(ORDER_MAGIC)==1)
trader.OrderDelete(OrderGetTicket(i));
}
Loop through all pending orders
If a pending order has been successfully selected (the returned value is the ticket greater than zero)
If the magic value of the selected pending order is "1"
With which ticket "0"? OrderGetTicket(0) does not mean that an order with ticket 0 is selected, but returns a ticket of an order from the list of pending orders under index 0.
That's not really the question - how much memory do I need to buy to make such a test possible?
here's the result for one symbol (from the log in opening price mode)
264 Mb memory used including 6 Mb of history data, 64 Mb of tick data
here's 2:
271 Mb memory used including 12 Mb of history data, 64 Mb of tick data
3:
1038 Mb memory used including 12 Mb of history data, 832 Mb of tick data
And here's 4:
1450 Mb memory used including 18 Mb of history data, 1216 Mb of tick data
It wentexponentially:) I can't trace the logic, as the ticks are about the same:
EURUSD,H1: 21470549 ticks, 94233 bars generated. 63097850 total ticks for all symbols
EURUSD: generate 21470549 ticks in0:00:05.375, passed to tester 21470549 ticks
USDCAD: generate 20302871 ticks in0:00:05.062, passed to tester 20302871 ticks
USDJPY: generate 21324430 ticks in0:00:05.641, passed to tester 21324430 ticks
1450 Mb memory used including 18 Mb of history data, 1216 Mb of tick data
I've seen many reports of 20 or more characters, I do not believe that someone uses terabytes of RAM. Maybe there is a secret?
Is it possible to set the number of graphical buffers in the indicator?
And the second question, is there a possibility of forced reinitialization of the indicator used by the Expert Advisor in order to save RAM?
It is possible to decrease the number of indicator_plots stated in #property indicator_plots, I did it. But it is hardly possible to increase it. But this decrease will not lead to memory saving. After all, buffers remain. They are just transferred from INDICATOR_DATA to INDICATOR_CALCULATIONS and nothing more.
The stated in #property indicator_plots can be reduced, I did that. But increasing it is unlikely to be possible. But this reduction will not save RAM. The buffers remain, after all. They are just transferred from INDICATOR_DATA into INDICATOR_CALCULATIONS and nothing more.
Thank you for your reply. A cosmetic change to the number of buffers is not relevant, unfortunately.
I want to get MACD indicator handles from three timeframes in the OnInit() block. On the chart - it works, but in the tester it doesn't work, and the terminal hangs tight! So I want to get the data that doesn't exist? Can you please advise how to deal with it?
//+------------------------------------------------------------------+//| Test.mq5 |//| Copyright 2018, MetaQuotes Software Corp. |//| https://www.mql5.com |//+------------------------------------------------------------------+#property copyright"Copyright 2018, MetaQuotes Software Corp."#property link"https://www.mql5.com"#property version"1.00"//--- Количество периодов торгуемых символов#define NUMBER_OF_PERIODS 3ENUM_TIMEFRAMES Periods[NUMBER_OF_PERIODS]={PERIOD_M1,PERIOD_M2,PERIOD_M3};
int handles[NUMBER_OF_PERIODS];
//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+intOnInit()
{
//---ArrayInitialize(handles,INVALID_HANDLE);
for(int p=0; p<NUMBER_OF_PERIODS; p++)
{
if(handles[p]==INVALID_HANDLE)
{
handles[p]=iCustom(NULL,Periods[p],"Examples\\MACD");
Print(handles[p]);
if(handles[p]==INVALID_HANDLE) Print("Не удалось получить хэндл индикатора для символа !");
}
}
//---return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+voidOnDeinit(constint reason)
{
//---
}
//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+voidOnTick()
{
//---
}
//+------------------------------------------------------------------+
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
The point doesn't change - you are trying to delete a pending order with a ticket "0" on every tick.
And who says that you have a pending order with a "0" tick on every tick? Have you checked how many pending orders there are? And how do you know that ....?
With which tick is "0"??? OrderGetTicket(0) does not mean that an order with ticket 0 is selected, but returns a ticket order from the list of pending orders under index 0.
You probably need to be more specific in your task.
For example: if there is a pending order whose magic is "1" - then delete it.
In this case, the implementation will be as follows:
Loop through all pending orders
If a pending order has been successfully selected (the returned value is the ticket greater than zero)
If the magic value of the selected pending order is "1"
Delete it
With which ticket "0"? OrderGetTicket(0) does not mean that an order with ticket 0 is selected, but returns a ticket of an order from the list of pending orders under index 0.
Yes, that's right.
Can you tell me how much RAM is needed to run the tester for 30 characters from 2004 to today?
The tester says there is not enough, but it doesn't say how much is needed.
Can you tell me how much RAM is needed to run the tester for 30 characters from 2004 to today?
The tester says there's not enough, but it doesn't say how much.
Run two characters, five characters ...
Run two characters, five characters ...
That's not really the question - how much memory do I need to buy to make such a test possible?
here's the result for one symbol (from the log in opening price mode)
here's 2:
3:
And here's 4:
It wentexponentially:) I can't trace the logic, as the ticks are about the same:
I've seen many reports of 20 or more characters, I do not believe that someone uses terabytes of RAM. Maybe there is a secret?
Is it possible to set the number of graphical buffers in the indicator?
And the second question, is there a possibility of forced reinitialization of the indicator used by the Expert Advisor in order to save RAM?
Is it possible to set the number of graphical buffers in the indicator?
And the second question, is there a possibility of forced reinitialization of the indicator used by the Expert Advisor in order to save RAM?
It is possible to decrease the number of indicator_plots stated in #property indicator_plots, I did it. But it is hardly possible to increase it. But this decrease will not lead to memory saving. After all, buffers remain. They are just transferred from INDICATOR_DATA to INDICATOR_CALCULATIONS and nothing more.
The stated in #property indicator_plots can be reduced, I did that. But increasing it is unlikely to be possible. But this reduction will not save RAM. The buffers remain, after all. They are just transferred from INDICATOR_DATA into INDICATOR_CALCULATIONS and nothing more.
Thank you for your reply. A cosmetic change to the number of buffers is not relevant, unfortunately.
I want to get MACD indicator handles from three timeframes in the OnInit() block. On the chart - it works, but in the tester it doesn't work, and the terminal hangs tight! So I want to get the data that doesn't exist? Can you please advise how to deal with it?