Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 730

 

Good afternoon to all present. My question is not for traders, but rather for MKL4 programmers, because two of them could not help me, including the code developer himself.

My question is this: I have found a good template for news trading which disables trading during predefined periods before and after news release. I wanted to re-design it to open a position only some time after the news release. It seems to be not too difficult even for me - I added an additional flag, which prohibits trading at all times, except for a certain moment after the news release. All the time intervals are set in the settings.

And everything is fine, it works as it should, but with one essential point: it is necessary to recompile the code immediately before or at the time of news release. If this is not done, the Expert Advisor draws news lines but does not generate any messages and therefore does not open positions. It behaves differently and unstably on different pairs.

If there are some hardcore lovers on the forum, or maybe someone has faced similar problems, I will send the original code and my altered one to you in the PM, in order not to litter the air.

Thank you.

 
novichok2018:

Good afternoon to all present. My question is not for traders, but rather for MKL4 programmers, because two of them could not help me, including the code developer himself.

My question is this: I have found an EA template for news trading which disables trading in specified periods before and after news release. I wanted to re-design it to open a position only some time after the news release. It seems to be not too difficult even for me - I added an additional flag, which prohibits trading at all times, except for a certain moment after the news release. All the time intervals are set in the settings.

And everything is fine, it works as it should, but with one essential point: it is necessary to recompile the code immediately before or at the time of news release. If this is not done, the Expert Advisor draws news lines but does not generate any messages and therefore does not open positions. It behaves differently and unstably on different pairs.

If there are some hardcore lovers on the forum, or maybe someone has faced similar problems, I will send the original code and my altered one to you in the PM, in order not to litter the air.

Thanks.

Either zosore the airwaves or go freelance.
 

Greetings.

I have a DivergenceSolution indicator that creates "arrow" objects, those arrows on the chart from which I want to get data

Is it ok to enable it for testing, and if so, how?

The input parameters of the indicator are unknown, and only a small part of them is displayed when you start testing. And for this entry

b0 = iCustom(NULL, 0, "DivergenceSolution", 0, 1);

generates errors


 
Artyom Trishkin:
Either you're zoselling the airwaves or you're freelancing.

Does this mean that you take on the task?

 

People, here's the deal, I have a little experience with OOP in java, only used procedure in C++ at "Hello, world!" level.

I need to split the program into several parts, more precisely to separate some big functions, not to read a macaroni 1000+ lines, I understand you need to create separate files, from which then import these functions, but there is one detail. I wrote these functions using (and possibly changing)global variables of my ekspert and without their initialization the standalone function, of course, will not compile.

So here's the question: how to solve this problem nicely, as it is usually done in C++?

1) Simply set all the global variables as input parameters into a function by reference? That would be really cumbersome.

2)And if you declare all the same global variables in a hotel file of this function and then import it(function) and use it in the main program, will it work correctly?

 

Good afternoon. I have decided to display atr and spread in my EA. Can you please tell me how to make the spread in 2 digits and atp accordingly to the pair

int Spread=(int)MarketInfo(Symbol(),MODE_SPREAD);
double atr1440=iATR(Symbol(),1440,22,0);
Comment(      
           "atr1440 = " + DoubleToString(atr1440)+ "\n" +
           "Spread = " + DoubleToString(Spread));
 
Carcass77:

Good afternoon. I have decided to display atr and spread in my EA. Can you please tell me how to make the spread in 2 digits and atp accordingly to the pair


I would like to use a comma as the second parameter. After all, there are hints when writing code in the editor.
 
Artyom Trishkin:
It's a comma in the second parameter. After all, there are hints when writing code in the editor.

Thank you. Do I understand correctly that in this form I can't change the size of the characters or the colour?

 
Carcass77:

Thank you. Do I understand correctly that I can't change the size or colour of the characters in this view?

The size of characters can, the colour cannot.



string DoubleToString(

double value, //number

int digits=8 //number of digits after decimal point

);

 
Alekseu Fedotov:

Character size you can, colour you can't.



string DoubleToString(

double value, //number

int digits=8 //number of digits after decimal point

);

Sorry, I meant font size

Reason: