[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 536

 
If you delete all files with *.ex4 extensions in Indicators folder
- can I then compile all available *.mq4 files in one go?
(I.e., not each separately, but all together)
Thank you!
 
chief2000:
If you delete all files with *.ex4 extensions in Indicators folder
- can I then compile all available *.mq4 files in one go?
(I.e., not each separately, but all together)
Thank you!

Close the terminal, then open it and they will all compile themselves.
 
fore-x:
Close the terminal, then open it and it will compile itself.

This is what I was counting on, but only a few indicators compiled and nothing else.

 

Good afternoon how to write a standard advisor for another timeframe. I.e. put this indicator on the 1 hour chart which will show the 4 hour indicator.

пытался //+------------------------------------------------------------------+
//| at 4 o'clock.mq4 |
//| Copyright © 2012, MetaQuotes Software Corp. |
//| https://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012, MetaQuotes Software Corp."
#property link "https://www.metaquotes.net/"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 LightSeaGreen
#property indicator_color2 LightSeaGreen
#property indicator_color3 LightSeaGreen
//---- indicator parameters
extern int BandsPeriod=20;
extern inttern BandsShift=0;
extern double BandsDeviations=2.0;
//---- buffers
double MovingBuffer[];
double UpperBuffer[];
double LowerBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialisation function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,MovingBuffer);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,UpperBuffer);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,LowerBuffer);
//----
SetIndexDrawBegin(0,BandsPeriod+BandsShift);
SetIndexDrawBegin(1,BandsPeriod+BandsShift);
SetIndexDrawBegin(2,BandsPeriod+BandsShift);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Bollinger Bands |
//+------------------------------------------------------------------+
int start()
{
int i,k,counted_bars=IndicatorCounted();
double deviation;
double sum,oldval,newres;
int B=iBars( NULL,PERIOD_H4);
double C=iClose(NULL,PERIOD_H4,0);
//----
if(B <=BandsPeriod) return(0);
//---- initial zero
if(counted_bars<1)
for(i=1;i<=BandsPeriod;i++)
{
MovingBuffer[B-i]=EMPTY_VALUE;
UpperBuffer[B-i]=EMPTY_VALUE;
LowerBuffer[B-i]=EMPTY_VALUE;
}
//----
int limit=B-counted_bars;
if(counted_bars>0) limit++;
for(i=0; i<limit; i++)
MovingBuffer[i]=iMA(NULL,PERIOD_H4,BandsPeriod,BandsShift,MODE_SMA,PRICE_CLOSE,i);
//----
i=B-BandsPeriod+1;
if(counted_bars>BandsPeriod-1) i=B-counted_bars-1;
while(i>=0)
{
sum=0.0;
k=i+BandsPeriod-1;
oldval=MovingBuffer[i];
while(k>=i)
{
newres=C[k]-oldval;
sum+=newres*newres;
k--;
}
deviation=BandsDeviations*MathSqrt(sum/BandsPeriod);
UpperBuffer[i]=oldval+deviation;
LowerBuffer[i]=oldval-deviation;
i--;
}
//----
return(0);
}
//+------------------------------------------------------------------+

did not work

this side newres=C[k]-oldval;- '[' - unexpected token

The Bollinger Bands indicator.

 
I tried to use the tutorial to make an operation according to the time, everything seems to be correct, but the Expert Advisor is not active, for example, I need to run the function at 12.00

extern double Time_Cls=12.00;

int start()
{
int Cur_Hour=Hour();
double Cur_Min =Minute();
double Cur_time=Cur_Hour + Cur_Min100;
if (Cur_time==Time_Cls)
//my function
return;
}
 
audiomoroz:

I am trying to make a time-based operation from the tutorial, and everything seems correct, but the Expert Advisor is not active, for example the function should be run at 12.00;


if (Cur_time==Time_Cls)
//my function
return;
}
Because triggering algorithm execution by timer or catching the arrival of a tick with millisecond accuracy are different concepts.
 

Comrades,

My strategy tester on the same time interval (01.05.2011 - 27.01.2012), the currency pair EURUSD, on hourly bars (H1), from one brokerage company (Alpari) and the same Expert Advisor, but on different computers (laptop, desktop) shows opposite results! On the PC - $2000, on the laptop +3000. And there, and there tested for 2-3 times.

Please advise the cause and what to do and / or give me a link where that on the topic can be read.

 
chief2000:

This is what I was hoping for, but it only compiled a few indicators and nothing else.

It is necessary to delete mqlcache.dat file from the folder with indicators beforehand.
 
Zhunko:
You have to delete the file mqlcache.dat from the folder with the indicators beforehand.

Your solution worked!

Thank you very much!

 

I have a question -
Is it possible to know from the code of Custom Indicator whether the window in which it is running is currently active or not?
For example, the same Indicator is running in two windows - you need it to work only in the window which chart is active and inactive in the second window.

Thank you!