Australian (ASX) Stock Market Forum

Metastock and FX

Joined
14 June 2007
Posts
1,130
Reactions
3
Anyone else chart FX with MS? I have lots of ideas but difficulty writing the code - my brain isn't wired too well for writing the complexity needed (the ideas are simple but the code is complex for me anyway). Anyways, just thought I'd test the waters and see if anyone is interested in collaboratively developing ideas. For example, I'm working on a trailing stop concept at the moment that adapts based on volatility. Choppier markets, further away...smoother markets, tighter in. See pic: blue line trails longs, red line trails shorts.
 

Attachments

  • stops.jpg
    stops.jpg
    126 KB · Views: 5
A couple of pointers?

If trading FX, maybe a better product to code your ideas in is MT4 which uses a much more powerful language than MS.

If you must use MS (for whatever reasons) have a look at some of the many examples of LeBeau Chandelier exits that can be found on the web. (Google) Perhaps you might be able to exploit Richard Dale's excellent (and free) trailing stop add-in available from http://www.tradernexus.com/advancedstop/advancedstop.html If you need some more specific examples get in touch, I might have something which might be useful?

If you are really to extend the complexity of your stops system in MS, I would suggest writing the code as an add-in. (You will need the MDK and a compiler; you can code in C/C++, PowerBasic, Pascal or any other language with a compiler which can create Win32 DLL)


Hope this helps

wabbit :D

(Perhaps you could shed some more light on the system/concept?)
 
Hi wabbit,

Thanks but it's not specific solutions I'm after, at least at the moment. Rather, I'm looking to see if others are interested in working together on ideas - the trailing stop is just an example of something I'm working on right now. It would be great to see some collaborative work on various ideas, similar to how people are helping each other in the scalping thread. I know you're an MS guru and if you say Metatrader is more powerful, I believe you, but I like MS and I'm comfortable with it for the moment.
 
Blagh! I'm tired and grumpy...and happy to do it on my own. Just thought there would be a bit more interest in community co-operation. Bah. Humbug. :cautious: :rolleyes:
 
I could join in a collaborative effort, but this will have to be either very quick or wait - - I am off on my annual three month holiday, leaving in less than two weeks. I will be back at the end of Feb '09 so if you're still looking then, give me a shout.



wabbit :D
 
The downside of Metastock is it really doesn't integrate well with trading platforms. But I'm slowly solving that for myself. Here's a screenshot of my current FX trading layout. All entry and stop values generated by MS are written to trade files. The DDE interface in Excel reads those files, calculates position sizes and creates orders. I've reduced it to a few buttons for buy, sell and cancel, which transmit the orders into IB. Buy/sell buttons also submit modifications to current open orders. It would be quite easy to take the next step and have the orders automatically submit rather than needing to press a button, but I have a few more kinks to work out before it's completely functional and safe to automate. Would be easier if I knew C.


Well, I'm excited....:D


Sad, I know.


(BTW, in case someone is wondering, the charts are only indicating entry points. Exits are not shown in this pic.)
 

Attachments

  • screen2.jpg
    screen2.jpg
    128.2 KB · Views: 14
Hi MS,

Obviously you have the IB TWS API working from Excel (I assume you use VBA, not calling another .dll?) so, it should be a "simple" matter to complete the project for autonomous trading.

Yes learning C/C++ might help out - - but as you seem adept at programming in VisualBasic, you might consider PowerBasic as an alternative as it is very similar to VB but can compile Win32.dlls. If you write standalone function libraries well, they can be called from any application, alleviating the dependence on just MS and Excel.


wabbit :D
 
Hi wabbit,

Alas, I am not even that advanced. I've figured out how the sample DDE file from IB works for the actions I need. I've then used the macro recorder in Excel to copy mouse and keyboard actions which I then assign to the various buttons. I can visually inspect the macro code to ensure it's not doing anything untoward, but I couldn't write it from scratch.

Learning ANY language would be progress on where I currently am. :)

Ps. And learning something is now a goal for me. What would you suggest as a good starting place for an absolute beginner?
 
I could join in a collaborative effort, but this will have to be either very quick or wait - - I am off on my annual three month holiday, leaving in less than two weeks. I will be back at the end of Feb '09 so if you're still looking then, give me a shout.



wabbit :D

wow ... 3 months ??? i like that lifestyle ... contaminate me with your ability to trade forex and lifestyle :D
 
Ps. Wabbit...re: my original reason for this thread - I discovered the Tradesim.dll handles trailing stops way more elegantly than anything I can come up with, so I've simply used it where necessary.

Pps. Hope Tibet is treating you well.
 
im keen to work on ideas.

i have a computer programmer business partner who's very adept at C and its derivatives.

i trust metastock uses a C derivative code?
 
wow ... 3 months ??? i like that lifestyle ... contaminate me with your ability to trade forex and lifestyle :D

I have done my time working... now I just study and trade. We take at least three months off each year to travel; this year we have several shorter trips planned, but we still envisage travelling for at least three or four months. Of course, if we get contracts then we might have to curtail our holidays somewhat, but then again we don't accept every contract that comes our way. Fortunately, we can pick and choose what suits us best each time.

