
this the first lecture and you will see me talking about the course contents in brief description .
hop you will understand the idea behind the breakout strategy and what orders type i will put in . this strategy is so famous between traders and most of times it is profitable .
after completing the course feel free to make changes as you like .
i suggest trying to use movable sell stop order instead of sell order . i left this option up to you so as to examine your skills after my course
this lecture gives the students basic information's about price candles data and brief description about the strategy we planing to code in this course , students will know the breakout basics and what orders we will put after that breakout , and know some deference's between market sell order and pending buystop orders
here we will list only the necessary commands to code the breakout strategy they are 10 but they are very important to code any other strategy if you learn them well , you must know you dont have to learn all the 2000 commands in mq4 language to code a single strategy , but these 10 will make you capable to code most of them
order send is the main command for any expert adviser , without this command we cant send any order types ,the main reason to used expert adviser is to send trading orders , in this lecture you will learn the 11 elements of order send command in details because you will use all these element in your future and current comings
order modify is the second priority command in expert advisor coding it used to change or ad parameters to the opened orders by order send like adding take profits or stop looses or change the open prices for pending orders , in this lecture you will learn its elements in details
order select used to select an order from trading pool or history pool , trading pool contains only market opened orders (sell and buy ) that not closed yet ,also contains the inactivated pending orders (buystop-buylimit-sellstop-selllimit ) ..
history pool contains closed market orders and the deleted pending
you will learn how use this command correctly inside the for looping command ,
also order select used to pick the wanted candle on chart using the searcher inside the for looping
you will learn in this lecture the if statement function that is used to make conditions logic comparison , if these logic comparison come to true it will make a trading decision otherwise it will do somthing else like printing comment or stop trading all that according to our needs ,all these conditions my or my not separated by else or else if many times
# property used to protect and profs your ownership of the expert advisor by put some of your personal information's on the main window this command must be putted in global scope part , these information contains your link , icon, version , the name of the product or ant sentences you want to put in
# resource used to convert .bpm pictures and audio files to a code that can be read by the machine we will use this command to put our visual effects on chart
in this lecture you will learn how to start the mql5 wizard and the main parts of the wizard (global,initial,de - initialize , iteration ) and which one will be used in coding
also we will start the first code by starting a new function ( top()) ) by which we find the tops on chart
this is very important lecture you must deeply focus in , we start searching from candle number 2 because number 1 is breaking candle , so from candle 2 to candle 30 we are looking for a series of 3 bullish candle means closing price higher than opening price fallowed by 4 bearish candles means closing price less than opening price for each candle , when this done we will take the highest value of the middle candle then put its value inside internal variable called (result) then after searching ended we will return result value to top( ) function ,, whenever we call this function we will see its value equal to that top
we will use the object create function to put a horizontal line in the top price candle . we can find this command by searching the mq4 reference the browse to h-line type
if there is a new top formed after putting the horizontal line on previous top we will move the line using object move command by the same way of searching the reference for object move command then change its parameters to our one
sending orders always don by using the ordersend command , in this lecture we will know how to find this order by searching the reference , also we will start putting the breakout conditions inside if statement that will bound the ordersend ( ) command
in this lecture we learn how change the parameters of the copied buy order to ours ( lot , opening price , slippage , take profits , stop losses , color )
then how to put the sell order directly next to pending buylimit inside the same if statement
point value causing too much errors in mq4 coding it depend in streaming of the broker some of them send 5 and 3 digits for the pairs some others sends 4 and 2 digits , the problem appears when they sends a combined digits of all the above . there are many ways to pass this problem mine is unique way buy using the streaming of eur/usd pair to validate all brokers streaming type
here i will put the eur/usd pair digits in internal variable then use if statement checking comparison to set the correct point value
here we will retest the EA after correcting the point value . also you will know the deference's between buylimit and buystop pending orders and how we succeeded to put the pip distance between market sell and pending buystop orders
modifying orders used to put stop-losses for market orders and also to put and change its take profits or change all the parameters for pending orders
here we will create a separated function of void type to do that
inside this function we will bound the orders modify order by if statement conditions then bound the if statement by order select function then bound the order select by FOR looping ...
all these boundaries are necessary for searching and picking the right order to modify please focus deeply in this very important lecture because it is the main coders difficult to understand
we will complete the order modify function elements , here will put the if statement and copy the order modify command from reference with all its checking errors parts .
then we will start the conditions for modifying inside if statement parenthesis
in this lecture we will fix som common errors that repetitively happenstance in coding . also you will learn how to put stop losses for orders that has not
after putting the stoplose the price might drooped more in this case we will move this stoplose by 2 pip each time the drooped 50 pip.
in this lecture students will learn how to do that .
actually we will use the modify command again to change its parameters ,
this time we will change the if statement comparison by the fallowing way.
if the stoplose not equal to 0 and the BID price less than that stoplose by 50 pip then change the price of stoplose less than current price by 2 pip please focus well in this sentences it cant be simplified more than this way
in this lecture you will learn how to move buystop pending order down by using order modify again , i guess now you know the importance of this order ..
we will change the buystop open price by 2 pips each time the BID drooped 50 pips using if statement comparison again
in this lecture you learn how to calculate lot size automatically by creating a separate function .we will use the market information command to get maximum and minimum lot . the created function of double type because the returned lot contains numbers after the decimal point
this lecture to complete the auto lot size calculation
here we will identify the internal variable needed to return the lot to the main GET LOT created function then we will calculate the lot between min and max value using mathcil mathematics equation to calculate the final value ...
now we will put a stop-loss for the buy order if it activated from buystop pending order you must recognize the deference between pending buystop and normal buy orders very carefully , the second is pending while the first is normal activated when the price hit the pending one .
to do that we will use the order modify to put the stop-loss
to move the stoplose of buy order we need each to compare the current Bid price with the last changed stoplose if the deference grater than than 50 pip we change the stoplose by 2 pip. to do that we must use the order modify . and we must put the above comparison in IF statement
so as to be able to change the distance and shift of orders to be modified externally we simply put these parameters as extern type of double
optimization is Avery important process to choose the best settings for externally controlled parameters .for each parameter we must put the starting value , increasing step , final value by experience you will be able to choose a reasonable values for these steps and not exaggerate in it
by default new installed mt4 terminal stores only few history data inside his history folder , that is why we get a limited number of trades each time we increase testing period ... then we must download the complete history for tested pair .
to do that we go to tools then history center then choose the desired pair then hit download then wait according to your internet quality . by this way you download data with approximately 90% of accuracy . if you want 99% quality data there is some sites offer that quality in paid mode
here we will see the deference after and before downloading history data to mt4 terminal and you will learn also how to choose the best setting for the EA according to profit factor or number of trades or the lowest draw down
here you will learn how to put the testing results as a defaults inside the program code . also we will start using every tick mode to test the program then you will see the quality deference
if you want to trade at the closing or opening the new candle you must use the volume command to tell the EA doing that but if your code using BID or ASK prices to trade then you must not put volume command in the code . this lecture is to help you match the real streaming in both state
after deleting the data we must make sure of that deleting by going to offline chart folder then hit any time frame we will see a near date to current time .
also we will put the magic and risk factor as external variables to use a unique each one of them for each new chart without the need of re coding .
here we will use free pictures to put as an icon on the main window of the EA.
to do that we will search google and snap that picture then we will change its extension to .ICO .after that we will use online free cropper to make it circled icon
after that we will put it inside IMAGES folder
completing the ico uploading to cropper and circling the boundaries
we will snap 3 pictures for lightning effects of course you can snap more .these 3 pictures of dimensions 1000 X 600 we can get these dimensions by using paint in your pc to resize as the same
we will use any online to .BNP extension converter so as to get our accepted extension pictures
we will use paint program to resize the 3 pictures to 1000X600 dimension this program is available in any window version
we will put the path to ICO cat image inside #property command to change the default icon with cat icon
we will use #resources command to convert the 3 .bmp pictures to a code that can be read by the compiler after this done you can remove the bmp pictures from your terminal if you complete the total code and these pictures can be shown in any other terminal without the need of installing them
we will take any thunder sound which less than 4 seconds length .then put it inside Files folder to call later by #resources command by the same way we called .bmp image the deference are in the calling directories
you will learn where to find object create command then how to change its parameters and why to make these changes
in this lecture you will learn how put important probes for the object create command .
there are more than 12 probes to be added , but we will need 3 of them in this course
1- path directory to the file where we put the image inside
2-X distance from the left upper corner of the chart
3-background probe where we put the picture behind the chart candles so as not to cover and distorted the chart.
here we will complete the third prob adding (background prob )
all that for the first picture only
repeating probes adding for the 2 and 3 pictures
you will learn the play sound command so as to play the thunder sound simultaneously with lightning , you will learn how to change or putt the path to the files where we put the audio before
we can deactivate the visual effect by putting \\ before the containing rows or by put the the lightning function inside some boundaries like when the order send succeeded
we can control the visual effect externally by put a logic ( true or false ) externally this is the best choice because the special effects slowing down the optimization process severally then it must be deactivated external also you do not need it when you putt the expert inside vps server
here we will choose the right place for the lightning function inside the code .
that is the breakout point so we will put the same condition for the lightning as the breakout one
here we will make distance for sell order stoplose and another distance for the buystop pushing down .
so we will add sell distance and sell shift
also we add buy distance and buy shift
then we will repeat the optimization to see the deference's
we will use the first 5 ticks to control the lightning when breakout happening . that can be done using the volume command
repeating the optimization process after adding new external controlled distances to the EA
you will learn how to calculate orders totals by creating a separated function .
the need for this function is due to orders total command contains both auto and manually send orders we want to check only the orders created by our expert advisor so as not to be effected when we trade manually
here you will learn how to protect the EA against theft using the customer account number . if it is installed in any other account it will be deactivated and give an sound box alert
her we will use the time boundaries to deactivate the EA after a period of time using .. this is if you want to give the buy a trial copy or rent him the for a specific period of time
in this lecture you will learn how to make a templates for your chart after putting any setting to that chart like adding indicators or expert advisors or coloring the candles or resizing that candles the benefits of templates are to save these setting in terminal for later use without the need to repute them again manually .
here we will complete the manually putting of setting inside the optimized expert without the risk factor for the last pair aud/usd
now we will use the risk factor and learn how to save the best setting inside our terminal and why we must put a unique magic number for each pair .
and that if we want the expert to control each pair separately.
but if we want the expert to control all the pairs at once we will put the same magic for all pairs , in this case it will trade on the coming conditions at one pair and neglect the trades chances for other pairs if they come simultaneously with it
to be sure our expert is working well with all types of pairs ( 2,3,4,5 ) digits i will put it on 5 digits one ( EURUSD ) and 3 digits one (GBPJPY ) and one of crosses type ( AUDCHF ) . then we will fallow the same steps to save and upload the best setting as we did in previous lecture .
before uploading your terminal setting to vps you must be sure of each chart setting especially the magic number for each chart . it is better to re optimize the expert as we did in last lecture . you must close any chart that will not be used in hosting also remove the additional pairs from market watch . enable push notification in your terminal .try to start the hosting through your terminal after logging to you mql5 account that is better than using the web site . be sure to enable auto trading in both terminal and each chart expert
I ATTACHED THE FINAL COPY OF THE EXPERT , you can past it as is
on new mq4 empty project
price breakout exist periodically in any financial market charts because the price always moved in waves forms .these waves move some times fast or slow according to supply and demands rules ,whenever it beaked the support and resistance levels this called breakout move
these waves repetitively breaking important price levels like the tops , bottoms ,trends lines , Fibonacci levels daily pivots levels or any else . this course will teach you how to code the most successful and widely used forex strategy using only 10 commands , you will learn also visual effect coding to make your mt4 window nice and amazing with the lightning and thunder sound alerting .you will learn the strategy tester secrets and how to host your expert advisor in VPS .
you will learn the protection against theft technique.and also how to optimize you expert advisor when passing through the optimization process
you will be professional if you understand these 10 commands correctly. if you eager to learn coding you can after this course to code the most known complicated strategies using these 10 commands or a little more .
this course gives you the ability to understand the rest mql4 commands by just see the free programs in your mt4 terminal ,