Sunday Breakout Strategy

GMT Code:

extern int GMT_offset = 0;

int GMT_Time[24];

// initalising the values for GMT array
for ( int counter = 0; counter < 24; counter++ )
GMT_Time[counter] = counter;

int result = 0;
if ( GMT_offset >= 0 ) result = GMT_Time[GMT_offset]; //positive offset
if ( GMT_offset < 0 ) result = GMT_Time[ArraySize(GMT_Time) + GMT_offset ]; //negative offset

[B]// result contains the hour value of the time which is after the offset[/B]

ETA:
after thinking for a while, why not just add them!! no need to convert negative integer to positive integer just to subtract it!!

At 50% of the TP. I think I used ATR/4 in the EA code, which should be the same thing.

I think between the two of us we almost equal a real programmerā€¦ Weā€™ll get his thing working perfectly in no time. :slight_smile:

Phil - do you trade this live on Oanda or IBFX or both? I know you mentioned this earlier some where else on this thread.

And if you do this on Oanda only then I am guessing you do the trading manually

Iā€™ve been trading it live on Oanda manually for almost a year now. I just opened up a live IBFX account last week and I plan to start trading it there with the EA once we get everything working.

Technically Iā€™m trading it live on IBFX now, but only with .01 micro lots, just in case the EA screws up. :slight_smile:

hahaha!!! Iā€™m going to merged the ideas/code when I have the time, maybe todayā€¦just got my course notes, starting a course and finishing it in 2 months, so going to be bz~~

External Links to this post from:

[U]Sunday Breakout EA (2 in 1).zip[/U]

  • contains GBPUSD Strategy - http://forums.babypips.com/107933-post1.html

  • contains EURJPY Strategy - http://forums.babypips.com/130845-post833.html

  • external variable to specify your risk in %

  • if current ATR more than 40% of ATR 14, donā€™t enter market

  • ready for 5 or 4 digit broker

  • do not enter market if itā€™s passed wed

  • close order if itā€™s friday, gmt 1200

  • fixed lot size calculation error

  • added a check to see if the order has been closed by SL/TP

  • added file logging

  • moved the function that checks if the order has been close by SL/TP to the top, it should be checked first before ā€œclosing ordersā€ or ā€œmove to BEā€

  • added a ā€œLets_Go_Tradingā€ flag, it will be activated after the breakout box has been calculated, and deactivated when itā€™s after friday 12pm GMT

  • added data error logging to file

  • tired of coding for GBPUSD and EURJPY style in 2 different EA, merged them, and added an external variable to choose between them - default = EURJPY style, if u didnā€™t type ā€œGBPUSDā€ properly, it will choose EURJPY style

  • GMT offset: it will take the high and low of 2 one-hour candlesticks before Monday 00:00 - taking broker GMT offset into account; this is how Phil838 has devised this strategy - using IBFX which is at GMT0 and itā€™s 4-hour candle actually have only 2 hours of data - currently itā€™s set to GMT2

  • fixed bug with buying/selling at market price by first sending buy/sell market order, then modifying the order with SL and TP

[U]Position Sizer.zip[/U]

  • external variable to specify your risk in %
  • has 3 lines, Entry, Stop Loss, Target profit
  • it will calculate lot size and RR ratio based on your risk in %
  • will not calculate when entry is not between stop loss and target profit
  • will not calculate when entry is equals to stop loss or target profit (to avoid divide by zero error)
  • ready for 5 or 4 digit broker
  • lotsize will return min of 0.01, and sometimes that might exceed the % that u specific as the stop loss is too large for your account to handle - added actual dollars that is risked, and recalculated % base on it
  • changed from re-creating entry/stoploss/targetprofit lines at every tick to changing the lines description; because deleting it and creating it again causes the line to lose focus when you try to double-click on it and adjust it

[U]Position Sizer EA.zip[/U]

  • able to places orders when delete the yellow label; orders will then be placed, and the entry/stoploss lines are moved to the minimum price in the chart, and the targetprofit lines are moved to the maximum price in the chart
  • external variable to specify your risk in %
  • has 3 lines, Entry, Stop Loss, Target profit
  • it will calculate lot size and RR ratio based on your risk in %
  • will not calculate when entry is not between stop loss and target profit
  • will not calculate when entry is equals to stop loss or target profit (to avoid divide by zero error)
  • ready for 5 or 4 digit broker
  • lotsize will return min of 0.01, and sometimes that might exceed the % that u specific as the stop loss is too large for your account to handle - added actual dollars that is risked, and recalculated % base on it
  • fixed ordersend command; from BUY/SELL at market to onstop buy/sell
  • changed from re-creating entry/stoploss/targetprofit lines at every tick to changing the lines description; because deleting it and creating it again causes the line to lose focus when you try to double-click on it and adjust it

[U]Line Reactor.zip[/U]

  • maybe its a myth that the price will react when its nearing those 1.4500 or 135.00 mark; anyways, this is a simple indicator that reminds you action might take place around those marks!

[ Steps to extract them ]

  1. save file to desktop
  2. use winrar/winzip/7zip to ā€œviewā€ the zip file"
  3. u will see one file
  4. select the file, and hit ā€œviewā€ in winrar/winzip/7zip
  5. u will see 2 files now with extension

