Forex Signals Forex Trading Signals, Index Trading Signals, Forex News, Currency Trading News & Analysis

December 30, 2013

Create Your Own FREE Forex Data Downloader

Filed under: Forex General — Tags: , , , , — admin @ 5:32 pm

Throughout the years I’ve utilised MetaTrader to download data into programs such as AmiBroker for further analysis and tinkering with. While MetaTrader is a good tool for automating forex trading strategies, I’ve found it to be a little difficult to paint and play with the charts programatically. This is where downloading data to my computer and playing around with it more has been beneficial to me.

The only problem I’ve had is that no real solution has worked that well in downloading the data from my broker to my computer without me having to action it every time.

Until now.

I’ve found a relatively simple way of being able to obtain data from my MetaTrader installation located on my VPS to automatically update my forex history on my computer for use with AmiBroker. Obviously I could just install a local version of MetaTrader on my computer and run the script, but I’ve decided to go without and to see if the following set up can work – which it does, and quite nicely too.

Here’s how I’ve been able to get automatic updates of my forex history to my computer without having MetaTrader installed on my local computer:

  • First, I have MetaTrader humming away nicely on my VPS. You will need to open up a fresh blank chart, say on the EURUSD, and to add a new Expert Advisor that I’ve attached below (we’ll go through the code a little so that you can understand how to tweak it to fit your circumstances).
  • Second, I installed DropBox on to my VPS – make sure you enable selective sync otherwise your VPS will crash with all your files (shown below).
  • Third, enable AmiBroker, or whichever program you wish to use to do further analysis on your newly acquired csv data – we won’t be going into too much depth here.

Okay, so the first thing you’re going to need is the new script I’ve created which enables you to automatically maintain updated forex history on your VPS. Let’s look at the code first and then we’ll progress through it:

So within this code, there are aspects that you will need to edit to suit your requirements. Under the #property links you’ll start to see my comments as well as my global variables (which are capitalised). The first global variable is the PERIODS array. Here you will need to populate the periods that you wish to capture for your data source, I have listed { PERIOD_H1, PERIOD_H4, PERIOD_D1, PERIOD_W1 }; you want to add more or only have 1 period – if you want more be sure to add commas between each period as you are operating within an array, and even if you only have one data source be sure to still have it wrapped around in array parentheses, eg. { PERIOD_W1 };.

The next global variables requires you to record the timestamp of your chosen PERIODS. This means for every period you have stored in the PERIODS array you need to create a global variable so that the EA can run at the change of a new PERIOD bar. You may call these whatever you want. Don’t forget there needs to be ONE matching global datetime variable for every PERIOD in your PERIODS array!

Next we need to tell MetaTrader where we will be storing each of our data files. For this you will need to go and install DropBox as you will need to get the location of the DropBox folder and create folders within it to store your data (you don’t need to create the files – just the folders). Once you have installed DropBox you will then need to match each period in the PERIODS array to each element in the FOLDERS array. See how with my script each period matches to the folder where that data series will be stored? You need to do the same. If in your PERIODS array you have { PERIOD_M1, PERIOD_H1, PERIOD_D1 }; then your first array element in the FOLDERS array needs to correspond to where you would want the 1 minute data to be stored, the second element in your FOLDERS array needs to correspond to where you would want the 1 hour data to be stored and the third element in your FOLDERS array needs to correspond to where you would want the Daily data to be stored, so you might have: { "c:\\Users\\Jack\\DropBox\\DATA\\1MIN\\","c:\\Users\\Jack\\DropBox\\DATA\\1HR\\","c:\\Users\\Jack\\DropBox\\DATA\\1DAY\\" };

Now before we move away from this DropBox area it will be important for you at this point to check your DropBox settings and to make sure that “Selective Sync” is enabled so that all your DropBox data and photos end up on your VPS and crashing it! To do this simply click on the DropBox folder down in the task bar area, click on the Settings bolt icon, and then navigate to the Advanced tab:

Enabling Selective Sync with Dropbox so that your VPS doesn't get overloaded with all your other stuff.

Enabling Selective Sync with Dropbox so that your VPS doesn’t get overloaded with all your other stuff.

