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

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
Dear fellow professionals, I need your help (pli-is). I want to make a function in my EA that displays a notification in the back corner of the screen about the current trend on different timeframes and the upcoming reversal. I am using my LinearRegression and Diverg functions for this purpose. However, I have never worked with theComment function and therefore cannot understand where I made a mistake. Anyway, the code below only displays the "Trend W = Down" message but I want it to show information for all other TFs as well.
void UPDN ()
{
if(LinearRegression(Symbol( ), LR_TFr_1, 0, Diver_Per_H1, 0) < 0) Comment("Trend H1 = Up");
if(Diverg(LR_TFr_1,0,Diver_Per_H1)<0) Comment("...!Pivot on H1 = Down");
if(LinearRegression(Symbol( ), LR_TFr_2, 0, Diver_Per_H4, 0) < 0) Comment("Trend H4 = Up");
if(Diverg(LR_TFr_2,0,Diver_Per_H4)<0) Comment("...!Pivot on H4 = Down");
if(LinearRegression(Symbol( ), LR_TFr_3, 0, Diver_Per_D1, 0) < 0) Comment("Trend D1 = Up");
if(Diverg(LR_TFr_3,0,Diver_Per_D1)<0) Comment("..!Pivot on D1 = Down");
if(LinearRegression(Symbol( ), LR_TFr_4, 0, Diver_Per_W, 0) < 0) Comment("Trend W = Up");
if(Diverg(LR_TFr_4,0,Diver_Per_W)<0) Comment("...!Pivot to W = Down");
if(LinearRegression(Symbol( ), LR_TFr_1, 0, Diver_Per_H1, 0) > 0) Comment("Trend H1 = Down");
if(Diverg(LR_TFr_1,0,Diver_Per_H1)>0) Comment("...!Pivot on H1 = Up");
if(LinearRegression(Symbol( ), LR_TFr_2, 0, Diver_Per_H4, 0) > 0) Comment("Trend H4 = Down");
if(Diverg(LR_TFr_2,0,Diver_Per_H4)>0) Comment("...!Pivot on H4 = Up");
if(LinearRegression(Symbol( ), LR_TFr_3, 0, Diver_Per_D1, 0) > 0) Comment("Trend D1 = Down");
if(Diverg(LR_TFr_3,0,Diver_Per_D1)>0) Comment("...!Pivot on D1 = Up");
if(LinearRegression(Symbol( ), LR_TFr_4, 0, Diver_Per_W, 0) > 0) Comment("Trend W = Down");
if(Diverg(LR_TFr_4,0,Diver_Per_W)>0) Comment("....W = Up");
return(0);
}
Dear colleagues-professionals, I need your help (pli-is). I want to make a function in my EA that displays a notification in the back corner of the screen about the current trend on different timeframes and the upcoming reversal. I am using my LinearRegression and Diverg functions for this purpose. However, I have never worked with the Comment function and therefore cannot understand where I made a mistake. Anyway, the code below displays only the "Trend W = Down" message but I want it to inform me about other TFs.
void UPDN ()
{
if(LinearRegression(Symbol( ), LR_TFr_1, 0, Diverg_Per_H1, 0) < 0) Comment("Trend H1 = Up")
if(Diverg(LR_TFr_1,0,Diver_Per_H1)<0) Comment("...!Turn at H1 = Down");
if(LinearRegression(Symbol( ), LR_TFr_2, 0, Diverg_Per_H4, 0) < 0) Comment("Trend H4 = Up")
if(Diverg(LR_TFr_2,0,Diver_Per_H4)<0) Comment("...!H4 trend reversal = Down")
if(LinearRegression(Symbol( ), LR_TFr_3, 0, Diver_Per_D1, 0) < 0) Comment("Trend D1 = Up")
if(Diverg(LR_TFr_3,0,Diver_Per_D1)<0) Comment("...!Pivot on D1 = Down");
if(LinearRegression(Symbol( ), LR_TFr_4, 0, Diver_Per_W, 0) < 0) Comment("Trend W = Up");
if(Diverg(LR_TFr_4,0,Diver_Per_W)<0) Comment(";)
if(LinearRegression(Symbol( ), LR_TFr_1, 0, Diverg_Per_H1, 0) > 0) Comment("Trend H1 = Down")
if(Diverg(LR_TFr_1,0,Diver_Per_H1)>0) Comment("...!H1 trend reversal = Up");
if(LinearRegression(Symbol( ), LR_TFr_2, 0, Diver_Per_H4, 0) > 0) Comment("Trend H4 = Down")
if(Diverg(LR_TFr_2,0,Diver_Per_H4)>0) Comment("...!H4 trend reversal = Up");
if(LinearRegression(Symbol( ), LR_TFr_3, 0, Diver_Per_D1, 0) > 0) Comment("Trend D1 = Down")
if(Diverg(LR_TFr_3,0,Diver_Per_D1)>0) Comment("...!Pivot on D1 = Up");
if(LinearRegression(Symbol( ), LR_TFr_4, 0, Diver_Per_W, 0) > 0) Comment("Trend W = Down");
if(Diverg(LR_TFr_4,0,Diver_Per_W)>0) Comment("...!Diverg to W = Up")
return(0);
}
Arrays cannot be passed to Comment(). Arrays must be printed element by element.
Data of double type is output with 4 decimal digits after the point. To print numbers with higher precision, use theDoubleToStr() function.
The bool, datetime and colour types will be printed as numbers.
To output datetime data as a string, use theTimeToStr() function.
To split the output into multiple lines, you may use line feed character "\n" or "\r\n".
See alsoAlert() andPrint().
Thank you, I got it. I need to enter variables according to the results of LinearRegression and Diverg functions for each TF and then output them with one comment, can be in several lines.
Thank you, I got it. I need to enter variables according to the results of LinearRegression and Diverg functions for each TF and then output them with one comment, can be in several lines.
There is only a limitation in terms of line length. You can use the function of Alexander Pak. If you can't find it, I'll look for it myself
Dear Sirs!
I have a question about passing an array by reference.
The algorithm scheme is as follows:
We pass an array by reference from one library to another.
We copy it there using the built-in function:
ArrayCopy.
Next, the array passed by reference is used
in the first module.
But for some reason, an error occurs, and not always.
I.e. sometimes the array is copied, sometimes it's not.
What's the reason?
The log entry is as follows:
21:07:12 openHistory CADCHF,H1:
2 arrays ranges for ArrayCopy function (0 and 4)
That's because you copied my example wrong. Look carefully where is the i and where is the k.
Corrected the code according to yours.
When testing, four orders closed in the order they were set on the first tick, the fifth closed on the next tick. Probably something else is wrong here as I have tested it many times.
I am pasting the program code and logs of the tester.
Sincerely. Shurkin
You have to loop the start. Work inside the loop. You can do anything there.
This is a little different. when the connection is lost, the log says "Ping failed". it means there are fi ries, but they are not documented for some reason.
How much of the load on the CPU and memory is increased by looping?
Good evening! Excuse me, I would like to return to an unsolved problem.
'Buy' - incompatible types D:\TeleTRADE\experts/experts/clean.mq4 (102, 53)
'Sell' - incompatible types D:\TeleTRADE\experts\clearlist.mq4 (102, 79)
This line does not compile.