learning to code

shadowninja

Legendary member
Messages
5,524
Likes
644
So, where's the best place for simpletons to learn to code MT4?

Thanks.

-ShadowSimpleton
 
So, where's the best place for simpletons to learn to code MT4?

Thanks.

-ShadowSimpleton

Hi shadowninja

did you make any progress in learning to code MT4.

After putting it off for far too long I've finally decided to have a go at learning it myself.

Unless I'm really thick or something I seem to have hit a brick wall right from the start.

No matter how many times I read the MT4 user guide I just don't seem able to get off first base ( I never had this problem with visual basic or Excel ). It just can't get my head around it.

When I read the user guide I get the impession it has been written by someone who is very very clever ( I've often found clever people to make poor teachers ), I also get the impession English is not their first language. So this really doesn't bode well for a thicky like me.


[tongueincheek]
Surely if JTrader can get his head around it then I can ? :cheesy:
[/tongueincheek]


All I want to do is get MT4 to draw a line from the previous low ( or high ), through the current low ( or high ) and then project that line forward one bar only.

Nowhere in the user guide can I find any reference to drawing commands

shadowninja, JT or anyone ?

thick_dastardly
 
Last edited:
I found that you can download other people's code to see how they did things.

In MetaEditor, click the Online Library tab at the bottom.
 
I found that you can download other people's code to see how they did things.

In MetaEditor, click the Online Library tab at the bottom.

Yes I tried that but it didn't seem to help any.

But if it worked for you then I'll spend some more time doing that and hopefully the penny might drop.

Cheers

dd
 
Oh dear ! My AV software has just detected a trojan ( TR/Dldr.Agent.aopv ) during its daily scan.

Guess I must have picked it up downloading some of those script files last night.

dd
 
Oopsie. Is that possible downloading stuff via MetaEditor? They're pure text files.
 
Oopsie. Is that possible downloading stuff via MetaEditor? They're pure text files.

I have some files that are lessons on how to code metatrader, starting from very basics and going through to coding a simple EA. I got them off a forum somewhere, not sure if it is here or elsewhere.

I'll attach them to this message if anyone is interested. I never actually read past lesson 2 so i can't vouch for them.
 

Attachments

  • MQL4 Tutorial - Lessons 01-10.zip
    822.5 KB · Views: 276
  • MQL4 Tutorial - Lessons 11-13.zip
    900.4 KB · Views: 235
  • MQL4 Tutorial - Lessons 14-17.zip
    740 KB · Views: 261
  • MQL4 Tutorial - Lessons 18 and Appendices.zip
    768.3 KB · Views: 234
Oopsie. Is that possible downloading stuff via MetaEditor? They're pure text files.


Hi shadowninja

Well I don't know TBH. I also opened some files that were attached to posts in this forum which automatically opened up in the MT4 editor thingy. These are the only files I've downloaded for quite some time on this particular PC and this is the first virus I've picked up for over a year I think. So I think it's more than just coincidence.



Hi UKtradergirl

Thanks for the files, I'll have a look.

I'll scan them first though just in case. I'm not really sure how to do that, think perhaps download them onto an mem stick and then scan the stick could be a way of doing it.

Cheers

dd


edit - OK I scanned the files and they came up clean. I opened up the first file and it looks like just the sort of thing I'm after. I'll read through them when I'm next in work :D
 
Last edited:
Lines, what a nightmare !

you need to use the ObjectCreate and ObjectSet functions

to create a trend line,
ObjectCreate("MyTrendLine",OBJ_TREND,0,StrToTime(sStartDate),pdblHigh,StrToTime(sEndDate),pdblLow);
where the dates and high / lows are obviously the values you want to use

then you can fanny aboot setting various bits and bobs, such as color, or thickness, style etc using the ObjectSet function e.g.

ObjectSet("MyTrendLine",OBJPROP_COLOR,Red);
ObjectSet("MyTrendLine",OBJPROP_RAY,False);

Wot I usually do is create the objects I want in the init function, then modify the objects properties in the start function

then in the deinit function use the ObjectDelete function to remove lines and stuff from the charts when the EA or indicator is removed.
 
I very much doubt a simpleton could learn to code in MT4. May as well bite the bullet & get someone else to do it for you, if you can trade yourself. Unless you want to be a programmer and not a trader. If you are trading successfully though, whats the point in learning to code? isnt that just a waste of valuable time? Splash a few pips!!!!
 
If you are trading successfully though, whats the point in learning to code? isnt that just a waste of valuable time?

Why learn to play the piano ?.....or to ski ?..... or touch type ?..... or a foreign language ?..... or how to use excel ?..... or drive a car ?..... or grow fuchsias ?..... or how to play bridge ?..... or knit ?.....or anything ?


dd
 
I very much doubt a simpleton could learn to code in MT4. May as well bite the bullet & get someone else to do it for you, if you can trade yourself. Unless you want to be a programmer and not a trader. If you are trading successfully though, whats the point in learning to code? isnt that just a waste of valuable time? Splash a few pips!!!!

A simpleton would probably struggle, but most people of average intellegence are more than capable of coding, even i can do it

The problem is there's a massive gap in perception between traders and coders, and that makes communiation of idea's difficult, kind of like the massive gap between a sea bass, and a zebra. Someone needs to close the gap, and its a damned site easier for a trader to familiarise themselves with code, than it is for a coder to familiarise themselves with trading. All software projects suffer due to coders lack of domain experience, and trading application are no different
 
I plan to have a look at the files mentioned above (thanks to the poster).
[Update: Aha, it was UKTradergirl - Many thanks UKTG!]

However, before I get down to that, am I likely to find in their pointers on how to code my own indicator?

What I want to do basically is to implement the following in MT4:

On Balance Volume

i.e. a better version of On Balance Volume. The basic formula seems to be:

Formula for improved On Balance Volume

Cumulative total of (volume * ((high-open) / (high-low))) -

Cumulative total of (volume * ((open-low) / (high-low)))

However, the URL shown is for other software, not MT4.


Can anyone give any shortcuts for implementing this into MT4?
(Must admit, I am totally new to MT4).

I am no stranger to programming, but not in a trading context. Familiar with the concept of algorithms, variables, loops, testing and debugging, and that kind of thing.
I'm prepared to get down and try to learn it properly over time. However, if anyone can offer a shortcut for this specific formula, I'd be obliged! :) Thanks in anticipation.

(Someone posted a formula very similar to this one (may have been identical), in this forum about 3 years ago, but it didn't include any coding.).

With thanks,
Regards,
M.
 
Last edited:
2nd Update: The lessons that UKTradergirl posted were exactly what I need to get going I think, so thank you very much again UKTG!

I've also found a load of examples, from URLs posted here, and also thanks to our friend Mr G.O.Ogle. Perhaps one shortcut would be to take as starting point Metastock's own ordinary OVB.

Perhaps it's not really for this thread, but is anyone making use of straighforward volume as part of their trading strategy or tactics?

Thanks,
M.
 
I have some files that are lessons on how to code metatrader, starting from very basics and going through to coding a simple EA. I got them off a forum somewhere, not sure if it is here or elsewhere.

I'll attach them to this message if anyone is interested. I never actually read past lesson 2 so i can't vouch for them.

Thanks for the links, I was looking for something like this too.

Eduardo :)
 
Top