Then click on the “Selective Sync” button and with the next window open only tick the folder you want to have synced with your computer and the VPS – being the DATA folder and everything in it (if that’s what you’ve called your main folder in your DropBox).

Only choose the DATA folder for syncing between your DropBox devices.

Only choose the DATA folder for syncing between your DropBox devices.

Once you’ve clicked on the “Update” button you’re DropBox has pretty much now been set up correctly!

Now if we move back to our code we’ll see that our next global variable is FILE_TYPE, which you can either leave or change to whatever you want. It really depends on what you’d like to use it for that will determine what you will call the extension of your files.

Next we have the CURRENCIES array which contains all the currencies you’d like to capture for your data downloader. As it is an array of strings, please note that you will need to enclose any currency pair in quotes and separate each with a comma. Make sure you label the currency pairs according to how your broker has them defined – I’m using currency tags which Oanda understands.

And that’s almost it!

The two last things you’ll need to consider before saving and compiling the EA is that further down in the code I’ve created constraints on the data I’d like to have stored. This may not suit your requirements! Down on line 125 you will see that I’ve added some conditions on the data. I don’t want to store data where the High and the Low of the bar are the same and where the volume is 1 or 0. You may want to change these conditions to suit your style and you may therefore want to remove them entirely. So please be aware that you can create conditions on the data while you are looping through it if you feel there are some strange bars in your data set.

This also means that you will need to load your data by opening a new chart of the currency you wish to obtain and scrolling as far LEFT as you can. This will help load the data into your MetaTrader so that when the first pass of the EA is made it will store all that historical data you’ve captured for you. (If anyone knows of an easier way to get historical data rather than having to manually scroll through it please let us know!).

Lastly, if you happen to be running this on the weekend the data will not automatically download and you will need to uncomment out the line in the init() section which I have detailed.

Anyway, it has worked well so far and I hope it works well for you!

Let me know how you go.

The post Create Your Own FREE Forex Data Downloader appeared first on Currency Secrets.

December 18, 2013

My MetaTrader Expert Advisor Framework

Filed under: Forex General — Tags: , , , — admin @ 5:33 pm

Another aspect I undertook throughout 2013 was the continual enhancement of my Expert Advisors by refactoring them. One of the reasons I undertook this was to my newfound knowledge on how MetaTrader processes a tick – which can block ticks when the MetaTrader process is busy:

At incoming of new quotes, the start() function of the attached experts and custom indicators will be executed. If the start() function launched at the preceding quote was running when a new quote came, the new quote will be skipped by the expert. All new quotes income while the program was being executed are skipped by the program until the current execution of the start() function has been completed. After that, the start() function will be run only when a successive new quote incomes.

Therefore, it is very important to process your tick and to be able to either know whether it’s a tick worthy of further processing (i.e. for entry or amendment of stop orders) or to reject it and wait for the next incoming tick.

So with this knowledge I began using more variables to store information in my code and then would use time to recalibrate those variables.

Here is an example of the basic skeleton of my framework. There are several aspects I’d like to highlight about it:

  1. I keep my global variables capitalised – this helps me to identify what will be happening if I were to store data into a global variable, knowing that it can be accessed outside the function where its value was assigned.
  2. I assign values to all my GATE global variables in the init() function.
  3. I simplify my start() function by only making it an area where other period functions are called. For example, if I want to assign the GATE_TREND variable – I know that this variable only uses weekly data, so it’s pointless to have to reassign this variable every tick, or every minute, or every hour, or day – therefore, at the change of the weekly bar I process it then. Therefore, you would find within the doPerWeek() function the call: GATE_TREND = getWeeklyTrend( sym );. Another example is when I want the EA to report on how my system is performing. I run this on a 4-hourly basis. So within the function doPerHour() in the section if ( per == PERIOD_H4 ) { ... } I make a call to the reportToMe() function which contains all my code for emailing me my 4-hourly report.

With the way my EA code is structured through this framework I spend less time in the start() function and more time in individual functions. It also makes it easier to individually test a function, rather than having to scour through one massive start() function!

Anyway, if it ends up being of any use to you, please feel free to use it!

The post My MetaTrader Expert Advisor Framework appeared first on Currency Secrets.

Words That Finance Has Changed The Meaning of Forever.

