Programming

wasp

Legendary member
Messages
5,107
Likes
880
Hi,

I am having a couple of issues with my API and the finer workings of the programming, and wondering if anyone knows any good sites for reference, reading and possibly forums for programming, specifically Visual Basic 6?

Thanks
 
JonnyT who has not been around for a while had done extensive programming of API software, in fact he had totally automated his entire strategy but his preference was Java.


Paul
 
wasp said:
Hi,

I am having a couple of issues with my API and the finer workings of the programming, and wondering if anyone knows any good sites for reference, reading and possibly forums for programming, specifically Visual Basic 6?

Thanks

Try www.vbtutor.net/vbtutor.html

Alternatively you could download the free Microsoft VB.Net Express edition, which takes you through step by step developing code. Not VB6, but .net is the way to go imho. and it's as fast and powerful as C++ so they say.

Glenn
 
wasp said:
Are there many/any traders who utilise API's and have programmed themselves here?

Yep...Fully automated with IB's API and Excel / VB6. Self-taught, so I doubt I write the most elegant code but my stuff works. If you need any help let me know. It would make a nice change to contribute something constructive :LOL:. Though I can't promise that will last.
 
Cheers all,

Spam man, I won't ask you to contribute anything too constructive! :LOL: Can you recommend further reading for VB6? I have read through the 'Learn to Program with Visual Basic 6', yet something more related to programming for more trading specifics would be greatly appreaciated. I can design an interface for a China shop with my eyes closed no problems but thats not really helpful!

Also, the mention of VB6 vs net had me looking and found this. http://www.bitwisemag.com/copy/features/vb6/strangedeathofvb.html The part where it says Microsoft plan to faze out VB6 by 2008 doesn't exactly install confidence!
 
I have not read a single book on VB. I could probably count on my fingers the number of times I've needed to search out solutions on the internet. All my knowledge comes, basically, from trial and (countless) error(s) - assisted constantly by the VB editor help function which is extensive and full of examples. When I was first starting the macro recorder came in handy for simple stuff, like demonstrating what the code for selecting a particular cell looks like, but it sounds like you are well past that stage.

My approach has always been to decide what I want to do, and then find a way of doing it - so I'm not sure that a book detailing someone else's ideas on what constitutes programming for trading would have helped. The biggest benefit of VB for me has been in running data analysis/simulations where most of the time I'm shunting data around, formatting it, analysing it....shunting the results around, formatting them, analysing them....not really trading-specific, could be any data. I have never used any of the off-the-shelf packages that claim to do a similar job but I suspect I would find them impossibly restrictive.

As for the specifics of connecting to IB's API, they provide example code for pretty much everything so it's just a case of pinching the bits you need. This may sound daft, but I actually get at least as much satisfaction from seeing my API work flawlessly as I do from making a profit.

If you get any specific problems I'll help if I can.

wasp said:
Also, the mention of VB6 vs net had me looking and found this. http://www.bitwisemag.com/copy/features/vb6/strangedeathofvb.html The part where it says Microsoft plan to faze out VB6 by 2008 doesn't exactly install confidence!

Don't remind me. The thought of transferring to another language fills me with a nameless dread. I suppose I'll have to bite the bullet one day, but for the time being I'm going to make like an ostrich.
 
The part where it says Microsoft plan to faze out VB6 by 2008 doesn't exactly install confidence!

I wouldn't be too concerned about this as there are literally millions of legacy applications written in VB6 which would all have to be re-written in a new language and this simply wont happen. So although MS are talking of fazing it out they wont practically be able to do so (in my view)


Paul
 
Metatrader programming (indicator)

Hi all,

This is one for metatrader and if anyone knows how this can be done I'd be highly appreciative especially if it can be explained how too!

The link is a current available indicator and the attatched picture shows what I need/would like.

Its vital it does exactly (as written on chart) what I need it to and continues to produce as new levels S/R appear (In my view)...

Anyone any ideas?

http://codebase.mql4.com/627
 

Attachments

  • support and resistance (my way).gif
    support and resistance (my way).gif
    37.3 KB · Views: 353
Hi!

I can try to modify this one to get what you wanted tonight, but don't guarantee 100% the result as I haven't been programming MT4 for a while. So will try anyway.

The only question is: how do you define "a collection of candles"?

For example, what should algorithm do if it sees 2 candles with close tops/bottoms and starts drawing a S/R line but the next one goes over this line by 1 pip and therefore cancels it. However, by having 3 candles with close tops/bottoms now (wneh theit tops/bottoms are within some proximity of each other - by how much???) I can start another s/r line.

Or I shouldn't start a new line until the next candle goes out of it completely?

Well, I can do some reasonable assumptions myself (collection of tops/bottoms within 5 pips etc.)

But it seems to me that S/R line can be even started on top of just one canlde if it made a new high. In which case, you might want to define S/R as a collection of 1 or more candles where at least one candle before and one after are both on the same side from S/R. For instance, one candle before is totally above S/R and one candle after the collection is totally above S/R.
 
Last edited:
thanks, much appreciated if you can even get close! I'm getting nowhere fast!
 
Haven't finished it yet.

It allows only 8 indicator buffers. So the job will need a little twist and would take a little longer. Also, it will not look that nice. Metatrader is very limited for this sort of things. But I will try to push it to the limits realizing how useful the indicator can be.
 
Done it! Enjoy and tell me what you think. It does nearly everything you need.

Please note that you have to put 20 indicators on your chart all with different indices or use the chart template provided and then customise it as you wish.

You might want to read the comments at the beginning of mq4-file if you want to adjust my indicator slightly.
 

Attachments

  • s_r_lines_v1.zip
    4.3 KB · Views: 164
Egro,

You don't know how appreciated that is. At the London meet, drinks are on me!

One small thing though, the platfrom takes a long time to do anything now so can I reduce the number of, and thus speed it up a bit?
 
No prob. I don't drink too much-)): I was attracted to your strategy, reading through your journal etc... And besides I might need this indicator for myself as I use s/r levels quite a lot. Just never came to my head how easy it can be done even on stupid MT4.

It does start slowly on my PC as well. Don't know if it makes everything slower afterwards.
Yes, you can decrease the number of indicators to say 10. In that cas you will need to change the source code and recompile. After that you will need to delete indicators with lineIndex >= 10 (except one with lineIndex = 10) and save it as a chart template. However, you might also find some s/r lines missing. In that case you can modify other parameters (for example make delta for merging lines bigger or number of periods smaller, so that s/r lines get discarded sooner) It is all because you cannot predict how many s/r lines can potentially be present at any moment. 20 was enough, 10 - don't know.
 
Ok, made a few changes to make it working reasonably faster. I think I am quite annoyed myself to use this sluggish chart. So,

A new indicator script is attached. Chart tempate can be the same with the same 20 indicators, but in order to make it run faster you can create and set a global variable which will tell how many screens back should the first s/r line start. You can do it if you go to

menu "Tools->Global Variables" Then add a variable with a name "sr_last_screens" and put there, say, 3. It will mean 3*150 bars/candles back to start the first line from.

Also, another global variable "sr_spread_multiple" might useful if you switch to bigger time-frames and see too many s/r lines as far as 10 pips from each other. In which case you can set this variable to, say, 5. And 5*spread = 5*3 = 15 pips will become a new delta between two s/r lines to be considered for merging into one.

I have put this description to the mq4 file as well.
 

Attachments

  • s_r_lines_v2.zip
    4.5 KB · Views: 165
That is all great stuff egro and very much appreciated. Look forward to a few bevvies to extend my gratitude better.

I found the original S/R indicator as I showed you and it di the obvious based on the highs/ows of the candles and wicks but by using the candle instead, it just gives an excellent trailing opportunity as if it breaks and comes back through, its high % of the move over and if done on the wick high, it doesn't always offer that opp. Anyhow, I'll explain more in town on the 17th.

Cheers again
 
Yes, I liked the idea of s/r being based on close/open rather then high/low. Particular for Forex where we see all the spikes. And my system is based on end-of-period value when deciding whether to get out now or leave it to grow. That is the point - I have the indicator for myself as well.

And statistically taking close price is more reliable. Max of a period represents just an instant surprise that happened once and gone. As the price is moving only 30% of time and going flat for the rest 70% most likely to see where the resistance line is is to look at close price. And one candle's close is where another's open (unless the price gaps).
 
Top