You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi Everyone,
I am new to the world of MQL4 but I am interested in writting a code to test and trade a pairs strategy.
Basically the theory is that 2 currency pairs that move together, will move back into parity once if they move apart. For example:
1) Assuming the Australian and New Zealand currencies should move in the same direction when compared to the USD.
2) At 10.00am Aussie time (when the Aussie market opens), this equals 1200 noon in New Zealand. At this time if we reset the NZDUSD currency to the same price as the AUDUSD currency. (ie if AUDUSD is 0.8500 and the NZDUSD is 0.7000 then we take the NZDUSD price of 0.7000 and then multiple by 0.8500/0.7000.)
3) We then continue to restate the NZDUSD price by this same multiple (0.8500/0.7000).
4) We then compare the NZDUSD restated price to the AUDUSD price. We monitor the SPREAD between these 2 prices.
5) Once the spread is greater than 0.0010 then we trade the spread to return to 0.0000. (ie we make 0.0010 profit). Stop loss is set when spread is at 0.0020 (ie stop loss of 0.0010 loss)
6) The overall strategy can be written as follows.
Parameters:
At Time = 10.00am, set these parameters:
Let Abase = AUDUSD Closing Price as at 10.00am
Let NBase = NZDUSD Closing Price as at 10.00am
Let NRatio = NBase / ABase
Let ALotSize = 0.10
Let NLotSize = 0.10 / NRatio (rounded to nearest 0.01)
Let AHedge = Current AUDUSD Closing Price
Let NHedge = (Current NZDUSD Closing Price) / NRatio
Entry:
Where AHedge – NHedge >0.0010
And There are no Open Positions,
And There have been No Trades already Taken
And Time <11.00am
Then Sell AUDUSD (using ALotSize) and Buy NZDUSD (using NLotSize)
Exit: Whichever Comes First
a) Where AHedge – NHedge <0.0000
Then Close Position : Buy AUDUSD (using ALotSize) and Sell NZDUSD (using NLotSize)
OR
b) Where AHedge – Nhedge >0.0020
Then Close Position : Buy AUDUSD (using ALotSize) and Sell NZDUSD (using NLotSize)
7) REQUEST - Does anyone have a code that can be adapted to meet this trading strategy ? If not, is anyone out there willing to write me a code and I will pay them ?
Many thanks,