Position Sizer.zip (5.83 KB)

Position Sizer EA.zip (8.63 KB)

Line Reactor.zip (2.48 KB)

Sunday Breakout EA (2 in 1).zip (20.7 KB)

FYI, GMT offset is not as easy as it soundsā€¦

we need to grab the high/low of a 4 hour candle:

  • the problem is, what if the time after offset is in the middle of a 4 hour candle?
  • we probably need to break down the 4 hour candle into 1 hour candles, and grab the previous 4 one-hour candleā€™s high/low,
  • also, what if some broker doesnā€™t have sunday candle? if u grab the last 4 one-hour candle, it probably include last fridayā€™s?

what do u guys think?

How does one go about implementing this?

Do I just copy both files to my Meta Trader 4 platform to the custom indicator section and then just call it up on a GBP/US chart? What is each file supposed to do?

Thanks

Thatā€™s exactly why I didnā€™t put in it. At first I though it was as easy as making an external variable and letting the user put their +/- GMT number in, but, for the reasons you pointed out, that wonā€™t work.

Using 1H candles is probably the best bet. If no Sunday data is available the first 2 hours of Monday should work fine. The week-to-week results will be different than the ā€œofficialā€ results, but over time the profitability will remain the same.

Any more than the first 2 hours and the stoploss will be too large for the system to work correctly, though.

Anybody else with some programming knowledge have any ideas?

Here is a video tutorial on how to do it. It explains it better than I ever could. :slight_smile:

How to setup an Expert Advisor in your MT4 by veeco ā€“ Revver Online Video Sharing Network

Works fine on the Strategy Tester, and the code looks great too! Much cleaner than mine. :slight_smile:

Iā€™ll run it Sunday and test it out, I have no doubt it will work perfectly. :slight_smile:

I can do this if you want, but do we really want to ā€œchangeā€ the rule so much to cater for broker who doesnā€™t have sunday prices? shouldnā€™t they used ibfx demo for it?

I can program to check that if the days differ more than 1 day, then donā€™t take the iHigh of 1hour candle into consideration, but do we really want to do this?

we should keep it simple?

Iā€™ll look at EURJPY over the weekend, the GBPUSD is only the 1st draft, still need to work on the comments, and have some inbuilt checking to make sure values are okay`

I think youā€™re right. I [B]know [/B]this system works like it is, but Iā€™m really just guessing it does on Mondayā€™s dataā€¦

Itā€™s up to you and everyone else as far as Iā€™m concerned. I use IBFX so whether itā€™s in there or not doesnā€™t bother me. :slight_smile:

Is there anyone out there trading this system thatā€™s using a broker without Sunday data? If so and you want to use the EA speak up! I (and Iā€™m guessing s05) donā€™t mind doing the work to get it running on all brokers, but if no one needs that feature we shouldnā€™t waste our time with it.

No problem. Iā€™ve got an open trade on EUR/JPY right now that will probably still be going next week, so I wonā€™t be running the EUR/JPY EA anyway.

Iā€™ll still be trading it live on Oanda though.

i moved my to BE, and it BE!! :frowning:

yourā€™re not closing the EURJPY on friday 12pm gmt?

i usually do, but this a longer-term strategy Iā€™m trying out. :slight_smile:

Iā€™m trying to find something to replace my NickB scalp line trades since they stopped working in these market conditions. :smiley:

I was looking back as far as my data goes (it only goes back 3 months on the 1H candles) and GBPUSD had quite a bad losing streak in June/July. 8 consecuative losing weeks from 7 June onwards. If you started trading this system in June you would only have about 87% of your money now.
The last 3 months of G/Y on the other hand was very good. Enough to cancel out the losses in G/U. If you traded them together from June you would be in profit. But last weekā€™s G/Y was a shocker in terms of the weekly range. It barely moved at all the whole week. Lets hope things start to pick up soon. Maybe it was because of the the summer holidays in the northern hemisphere, coming at the end of a major correction/rebound in the equity markets?

My records are showing something different.

I only had a 4 week losing streak (5 if you count the breakeven week as a lose). I show one win in June, and one more in July. If you trade 2% per trade you should have made 5.4% (compounding factored in) over those two months.

Looking back in my charts August was also a profitable month, but I donā€™t have live results due to my accident.

Here are my live results for June/Julyā€¦ First number is the stoploss, second is the TP, and third is the outcome of the trade in pips. The total outcome is 3.25R.

06/01/09
35 234 216
35 234 0

06/08/09
48 248 0
48 248 0

06/15/09
61 259 0
61 259 -61

06/22/09
54 245 -54
54 245 -54

06/29/09
38 239 -38
38 239 -38

07/06/09
44 228 -44
44 228 -44

07/13/09
44 228 0
44 228 228

07/20/09
56 228 0
56 228 0

07/27/09
50 226 0
50 226 -50

Yes, youā€™re right. I only just realised I was using the wrong spread. Those extra pips makes all the difference. Iā€™ve recalculated and it was profitable over the last 3 months by about 8%. Add in the profit frm G/Y and it becomes even better. :slight_smile: