learning mql5

hayseed

Master Trader
Jul 27, 2010
1,048
262
149
usa
learning and converting mq5..... here's a good article from sergey pavlov on conversion...... migrating from mq4 to mq5......

it took me a hour just to figure out how to code hour in my alarm indicator..... seems appropriate......

will give explanations, reasons and charts as they are posted....... some will written by others.....

this alarm indicator is nothing more than a clock type alarm...... i use it to wake up for the london open or to alert me of any such time....

chose the easiest first......h
//------
 

Attachments

  • alarm.ex5
    7.9 KB · Views: 0
  • alarm.mq5
    2 KB · Views: 3

hayseed

Master Trader
Jul 27, 2010
1,048
262
149
usa
here is the tsr..... was coded by someone else......

it seems to me, that when the 10, 20 and 89 are falling, so is the price...... my focus is more on the 10 and 20 crossing the 89......

in the back of my mind are how the higher timeframes sit in their 10, 20, 89......

it seems to help when the higher tf's agree......h

//-----

mesm24-m1-amp-global-clearing-tsr.png


//-----
 

Attachments

  • TSR.ex5
    14.8 KB · Views: 0
  • TSR.mq5
    12.4 KB · Views: 4

Enivid

Administrator
Staff member
Nov 30, 2008
18,622
1,367
144
Odesa
www.earnforex.com
here is the tsr..... was coded by someone else......

it seems to me, that when the 10, 20 and 89 are falling, so is the price...... my focus is more on the 10 and 20 crossing the 89......

in the back of my mind are how the higher timeframes sit in their 10, 20, 89......

it seems to help when the higher tf's agree......h

//-----

mesm24-m1-amp-global-clearing-tsr.png


//-----
This one looks like an MA cross turned into a single color-changing line...
 

hayseed

Master Trader
Jul 27, 2010
1,048
262
149
usa
This one looks like an MA cross turned into a single color-changing line...
//----

it's just a colorized version of the hull moving average ...... my focus is when they agree on color on multiple timeframes.....

have not figured out how to code the mq5 ma cross, or any type cross yet,,,,, mq5 icustoms lacking the buffer component like mq4 has me confused......

mq4 is perfect for those of us that learned to code from knowing 0....... mq5, you almost need a formal c++ type education..... which i don't have......

but i don't give up......h
//------

mesm24-d1-amp-global-clearing-mes.png
 

hayseed

Master Trader
Jul 27, 2010
1,048
262
149
usa
practicing with multiple indicator alerts on multiple symbols.......

the symbols used here are for amp futures....... you would change those symbols to ones you were interested in......

string symlist[] = {"MYMM24", "MESM24", "MNQM24", "M2KM24", "MGCJ24"}; ........

change to something like, string symlist[] = {"EURUSD", "GBPUSD", "AUDUSD, "NZDUSD"};
//-----

wrote in qqe crossing 50, mfi crossing 50 and a fast hma crossing a slow hma......

inputs are true false...... if you want to run all 3, set all 3 true.......

i used envids qqe indicator...... and nikolay's hma...... the mfi is in the platform......

it will only check for alerts on the charts timeframe till i get in the tfs array..... eventually will cycle through multiple pairs and timeframes......

will expand this to multi level tf's with multi indicator combination alerts......

such as if 60 minute hma is falling and the 5 minute price breaks below the psar...... and so on.....

coded it as a expert advisor but it will not place or modify orders......

just learning so might be errors......h
//-----
alerts.png
 

Attachments

  • hma.mq5
    9.9 KB · Views: 3
  • hma.ex5
    11.8 KB · Views: 0
  • QQE.mq5
    15.1 KB · Views: 4
  • hma alerts.mq5
    7.3 KB · Views: 3
  • hma alerts.ex5
    14.2 KB · Views: 1
  • QQE.ex5
    29.9 KB · Views: 1

hayseed

Master Trader
Jul 27, 2010
1,048
262
149
usa
to undock charts to place each on a separate monitor, right click on the chart and select 'undock'......

then you can move it to a multiple monitor...... to redock, follow the same steps......

it's a good idea to redock all before closing down......h
//------

undock.png
 

hayseed

Master Trader
Jul 27, 2010
1,048
262
149
usa
changed name to alerts....... added psar......

ict gomers probably watching that gold chart looking like lead......h
//------

psar.png
//-----

late.png
//=====

mgcj24-m30-amp-global-clearing-ict.png
 

Attachments

  • alerts.mq5
    8.6 KB · Views: 3
  • alerts.ex5
    15.1 KB · Views: 0

hayseed

Master Trader
Jul 27, 2010
1,048
262
149
usa
made some changes......

setting chartsymbol to true will only check for alerts on that single symbol...... setting it to false will check all symbols in my symlist array.......

unless your using amp global trading futures, it might be best left true......

setting all to true will check for all alerts...... otherwise it will check only those set to true......

the macd function has dual alerts...... one for main line crossing the signal...... another for main crossing 0......

this is a work in progress...... so maybe errors.......

the psar function contains a method to fetch values from multiple symbols using mqlrates......

note to me, read this......

simple alerts first...... complex next......


learning to code methods to compare doubles, such as price breaking psar, will make writing experts somewhat easier......

that's in the future.......h

//------

mymm24-m1-amp-global-clearing-chart-only.png


//------
 

Attachments

  • alerts.ex5
    19.9 KB · Views: 0
  • alerts.mq5
    10.6 KB · Views: 1

hayseed

Master Trader
Jul 27, 2010
1,048
262
149
usa
first attempt at dashboard..... charts symbol only...... returns the buy/sell of the 3 hma's and mfi on 7 timeframes...... just noticed psar did not work...... need to recheck.....

next need to show , dow, nq, russell, s&p and gold all in the same dashboard......h
//-----

mymm24-m15-amp-global-clearing-dashboard.png
 

hayseed

Master Trader
Jul 27, 2010
1,048
262
149
usa
mq5 versions......

hma and hmacolor are nikolay's ....... they require the include smoothalgorythims......

tsr is metaquotes version of igor's slope direction line......

tsr plots differently..... i used hma in the dashboard.......

the goal is to vastly improve the dashboard reducing the need for chart clutter indicators...... eventually the dashboard will assess the indicators and return trade suggestions.....

including lot size, approximate trade length, with suggested targets...... trades placed manually in the apex futures account using tradovate......

apex as of now does not offer mq5......h
//------

mymm24-m5-amp-global-clearing-goal.png



//------
 

Attachments

  • colorhma.mq5
    12.1 KB · Views: 2
  • colorhma.ex5
    12.6 KB · Views: 0
  • hma.ex5
    12.1 KB · Views: 0
  • hma.mq5
    9.9 KB · Views: 2
  • smoothalgorithms.mqh
    267.6 KB · Views: 2
  • TSR.ex5
    15.5 KB · Views: 0
  • TSR.mq5
    12.5 KB · Views: 3

hayseed

Master Trader
Jul 27, 2010
1,048
262
149
usa
fixed psar and added qqe...... need to reduce the code by at least 50%......

occasionally after sell offs there will be a late day rally....... need one now......

today has not been very productive so far......h
//------
mymm24-m5-amp-global-clearing-eod.png
 

hayseed

Master Trader
Jul 27, 2010
1,048
262
149
usa
more changes...... need to make it multi symbol and order monitoring..... both open orders and order suggestions.....

eventually all 5, dow, nas, s&p, rus2k and gold will be viewed on the chart..... the little bomb symbol will be for an alert if the market turns against open orders on other symbols.... that part is not complete.....

below is the code so far...... relatively simple.....

should be easy to read......h
//------
mymm24-m15-amp-global-clearing.png

//------
 

Attachments

  • amp dashboard.ex5
    18.4 KB · Views: 1
  • amp dashboard.mq5
    9.2 KB · Views: 3

hayseed

Master Trader
Jul 27, 2010
1,048
262
149
usa
for some reason occasionally the butterworth filters will not plot..... that would make me wary of using them in a ea...... these are from witold wozniak......

but i think nikolay converted them to mq5......
//------

psar and zigzag have burnt me 3 times in a row past few days......

makes ya wonder.....h
//----
mnqm24-h4-amp-global-clearing-butterworth.png

//------
 

Attachments

  • threepolesupersmootherfilter.mq5
    12.5 KB · Views: 2
  • threepolesupersmootherfilter.ex5
    7.9 KB · Views: 0
  • threepolebutterworthfilter.mq5
    6.3 KB · Views: 2
  • threepolebutterworthfilter.ex5
    8.8 KB · Views: 0
  • twopolesupersmootherfilter.mq5
    6.2 KB · Views: 1
  • twopolesupersmootherfilter.ex5
    7.5 KB · Views: 0
  • twopolebutterworthfilter.mq5
    12.3 KB · Views: 1
  • twopolebutterworthfilter.ex5
    7.4 KB · Views: 0

hayseed

Master Trader
Jul 27, 2010
1,048
262
149
usa
in mq4, had to be careful to match each brokers symbols to the code..... so in the case of a ftmo ea, indicator, script, it had to be recoded to match nova, mffx, onada, topstep and so on.... they rarely carried the same symbols and more rare were the symbols the same....

this only had to be done once per broker..... once done and named per broker, it was done......


in mq5 and futures, this will have to be done per broker, quite frequently..... i'm only using mq5 with amp futures ........ but still, each time the traded contract moves to another month, almost all references to it must be changed to the new contract..... this will also include templates.....

just had to remove "MGCJ24" and replace it with "MGCM24"..... which moves the gold contract traded from april to june.....

volume will dwindle one one while increasing on another.......h

//------
mnqm24-m1-amp-global-clearing-2.png

 

hayseed

Master Trader
Jul 27, 2010
1,048
262
149
usa
looks like creating buttons and the onclick function needs no conversion at all...... mq4 compiles and works in mq5......

will try sending orders next week.......

also plan on writing a ea which has trailing psar buy stop or sell stop orders ...... trailing psar stop orders are important to me......

the ea below is just a mq5 test code example..... markets are closed now, so if you put it on a chart you must then change to another period.....

as is, it will not send orders..... clicking any button just alerts that the button was clicked......

to send orders , that function must be created and then added to the onclick line.....

mq5 looks difficult at first glace..... but might not be......h
//------




mymm24-m1-amp-global-clearing-buttons.png


//----
 

Attachments

  • amp buttons.ex5
    7.1 KB · Views: 0
  • amp buttons.mq5
    2.7 KB · Views: 3

hayseed

Master Trader
Jul 27, 2010
1,048
262
149
usa
learning mq5 can be a slow process...... occasionally coding something easy helps stay positive......

sometimes a simple count down type alarm is useful....

based in minutes..... horizontal and vertical default settings fit my current monitor, so might need adjusting.....

most useful to me counting down expected length before average signal change......h

//----

mymm24-m1-amp-global-clearing-2.png


//------
 

hayseed

Master Trader
Jul 27, 2010
1,048
262
149
usa
had a teacher long ago that when we would act up in class he would bust our butts with a paddle..... had trouble sittin down for the rest of the day..... we used to laugh about it.......

can't remember his name or even the course he taught......

had another teacher, she would make us stay in at recess and write some definition on the blackboard till all kids were back in their seats after recess.....

have no trouble remembering...... miss smith...... english...... adverb is a word that can modify or describe a verb, adjective, another adverb, or entire sentence.......

mq5 moving average comparisons....... repetition can be a subtle teacher.....h

//-------

mesm24-m1-amp-global-clearing-moving-average-dashboard.png


//------
mnqm24-m1-amp-global-clearing.png