As for trading fx: Last year I was working with IBFX, but I have today opened an account with GO Markets in Melbourne. I have several expert advisors that work with varying degrees of success. I believe the key to surviving in the fx market (and indeed any market) is good risk management and trade management. If you have these things squared away, you could trade by throwing darts at the chart and still make money; I believe specific entries and exits are secondary to the management skills.

A bit of luck also helps. (I recently read Nassim Nicholas Taleb:- Fooled by Randomness, The Hidden Role of Chance in Life and in the Markets. I thoroughly recommend this book to everyone.) I have my lucky EA, that if you are VERY aware that it is possible for the entire account to be wiped out in a single session, you can make a few dollars relatively easily (or lose the lot!)

I hope the new broker works as well for me as the old? I will be starting from scratch again, with a small test account. If the broker performs as expected, I shall increase the account; but only time will tell.

Ps. Wabbit...re: my original reason for this thread - I discovered the Tradesim.dll handles trailing stops way more elegantly than anything I can come up with, so I've simply used it where necessary.

Pps. Hope Tibet is treating you well.

Tradesim does have some nice stuff in it, but it is not as easy to customise as writing your own works.

Tibet was VERY cold. We didn't have a thermometer with us, but we guessed the temperature at Everest Base Camp (Tibet) to be about -20C, maybe colder? Although it was cold, the skies were clear and the winds were relatively gentle. Visibility was awesome at those altitudes. It beats me why more tourists dont travel to places like that at this time of year - - there are very few other people around (no crowds), everything is cheaper in the off season; you just have to put on some extra layers of clothes to cope with the cold!

Nepal was excellent. I thoroughly recommend that if you have ever thought of doing any trekking in Nepal that you go sooner than later. They are building a road around the Annapurna Circuit, and there is speculation that within a year or two there will be a road from Lukla to Everst Base Camp (Nepal). It's a shame, but they call it "progress"?! (This from a country which has 19 hours per day of blackout! (NO power) unless you bring your own generators!)

im keen to work on ideas.

i have a computer programmer business partner who's very adept at C and its derivatives.

i trust metastock uses a C derivative code?

Metastock has its own built in scripting language; it's nothing like C. However, if you have MetaStock Developers Kit, you can write and compile Win32.dll libraries of functions to be called from MetaStock (they also work for Bullcharts without modification). As you are writing Win32.dll files, you can write them in whatever language you like, C/C++, PowerBasic, Delphi Pascal etc, just so long as it's compile as Win32.dll


Hope this helps.

wabbit :D
 
As for trading fx: Last year I was working with IBFX, but I have today opened an account with GO Markets in Melbourne.

pretty much the same path ive taken. so far so good. let us know how you get on too.



(I recently read Nassim Nicholas Taleb:- Fooled by Randomness, The Hidden Role of Chance in Life and in the Markets. I thoroughly recommend this book to everyone.)

ill second that recommendation.


Metastock has its own built in scripting language; it's nothing like C. However, if you have MetaStock Developers Kit, you can write and compile Win32.dll libraries of functions to be called from MetaStock (they also work for Bullcharts without modification). As you are writing Win32.dll files, you can write them in whatever language you like, C/C++, PowerBasic, Delphi Pascal etc, just so long as it's compile as Win32.dll

ill forward that onto him and get his response. it went slightly over my head.

thanks for the post wabbit.
 
(I recently read Nassim Nicholas Taleb:- Fooled by Randomness, The Hidden Role of Chance in Life and in the Markets. I thoroughly recommend this book to everyone.)

You should read the follow up as well (The Black Swan). Its just as good.
 
Nizar,

Personally, I didn't enjoy the second book as much as the first. A lot of the stories, anecdotes and information was repeated and the author's smugness (for want of a better word) got worse in his second instalment.

The message though, is still loud and clear; well presented in both issues from Taleb.


wabbit :D
 
Hey wabbit, seeing you're still on now....

What's a good programming language to learn first for someone who's never really done any (beyond the basic MS and Excel scripts)?

Tibet and Nepal sound nice. I like the cold but I'd never get my wife there.

Cheers.
 
What's a good programming language to learn first for someone who's never really done any (beyond the basic MS and Excel scripts)?

One of the most powerful languages is C++. It's relatively easy to learn; start with one of those "teach yourself in 24 hours" type books and download a free compiler (there are dozens). Start simply with some command line applications like the ubiquitous "hello world" and work your way up from there. For the majority of instances, you wont be writing applications with its own graphical user interface, so you should be able to concentrate on "number-crunching" and algorithmic applications required to support trading.

Once you have a grip on a high-level programming language, it is quite easy to apply this knowledge and learn just about any other programming language by understanding the syntax of the new language. e.g. to do a loop in C/C++

for(int i=0; i=10; i++)
{
//do something
}

in Visual Basic
For i = 0 To 10 Step 1
//do something
Next i

in matlab
for i = (0:10)
//do something
end

All you have to know is the what you want to achieve and the syntax required to achieve that goal in the current environment.

Another reason to learn C/C++ is because it will give an introduction to a vital concept of memory management called "pointers" (You'll learn about them when you need them, so don't worry too much for now).


Hope this helps.

wabbit :D
 
Top