Hello forum and hello world !

 

Hello to all.

im new to programming on mql but have been programming on c++ for years.

I need to start, so im asking, where do i begin?

Id like to write a script that checks all the current open positions and if they are older than x seconds And loosing more than y points (not pips, points) it close it.

I guess its quite simple, but i really don't know how to start.

If someone can help, ill be really gratefull.

thank u.

 

since you are a "old programmer" you might know the procedure ;)

read this: https://docs.mql4.com//

and this: https://book.mql4.com//

but since most of them is only basic stuff i suggest you download one of those scripts in the codebase: https://www.mql5.com/en/code and you will soon understand how all the stuff i going.

mql is, comparing to c++ a very very very simple language.

//z

 
zzuegg:

since you are a "old programmer" you might know the procedure ;)

read this: https://docs.mql4.com//

and this: https://book.mql4.com//

but since most of them is only basic stuff i suggest you download one of those scripts in the codebase: https://www.mql5.com/en/code and you will soon understand how all the stuff i going.

mql is, comparing to c++ a very very very simple language.

//z


yes, quite simple, but there's no manual (or at least i can't find it) about the objects used, main proprieties of them etc...oh well ill look for it...im already gettin used...

i have a problem now:

Im tryng to backtest some demo ea's and some of mine scripts but, on sunday the spread is not the real one (and i can write code only during weekend...cuz im always working on week)...if u try to download backtest and launch a backtest,u can see on the pair propieties that the spread is 7-8 sometimes 10...i guess it just depends on the last tick of friday...but its not real

so if u try to backtest any scritp, the results will not be not ....real...

Any hint ?

 
johnny80:

yes, quite simple, but there's no manual (or at least i can't find it) about the objects used, main proprieties of them etc...oh well ill look for it...im already gettin used...

i have a problem now:

Im tryng to backtest some demo ea's and some of mine scripts but, on sunday the spread is not the real one (and i can write code only during weekend...cuz im always working on week)...if u try to download backtest and launch a backtest,u can see on the pair propieties that the spread is 7-8 sometimes 10...i guess it just depends on the last tick of friday...but its not real

so if u try to backtest any scritp, the results will not be not ....real...

Any hint ?

your assumption is true, mt4 don't use real tick data. only ask data of Period_M1 is safed, tick data gets calculated, spread is always the last tick. here in the forum is somewhere a spread_changer software which allows you to change the spread on a value you want.

but in general you should install a terminal, download the history you want and then set a fake proxy in you application so that mt4 will not connect to the internet anymore, and of course you then you have a fixed spread.


//z

Reason: