[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 298
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
Greetings to all connoisseurs and experienced readers of this thread! And just anyone who can help me=)
What is the easiest and "correct" way to achieve periodicity? That is, to simplify, I want to automatically perform some action every 15 minutes.
In my case, it's saving a file to disk with some statistics. Now I have a script that does what I want, and it's literally 20 lines of code. So how do I get those 20 lines to repeat at intervals? As I understood, there are no timers in MQL... Do I need to use an EA that will do some kind of check every tick...?
I hope for your help and tips)
For example check for a new bar at 15 min timeframe.
Or remember the start time and check the current time.
https://docs.mql4.com/ru/dateandtime/TimeCurrent
et=timecurrent();
if (et-bt>15*60) {bt=timecurrent(); load data}
I want a certain action to be carried out automatically every 15 minutes.
Can't the esteemed gurus help?
pvm117 20.10.2011 18:26
Good afternoon!
As a first experience I have decided to implement the following algorithm: I can expect a sharp market movement up or down in some time after the Bollinger lines converge into a narrow corridor. In my Expert Advisor, I analyze the state of Bollinger lines and when they are getting very close(Delta pips), we put a pending sell order in the lower direction (at stepOpen pips below the lower line), hoping that the market will suddenly go in that direction. If the market went in another direction, we simply delete this order.
The algorithm works unstable, sometimes opens two orders in short intervals, constantly gives errors OrderSend Error 130 and OrderSend Error 138, and removing open orders in case the market moves in another direction does not work at all.Please, advise us! Thank you!
For a tester and not to pay attention to the 130 error, it is simply not possible to place a stop order at this price.
Next it's up to you.
Guys, I'm new at this, help me find a bug please.
I tried to write an indicator to calculate the number of rising and falling candles for a certain period of history. I tried to write an indicator for this, it won't show up when I put it in the indicator window. What's wrong? Here is my code. Thanks in advance.
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
int Wh;
int Bl;
int a[];b[];
extern int History=500;
//+------------------------------------------------------------------+
int init(){
SetIndexBuffer(0,a);
SetIndexBuffer(1,b);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
return(0);}
//+------------------------------------------------------------------+
int deinit(){return(0);}
//+------------------------------------------------------------------+
int start()
{
int CountedBars=IndicatorCounted();
int i=Bars-CountedBars-1;
if (i>History-1) i=History-1;
while(i>=0)
{
if (Close[i]>Open[i])Wh++;
if (Close[i]<Open[i])Bl++;
a[i]=Wh;
b[i]=Bl;
i--;
}
return(0);}
Guys, I'm new at this, help me find a bug please.
I tried to write an indicator to calculate the number of rising and falling candles for a certain period of history. I tried to write an indicator for this, it won't show up when I put it in the indicator window. What's wrong? Here is my code. Thanks in advance.
Replace with
int a[],b[];
Go to
double a[],b[];
Ooh, thanks, it's working. I just don't understand why it has to be like this? The number of candles is an integer. Could you explain in a nutshell please?
Pay attention to types of parameters passed to SetIndexBuffer() function.
If you correct it some more:
it would be better...
Yeah, thanks, I've already noticed)))
Yeah, thanks, I've already noticed)))