Filed under: Forex Strategies — Tags: , , , , — admin @ 4:43 pm

As TMM waits for the Fed’s taper or non taper, it occurred to us that our careers in finance have seen our understanding of many words in the English dictionary mutate far from their original meanings. So in the cause of linguist conservation we feel it only right to remind ourselves of their original and, some would say, true definitions.

Taper – Something you ask the barber to do to the back of your hair.
Hike – To go on a walk in the countryside
Rally – An event with cars or campaigners
Crash – What a car does.
Bubble – A sphere blown from a soap solution.
Stops – What a car does when it confronts an octagonal sign
Yield – To submit, quantity of a crop.
ARM – Appendage.
Legs – See “ARM”.
Leverage – A plank of wood placed over a fulcrum.
Seagull – A marine bird
Butterfly – A pretty insect
Future – As in flux capacitor
Condor – Endangered avian predator
Whale – Large seaborne mammal
Roll – Small round bread served with turkey dinners
Capital – Seat of government
Spot – Acne
Forward – A direction, opposite of backward
Spread – Something to put on bread and crackers – eg Philadelphia or Gentleman’s Relish
Libor – A common Czech name.  Libor is a Czech masculine given name of Latin origin, derived from libare ‘sacrifice’ or from word liborius free. (see here)
Long, Short – adjectives describing length
Curve – a line that is not required to be straight, as in curve in the road
Depo – A storage yard or warehouse
Greenshoe – A green shoe
Option – A choice
Choice – An option.
Regress – To return to a less developed state
Call – A way to communicate telephonically
The Street – The road outside
Axe – A bladed implement used to chop wood or heads
Swap – To exchange something, perhaps football cards.
Exchange – To swap something
PE – Physical Education
Delta – A crap airline
Mark – A masculine name
Greeks – Bearers of gifts of dubious provenance
Hedge – A line of shrubs in your garden
Cross – Angry
Index – At the back of a book
Flow – Speed of a river
Rates – Council tax
Seat – A potentially valuable piece of furniture, or a Spanish car.
ECB – England and Wales Cricket Board
Fed – Nourished
Buba – A large gentleman you are warned will become your friend if you go to Prison.
Old Lady – Contemporary of your grandma
Threadneedle – Something your grandma does
Unched – Cockney description of Quasimodo
Flatten– A hedgehog meeting a steamroller
Tail – Something at the back of a dog, horse, cat etc
Put – Place something on a surface.
Curves – Rubensesque feature
Straddle – An equine implement
Risk – A game that takes forever to play
Survey – Source material for ‘family feud/fortunes’ questions
Cycle – Method of transport
TV – Something you watch
Front-runner – Usain Bolt
Black Scholes –  Ginger footballer in United away kit
Cover – A blanket
Ref – Bloke with a whistle at a sports game
Emu – A flightless bird
Bailout – What an Itatian captain did when he failed to do it fast enough on the Costa Concordia
Return – To go back, key on keyboard
Volatility – The speed at which a liquid evaporates.
Alternatives – Other options
Cliff – See white, Dover
DIs – Detective Inspectors
Bills – What you pay at the end of a meal
Bond – Covalent, Hydrogen and other ways to stick atoms together.
Coupon – Money off
Principal – Head teacher
Interest – A hobby.
SWF – Single Wealthy Female
Entertainment – Doing something you enjoy with people you like
Bonus – Something that is UNEXPECTEDLY received as an additional benefit.
Equity – To be completely equal.
Resistance – Electrical unit measured in ohms.
Support – A truss.
Compliance – Doing what you are told by others.
Compliant – Pretty drunk and happy to go along with anything.
Fix – To repair to proper state.
Head Hunter – A Cannibal
Margin – Blank bit on the left hand side of the page where the teacher makes comments.
Quant – British fashion designer who gave us the mini-skirt.
Techs – Higher education colleges teaching practical skills.
Misselling – A Roger Hargreaves character who ran a shop.
Wave Count – Activity performed by surfing judges.
Bobl – A pompom of wool on the top of a hat.
QE, QE2 – A series of Cunard liners.
Schatz – A number 2. Or a German expletive.
TP – A native north american’s tent.
Var – A unit of reactive power of an alternating current.
Overdraft – The breeze above your head.
Overdrawn – A picture by Picasso
Fine – Just Dandy.
Fee – The word before Fi,Fo and Fum.
Banker – Upstanding and trustworthy pillar of the community
Garden Leave – To leave your garden to go to work.
Free Cash Dispenser – Something that gives you free cash.
Crack Spread – The diameter of a builder’s derriere.
Convertible Bond – Timothy Dalton
Convexity – Feature of a good skateboard
Vega – Vegetarian from Nevada
OMO – A brand of detergent
Super Mario – A game character
Carry – Lift and move something from one place to another.
Liquid – A material that conforms to the shape of its container.
TARP – A large protective plastic sheet.
Google – Ten to the power of one hundred.
Apple – A tasty fruit.
Raider – A member of an American football team headquartered in Oakland.
Troika – The three omnipresent cups at most Russian table settings (all filled with vodka).
Small cap – Hat for a boy
Vampire Squid – Vampyroteuthis infernalis, a small, deep-sea cephalopod.
Stocks – Something you put criminals in and throw rotten vegetables
Dove – Stout bodied bird with a short short neck
Hawk – Predatory bird with a penchant for doves.
Rate – To judge a performance
Prime – Stage of life when you are in your finest form
Benchmark – A mark on a bench.

