Questions from Beginners MQL5 MT5 MetaTrader 5 - page 439 1...432433434435436437438439440441442443444445446...1605 New comment Vladimir Karputov 2015.09.16 07:14 #4381 Leanid Aladzyeu:...How can I get the values of the arrays without calling the function? Or how to make an array remember the last values that were written?... In order to retrieve something from an array, you must first write this "something" to the array.Leanid Aladzyeu:...Or how to make an array remember the last values that were written?... For which conditions: Should the array be saved when the timeframe is switched or after reloading of the terminal? Leanid Aladzyeu 2015.09.16 08:22 #4382 Karputov Vladimir: If I want to take something from an array, I first have to write it into the array. For which conditions: should the array be saved when switching the timeframe of the chart or after reloading the terminal?not during the work of the EAIf I set returnee in the function, when there is an order in the market, it gives me null arrays (I set returnee before nulling arrays), Vladimir Karputov 2015.09.16 08:39 #4383 Leanid Aladzyeu: If an order is on the market it gives me zero arrays (I set the returnee before the arrays are zeroed), What are the arrays the order "gives"? Where are they declared and where are they filled in? Also, please insert the code correctly. pr0gre5 2015.09.16 18:13 #4384 Karputov Vladimir:The function parameters must be reverted back to the original version, otherwise they simply won't be called:Here is the code of the standard SignalAC file//+------------------------------------------------------------------+//| "Voting" that price will grow. |//+------------------------------------------------------------------+int CSignalAC::LongCondition(void)I understand it this way: the code sends a signal and the parametersdouble& price,double& sl,double& tp,datetime& expiration are needed to place an order,this is handled by another EA block? Discussion of article "MQL5 Discussion on the implementation MetaTrader 4 Client Terminal pr0gre5 2015.09.16 18:19 #4385 corrected the code to a variant:int CSampleSignal::ShortCondition(void)The expert started to do something, thanks for the tip! Vladimir Karputov 2015.09.16 19:43 #4386 pr0gre5: corrected the code to a variant:int CSampleSignal::ShortCondition(void)The expert started to do something, thanks for the tip! You are welcome. Ask, ask when and where you need it :) Aleksey Vyazmikin 2015.09.17 12:03 #4387 Such a question does this code serve to limit the calculation - counting only once on a new bar?static datetime TimeN=0; datetime TimeC=iTime(NULL,TF,0); if(TimeN==0)TimeN=TimeC; if(TimeN==TimeC) return(0); Vladimir Karputov 2015.09.17 15:50 #4388 -Aleks-: Such a question is this code used to limit the calculation - only count once on a new bar?static datetime TimeN=0; datetime TimeC=iTime(NULL,TF,0); if(TimeN==0)TimeN=TimeC; if(TimeN==TimeC) return(0);If the new bar is on an M1 timeframe, then we print a message://+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- static datetime TimeN; datetime TimeC=iTime(NULL,PERIOD_M1,0); if(TimeN==TimeC) return; TimeN=TimeC; // новый бар, выполняем код Print("New bar"); return; } Aleksey Vyazmikin 2015.09.17 17:12 #4389 Karputov Vladimir: If the new bar is on the M1 timeframe, print a message: So I'm right, this is a check for a new bar? Vladimir Karputov 2015.09.17 17:40 #4390 -Aleks-: So I'm right, it's a new bar check? If you mean my code - then yes, my code is a new bar check. 1...432433434435436437438439440441442443444445446...1605 New comment
...
In order to retrieve something from an array, you must first write this "something" to the array.
...
For which conditions: should the array be saved when switching the timeframe of the chart or after reloading the terminal?If I want to take something from an array, I first have to write it into the array.
not during the work of the EA
If I set returnee in the function, when there is an order in the market, it gives me null arrays (I set returnee before nulling arrays),
If an order is on the market it gives me zero arrays (I set the returnee before the arrays are zeroed),
The function parameters must be reverted back to the original version, otherwise they simply won't be called:
Here is the code of the standard SignalAC file
//+------------------------------------------------------------------+
//| "Voting" that price will grow. |
//+------------------------------------------------------------------+
int CSignalAC::LongCondition(void)
I understand it this way: the code sends a signal and the parametersdouble& price,double& sl,double& tp,datetime& expiration are needed to place an order,
this is handled by another EA block?
corrected the code to a variant:
int CSampleSignal::ShortCondition(void)
The expert started to do something, thanks for the tip!
corrected the code to a variant:
int CSampleSignal::ShortCondition(void)
The expert started to do something, thanks for the tip!
Such a question does this code serve to limit the calculation - counting only once on a new bar?
static datetime TimeN=0;
datetime TimeC=iTime(NULL,TF,0);
if(TimeN==0)TimeN=TimeC;
if(TimeN==TimeC) return(0);
Such a question is this code used to limit the calculation - only count once on a new bar?
static datetime TimeN=0;
datetime TimeC=iTime(NULL,TF,0);
if(TimeN==0)TimeN=TimeC;
if(TimeN==TimeC) return(0);
If the new bar is on an M1 timeframe, then we print a message:
If the new bar is on the M1 timeframe, print a message:
So I'm right, it's a new bar check?