I'm enjoying the way you rather verbally process your thought process as your coding and explaining. That is the way many of us consolidate an idea to it's best result. Keep up the fine work. Thanks!
Great...Great...Great I have finally started to understand mql4 coding. I have gone to the mql4 web site been totally confused. Looked all over the youtube site and tried to follow other sites that were trying to explain mql4 but never could get it. Until now! Thanks so much and please keep up the good work.
Thanks Alistair. I am playing catch up, and writing notes like a school boy alongside the practical. I am now at the stage where I need to re-watch the videos. That didn't take long... Lol. Determined to dis-prove that ‘old dogs’ proverb!
For those who are watching after March 2023, the Normalized function seems to refer to the number of integers in the double including both sides of the decimal place. I put in a 1 and it worked.
This is a good revision on my general coding knowledge about function and variable. I can't really grasp the functions functionality before. I guess, looking it as a factory that receive raw materials to produce an output, kind of make sense. Thank you for the simple explanation.
OK, still playing catch up and I haven't watched lesson 5 yet but here is what I did to lose the decimal places: I changed "double point_spread;" to "int point_spread;" It worked and I feel stupidly chuffed with myself! Haha! Although I see from another viewer this wasn't the solution, it's the first time something clicked and I had the confidence to tinker. Cheers!
All you are teaching is how to create confusion. If you make an error you should correct it. Not just leave it unresolved, which gives the impression that you do not know too much.
Question, pBid and pAsk were never defined or given values or anything, how does the computer know to use the Ask/Bid prices from using pAsk and pBid instead of plain Ask and Bid?
When you call the function you put in your parameter values then, in MQL4 you can use the inbuilt variables for bid and ask and put them into your function.
The lesson are great, i learned a lot 2024 you video is till helping people ❤ But i have encountered a problem I input _point but there is no suggestion and it did not change colour but remain black Why please
@15:50, that's not a complete function even if you include the p variables. It will return compilation errors "Undeclared Identifier" for pAsk and pBid, and "Void function returns a value". I must commend you for teaching, but please ensure you fact check your examples prior to uploading content.
In Line 51, it should be current_spread = current_spread/_Point; then Line 52 should be point_spread = NormalizeDouble(current_spread,0); void OnTick() { //Calculate and display the current spread double current_spread; current_spread = CalculateSpread(Bid,Ask); string spread_message = "The current spread is: "; Comment(spread_message,current_spread);
} //+------------------------------------------------------------------+ double CalculateSpread(double pBid, double pAsk) { // create a spread variable, and give the bid ask spread as a value.
double current_spread = pAsk - pBid; //divide by _Point variable, to give spread in points double point_spread; current_spread = current_spread/_Point; point_spread = NormalizeDouble(current_spread,0); return point_spread; }
Really enjoy the course. Is there a basic programming course you could recommend? For instance, at 18 min you talk about functions and giving the inputs (pAsk) and sometimes leaving it blank. I would like something that will explain the difference to me. And I assume the principles are the same over almost all programming languages.
I don't really understand the question you are trying to ask but if the small p is confusing you he said the is no need for you to write it. It's just a way for him to tell that those are just inputs parameters so that he does confuse it along the way. The small p stands for parameters which is the input parameters sir. I think your confusing is cleared or atleast tried to be cleared. Am new to programming so don't be so shocked liked why a response after a whole year am new and am inspired to learn and make money so that I can teach others two. 😅😅
What I want to do or need to do if ... buy volume 1rst buy =0.01,2 buy=0.01. If loose buy=0.2. And 5 buy =0.2,10buy=0.2, 15 buy =0.2. Buy= 0.01 but if loose = 0.2
Sometimes you just want to do an action, without getting anything back. You use a function to open a trade for instance and not return the ticket or another function to create a button on the chart, for these you may decide you don't need to capture the return. As you'll practice you'll find examples of this...
Hello I dont know if you still reply to comments of old videos or even if you can see them, but i think i found the solution to the reason your code didnt work as planned. I havent watched the next video so as i type this I dont know if you solved it there. If you can please tell me if I got it right. void OnTick() { //--- double current_spread; current_spread = Calculatespread(Bid, Ask); string spread_message = "The Spread on this pair is: "; Comment(spread_message,current_spread); } double Calculatespread(double pBid, double pAsk) { double currentspread = pAsk - pBid; double point_spread; //convert the spread value to points point_spread = currentspread/_Point; //remove decimal point from the currentspread. double no_decimalspread; no_decimalspread = NormalizeDouble(point_spread,0); return no_decimalspread;
} Ps: Im really enjoying the course so far. Thanks.
Hey that looks like it'd work, does it? That's the cool thing about coding, it's actually quite creative and there is not one solution. The fact you've done some research and had a go is really cool!
@@toolkitfortraders Hey, Yes it does work. Thanks for the reply. I moved on to the book 'Expert Advisor Programming' by Andrew Young and Finished it, I Still go back to reference it when I'm stuck on a coding problem. I just want to thank you for your videos. Coding Expert Advisors is really fun and challenging and it has reignited my passion for Trading. Please resume creating videos, They help more than you know.
@@benfox7237 you got it. It can be a bit confusing sometimes, the terminology is not always consistent and the explanations are sometimes short. If you have any questions, lmk.
I'm confused about this lesson, you did not tell us the order of how to write the code and what is the structure of the sentences, the same way we learn we need a verb pronounce in a sentence etc
This lesson would have been so much better if you took the time to debug your code and show how just because the code compiles doesn't mean it is right.
Did you just turn "NormalizeDouble" function into a comment after spending 10 minutes on it ??? Seems like the result of this lesson was exact same result as last one. So what was the point of that NormalizeDouble function again? Last lesson was perfect but this one was very very very confusing
So the problem with that commented line of code is the variable used in NormailzeDouble should be "point_spread" instead of current_spread... point_spread = NormalizeDouble(point_spread, 0);
I'm enjoying the way you rather verbally process your thought process as your coding and explaining. That is the way many of us consolidate an idea to it's best result. Keep up the fine work. Thanks!
That's a great point, some Zoheb OGT mentioned to me. I'm thinking of doing a live full EA coding session. Where I'll talk through everything I do.
You should do a live classroom base "Let's Build An EA Together" - I would be first to join!
That's a great idea.
As your previous instructional video... Great job!! Thanks for posting these lessons
Great...Great...Great I have finally started to understand mql4 coding. I have gone to the mql4 web site been totally confused. Looked all over the youtube site and tried to follow other sites that were trying to explain mql4 but never could get it. Until now! Thanks so much and please keep up the good work.
No problem, glad I can help!
Thanks Alistair. I am playing catch up, and writing notes like a school boy alongside the practical. I am now at the stage where I need to re-watch the videos. That didn't take long... Lol. Determined to dis-prove that ‘old dogs’ proverb!
You can do it John, I'm sure it'll "click" soon.
For those who are watching after March 2023, the Normalized function seems to refer to the number of integers in the double including both sides of the decimal place. I put in a 1 and it worked.
This is a good revision on my general coding knowledge about function and variable. I can't really grasp the functions functionality before. I guess, looking it as a factory that receive raw materials to produce an output, kind of make sense.
Thank you for the simple explanation.
OK, still playing catch up and I haven't watched lesson 5 yet but here is what I did to lose the decimal places: I changed "double point_spread;" to "int point_spread;" It worked and I feel stupidly chuffed with myself! Haha! Although I see from another viewer this wasn't the solution, it's the first time something clicked and I had the confidence to tinker. Cheers!
Int is a good idea as it has no decimals. But it's the joy of coding there's many ways to get it right, you can be creative.
thanks
a lot was searching this kind of videos for 1 year lol
You made it very clear and simple ... thank u so much 👏
You are doing an amazing job man TY very much for the effort and everything. Your website is really cool and easy to acces too.
Much appreciated!
great educational video as always
Thanks as always Justin 😁
Here the solution for your problem for the Normalize :
point_spread = NormalizeDouble(point_spread, 0);
Winner winner chicken dinner!😀
All you are teaching is how to create confusion. If you make an error you should correct it. Not just leave it unresolved, which gives the impression that you do not know too much.
@@stevenjohnstone5833 Go away
Very good I hope I can use the EA that creates by you and learn how is EA work from your code.
Good luck Jun!
Question, pBid and pAsk were never defined or given values or anything, how does the computer know to use the Ask/Bid prices from using pAsk and pBid instead of plain Ask and Bid?
When you call the function you put in your parameter values then, in MQL4 you can use the inbuilt variables for bid and ask and put them into your function.
The lesson are great, i learned a lot
2024 you video is till helping people ❤
But i have encountered a problem
I input _point but there is no suggestion and it did not change colour but remain black
Why please
Thank you very much by the course
@15:50, that's not a complete function even if you include the p variables. It will return compilation errors "Undeclared Identifier" for pAsk and pBid, and "Void function returns a value". I must commend you for teaching, but please ensure you fact check your examples prior to uploading content.
In Line 51, it should be
current_spread = current_spread/_Point;
then Line 52 should be
point_spread = NormalizeDouble(current_spread,0);
void OnTick()
{
//Calculate and display the current spread
double current_spread;
current_spread = CalculateSpread(Bid,Ask);
string spread_message = "The current spread is: ";
Comment(spread_message,current_spread);
}
//+------------------------------------------------------------------+
double CalculateSpread(double pBid, double pAsk)
{
// create a spread variable, and give the bid ask spread as a value.
double current_spread = pAsk - pBid;
//divide by _Point variable, to give spread in points
double point_spread;
current_spread = current_spread/_Point;
point_spread = NormalizeDouble(current_spread,0);
return point_spread;
}
Really enjoy the course. Is there a basic programming course you could recommend? For instance, at 18 min you talk about functions and giving the inputs (pAsk) and sometimes leaving it blank. I would like something that will explain the difference to me. And I assume the principles are the same over almost all programming languages.
I don't really understand the question you are trying to ask but if the small p is confusing you he said the is no need for you to write it. It's just a way for him to tell that those are just inputs parameters so that he does confuse it along the way. The small p stands for parameters which is the input parameters sir.
I think your confusing is cleared or atleast tried to be cleared.
Am new to programming so don't be so shocked liked why a response after a whole year am new and am inspired to learn and make money so that I can teach others two.
😅😅
Just curious, why did you do the illustration right to left and not left to right?
2022 and love it
Still here :)
What I want to do or need to do if ... buy volume 1rst buy =0.01,2 buy=0.01. If loose buy=0.2. And 5 buy =0.2,10buy=0.2, 15 buy =0.2. Buy= 0.01 but if loose = 0.2
You need to keep track of the number of trades in a variable and add to it if a trade is a loser.
But,how to do it?
Im not sure I understand what you are trying to do. Can you explain again?
0.01, then 0.01,then 0.01 then 0.01 then 0.05. But if it loose buy 0.2.. then 0.01,then 0.01.
Very new to coding so probably a newb question but.. why would you create a function with a "void" output? Seems to defeat object of a function
Sometimes you just want to do an action, without getting anything back. You use a function to open a trade for instance and not return the ticket or another function to create a button on the chart, for these you may decide you don't need to capture the return. As you'll practice you'll find examples of this...
Hello I dont know if you still reply to comments of old videos or even if you can see them, but i think i found the solution to the reason your code didnt work as planned. I havent watched the next video so as i type this I dont know if you solved it there. If you can please tell me if I got it right.
void OnTick()
{
//---
double current_spread;
current_spread = Calculatespread(Bid, Ask);
string spread_message = "The Spread on this pair is: ";
Comment(spread_message,current_spread);
}
double Calculatespread(double pBid, double pAsk)
{
double currentspread = pAsk - pBid;
double point_spread;
//convert the spread value to points
point_spread = currentspread/_Point;
//remove decimal point from the currentspread.
double no_decimalspread;
no_decimalspread = NormalizeDouble(point_spread,0);
return no_decimalspread;
}
Ps: Im really enjoying the course so far. Thanks.
Hey that looks like it'd work, does it? That's the cool thing about coding, it's actually quite creative and there is not one solution. The fact you've done some research and had a go is really cool!
@@toolkitfortraders Hey, Yes it does work. Thanks for the reply. I moved on to the book 'Expert Advisor Programming' by Andrew Young and Finished it, I Still go back to reference it when I'm stuck on a coding problem. I just want to thank you for your videos. Coding Expert Advisors is really fun and challenging and it has reignited my passion for Trading. Please resume creating videos, They help more than you know.
Is there a reference somewhere for the built in functions and variables in MQL4?
Nevermind found it! docs.mql4.com/
@@benfox7237 you got it. It can be a bit confusing sometimes, the terminology is not always consistent and the explanations are sometimes short. If you have any questions, lmk.
Thanks a lot
Ta
here I am still wondering why the ask - bid variable is the opposite
how about time? what is code if I want to the MT4 open position every only at 21:00 my pc time?
where i have to store data? double? int? or string?
Time can be stored in a datetime type variable, check the MQL4 reference for that
I'm confused about this lesson, you did not tell us the order of how to write the code and what is the structure of the sentences, the same way we learn we need a verb pronounce in a sentence etc
string myName is camelcase no? Typical for javascript, but not used in mql4. Am I correct?
How can I calculate the highest price in a certain time range?
I've watched this particular tutorial about three times now and still did not get it, any help please!...
OK, what is a function?
Why would you write a function just to void it, sir?
Void just means that nothing is returned from the function. Void functions still work, but they typically are used to complete a task.
26:36 it says i have 2 errors i dont know what's wrong ?
What do the errors say?
This lesson would have been so much better if you took the time to debug your code and show how just because the code compiles doesn't mean it is right.
Check the next lesson 😜
Did you just turn "NormalizeDouble" function into a comment after spending 10 minutes on it ???
Seems like the result of this lesson was exact same result as last one. So what was the point of that NormalizeDouble function again?
Last lesson was perfect but this one was very very very confusing
So the problem with that commented line of code is the variable used in NormailzeDouble should be "point_spread" instead of current_spread... point_spread = NormalizeDouble(point_spread, 0);