Please feel free to add your own. Some have already been flagrantly stolen and added from the comments section below.

December 16, 2013

The 2013 Year in Review

Filed under: Forex General — Tags: , , — admin @ 5:32 pm

As we near the end of this year I ready myself for a review on how my trading systems and manual trades went. It’s a time where I look over all aspects of my trading and contemplate areas I can improve upon.

Perhaps the biggest change I made throughout this year was the inclusion of a reversal system. I already knew I needed one when I began observing that there were some breakouts which ended up failing and that they would fail to such a degree that enough could be made in making back the loss incurred on the original breakout.

However, after monitoring this throughout the year I found that a reversal system could stand on it’s own two feet, especially if it incorporated a strong reversal pattern – such as an engulfing pattern.

Having coded this system throughout this year and making many tweaks it has traded a small account profitably this year. It’s had a total of 25 trades of which 44% have been profitable with an average win of 70% of amount risked and an average loss of -50% of amount risked. Obviously there were more erroneous trades towards the start of the system, but regardless it has held up well so far.

My breakout system has similarly been returning well throughout this year and has had 34 trades with a 47% accuracy. The average win has been 140% of amount risked and the average loss -80% of amount risked. I am still refining the breakout system and have found throughout this year that I was tweaking it the most out of the this and the reversal system. I’m also demo trading a new method of identifying a resistance/support line break and will see how this pans out after a couple of months of testing before trying it with a small live account.

Lastly, another interesting change has been happening in the automated system’s space and this has been MetaTrader’s their recent 555 update as seen here in their forum (thanks for the alert Ilan!). Perhaps the most excited and long overdue feature that I like is the debugger! It is extremely frustrating to have to try and find the elusive missing closing bracket!

Another feature I like is the push notification feature – where an alert can be sent to your iOS or Android device regarding any trade being transacted. I’ve found alerting myself extremely helpful as I can analyse any automated trades right then and there to see whether it is making a trade based upon what I would have traded (and if it doesn’t – I jump straight back out and look to revise my code).

It also appears as though the MQL4 language is undergoing an update and becoming more object oriented which helps those who’ve come from languages such as C++ be able to work better within its platform.

While 2013 has been another exciting year, MetaTrader has raised the barrier of entry for any competing products. Although I still believe that there is a future for any broker providing a RESTful API for their clients as this would be language agnostic and would enable the user to code in whatever language they desire.

Anyway, I hope you all have a lovely Christmas and New Year break and look forward to seeing you all next year!

The post The 2013 Year in Review appeared first on Currency Secrets.

December 7, 2013

USD Crosses on the Precipice

Filed under: Forex General — Tags: , — admin @ 5:32 pm

There are two interesting USD crosses that are poised to moved. One which we have already spoken much about is the GBPUSD. As we can see from this weeks’ trading price has retraced from the initial breakout:

Cable retraces back to old resistance (new support).

Cable retraces back to old resistance (new support).

