[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 406

 

Maybe anyone has encountered this problem. My regression line suddenly changes the slope to the wrong angle. For example on a sample up to 400 bar it is correct, but on 401 and above it is no longer correct.

PS/ Tried function from Candid, problem remains.

PS2/ function works, my faults were.

 
I encountered a similar problem a long time ago, somehow, somewhere in this code side is sitting, I did not look into itI had to write my own code. because of the age I can not find it now. look through the forum - there was a solution from Integer - there correctly.
 
FAQ:
I encountered a similar problem a long time ago, somehow, somewhere in this code side is sitting, I did not look into itI had to write my own code. because of the age I can not find it now. look through the forum - there was a solution from Integer - there correctly.

Thanks
 

Good afternoon!

As a newbie I have this question to the below code of the future expert.
On test on 5 timeframe an error 4054 appears - incorrect use of array-timeseries. Why? If I can't use data of 15-minute array on 5-minute one, why do I need to specify TimeFrame in function iMA for example?

The data for the testing period are available both on M5 and M15.

Thank you in advance for your attention!

extern int ma1_period = 015;
extern int ma1_type = 001;
extern int ma1_price = 000;
extern int ma1_shift = 000;
extern int ma1_timeframe = 015;
extern int ma2_period = 030;
extern int ma2_type = 001;
extern int ma2_price = 000;
extern int ma2_shift = 000;
extern int ma2_timeframe = 015;

double id[10,10];

//+------------------------------------------------------------------+
//| expert initialisation function |
//+------------------------------------------------------------------+
int init()
{
//----
//---
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialisation function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
for (int q=0;q<=5;q++)
{
id[0,q]=NormalizeDouble(iMA(NULL,ma1_timeframe,ma1_period,ma1_shift,ma1_type,ma1_price,q),Digits);
int err1=GetLastError();
id[1,q]=NormalizeDouble(iMA(NULL,ma2_timeframe,ma2_period,ma2_shift,ma2_type,ma2_price,q),Digits);
int err2=GetLastError();
}
//----
Comment("\n ma1 error: "+err1+" ma2 error: "+err2+"\n ma1: "+DoubleToStr(id[0,0],Digits)+" ma2: "+DoubleToStr(id[1,0],Digits));
//----
return(0);
}
//+------------------------------------------------------------------+

Files:
timeframe.mq4  2 kb
 

To wiioner

Ran your 5-minute history expert for a month in visual mode - not a single error came up.

 

hello all !

1) how to get an array of Close prices for x bars from another instrument (not the one the indicator hangs on) ?

2) how to get the ratio of synchronous Close prices for the instrument on which the indicator is hovering and another instrument, i.e. how to divide the prices of one instrument by the prices of the other for a certain number of bars?

 
eternal2:

hello all !

1) how to get an array of Close prices for x bars from another instrument (not the one the indicator hangs on) ?

2) how to get the ratio of synchronous Close prices for the instrument, on which the indicator hangs, and another instrument, i.e. how to divide prices of one instrument by prices of another for a certain number of bars?

it doesn't work like this...

double a, b;
    int i;
    double Ratio(double a, double b) 
    {a = iClose(NULL, PERIOD_H1, i);
     b = iClose("NZDUSD",PERIOD_H1,i);
     return (a/b);
    }
 
eternal2:

that's not how it works...


Have you tried error handling?

There are several conditions.

1. The second instrument must be open in the market overview. And even better, if the chart with the necessary timeframe is opened (though not necessarily)

2) The 4066 error should be absent.

3) The whole code must be available for review, not just a part of it where you think the problem is located

 

Hello all!!! Can you please tell me how to make an EA to make a trade at the moment of opening of each bar?

 
Ruslan1:

Hello all!!! Can you please tell me how to make an EA to make a trade at the moment of opening of each bar?

A trade consists of 2 events: opening and closing. Give all the conditions.