Now that price has started to bounce from this zone we should see further movement north over the coming weeks – although we do need to be mindful that we are coming towards the close of the year and generally things can get quite volatile (due to the lack of normal liquidity in the markets).

The other USD cross of interest is the USDCHF. We had mentioned this sometime before, but it appears to be on the verge of another breakout and next week will similarly prove interesting, as shown by looking at the chart:

USDCHF is hanging on the verge of another breakout.

USDCHF is hanging on the verge of another breakout.

Personally I’d prefer it to have 1 little week of bouncing off of the support zone and then an eventual break in 2 weeks’ time (almost putting it into the new year) as I’m afraid of any breaks being reversed during the low liquidity times between Christmas and New Years.

Anyway, these are two USD crosses to continue to monitor next week.

The post USD Crosses on the Precipice appeared first on Currency Secrets.

December 1, 2013

The Benefits of Trading with the Trend

Filed under: Forex General — Tags: , , — admin @ 5:35 pm

If I was truly honest with my trading self I must admit I never fathomed the immense wisdom behind the statement trade with the trend.

I probably deluded myself into thinking that I did and there were perhaps moments when I traded with the trend, but because I was too impetuous and wanted to trade everything that moved I decided that because I was a “short-term day-trader” I didn’t need to worry about the underlying trend with the stocks and indices I traded.

I think this ended up being the very reason for my eventual downfall when in 2007 my share trading account went too far into the red that I had to cease from trading for awhile.

Plagued by this same disease of trading against the trend when I returned back to trading I made an effort to stop wanting to be in a trade for the sake of getting a “buzz out of it” and to just focus on doing good trades.

This meant that I had to take a hard look at the habits which were causing detriment to my trading accounts and one of these was not being willing to trade with the trend.

It wasn’t until I was able to finally humble myself that I submitted to the wisdom of many successful traders which I had learnt from in time past that I was now going to start trading with the trend. During this discovery process I started by asking the initial question:

Why trade with the trend?

I had countless examples of excellent trades to fall upon with why I should, but the problem with looking at experience was that I also had good trades where I didn’t trade with the underlying trend – so what was to be the difference?

I had to reason it out. And here was my logic:

The reason why we trade with the trend is because of the market’s disposition to move in the direction of the trend.

A great example of this has been the real estate market here in Australia. It has been a solid investment since I can ever remember and on average continues to make good returns provided you invest in the long-term. Most people who I’ve known who have invested in property have done very well in their investments – even when they bought at “peak” periods. They knew that all they had to do was “wait it out” until the next wave of the up-trend continued.

And this same mentality is what should underlie your motives when your trade. Trading with the trend should give you a confidence that even though the market may turn against you it should correct itself and resume it’s normal trend. In other words, should the market move against the underlying trend of your currency this move will generally not last in it’s intensity in price and/or time.

Now we all know that every trend has to end at some stage – price will generally hit a point where the market may no longer be willing to go any further OR the underlying perception of the market shifts. And this is why we hold to money management principles and strategies such as stops to prevent these worst-case scenarios from happening.

So how do I gauge what the trend is?

This is the million dollar question and there are bazillions of different solutions out there.

I know that are generally three types of trends and whatever method I used I had to ensure that these three types were defined in it, the three types of trends being:

  • Up
  • Down
  • Sideways – or no trend

Some people decide to use 3 moving averages to encapsulate these trend types with a fast, mild and slow moving average. Once the fast > mild > slow we have an up trend, once the fast < mild < slow we have a down trend – with all other variations of these three moving averages producing no trend (or sideways).

However, I’ve never been a big fan of moving averages. I do like how moving averages help to smooth out the imperfections in price, but that’s another discussion for another day. I’ve always liked raw price action (as evidenced by my popular trend line script) so I’ve used swing points from weekly charts to help define the underlying trend when operating in the 4-hourly charts.

Generally my methodology for defining what a trend is revolves simply around the swing charts. A high with a lower high on either side is considered to be a “peak” and a low with a higher low on either side is considered to be a “trough”.

In essence, my MetaTrader script for determining the trend is here:

The post The Benefits of Trading with the Trend appeared first on Currency Secrets.

Powered by WordPress