Sunday Breakout Strategy

going to draft out the program I am going to write an EA for,

  1. find the closest sunday candle and draw a box and SL TP with it
    =====> set inMarket, OSP_Buy_inMarket, OSP_Sell_inMarket = false
    =====> after this is done, do not do it again
    =====> this should probably be put in the init module

  2. if the Day=Monday, and 0100 hour candle is just formed
    =====> draw the box with SL and TP
    =====> set inMarket flag = true

  3. if inMarket flag is true
    =====> if Ask price >= OSP_Buy, send in buy order at ask price, with SL/TP, set OSP_Buy_inMarket flag = true
    =====> if Bid price <= OSP_Sell, send in sell order at bid price, with SL/TP, set OSP_Sell_inMarket flag = true
    =====> check if current ATR is more than 40% of the weekly ATR(14), if true, remove all pending orders
    =====> check if Friday GMT 1200, close all inMarket Orders, set inMarket, OSP_Buy_inMarket, OSP_Sell_inMarket = false

=====> if OSP_Buy_inMarket = true
==========> if Ask price >= OSP_Buy_BE, modify orderā€™s SL to BE

=====> if OSP_Sell_inMarket = true
==========> if Bid price <= OSP_Sell_BE, modify orderā€™s SL to BE

hmmmm, big if statement!

hi phil, have been wanting to ask you these 2 questions for a long time:

Q1
We have the sunday candle say 40 pips long end to end.
We have oanda spreads (i also use that broker) at 5 pips on sunday morning.
I assume we enter with the spreads, resulting in longer candle length +2.5 pips on entry, and +2.5 pips on SL.
Is this your understanding too?
The added length will decrease profitability by about 10% overall from your excel backtest. e.g. if your annual return is 50%, you will be down to 45%.

In recent weeks, I have seen the price bounce off the SL, and find this puzzling (e.g. this week). It makes me feel I should add more pips to the sunday candel (and consequently reduce profitability)

Q2

am wondering if you had considered the occurrence (it happened last week) that price whiplashed and stopped out the long and short trades. However, on a 4 hr chart, it seems like a profitable 2nd trade. (u know what i mean?)

We canā€™t see this unless we drill to a 1 hr chart or less.

:rolleyes:

Toilet paper? I heard something like that, itā€™s rolling out papers and has prints on it, and suddenly itā€™s a stock chart?

My ā€œmodifiedā€ method is doing the box end at the GMT 0100 to counter these fakeouts;

hmmā€¦1 added hour? maybe a slightly longer candle, but will be good to backtest this one. :rolleyes:

Good questions!

First off, if you are both charting and trading with Oanda then you donā€™t have to factor in spreads at all!

Oanda is one of the weird brokers that draw their charts on the bid/ask average, instead of drawing them on the actual bid price like almost every other broker does. So the spread is already factored into the candle when it is drawn on the Oanda charts. The general rule of adding the spread into long orders does not apply to Oanda.

However, if you do your charting in MT4 with another broker, and just place your trades with Oanda like I do then you do need to add in the spread on long trades, because your MT4 charts are drawn on the bid price. Technically you should factor in 1/2 the Oanda spread on all trades, but I never worry about it. I can recall one time in the last 2 years that the charting differences caused me to lose a tradeā€¦

I donā€™t think we need to add any more than the 10 pip buffer to the Sunday candle. I may not fully understanding your thought process here, but it seems to me youā€™re wanting to increase the win rate at the expense of profit!! If adding extra pips to the candles will reduce profitability, then why do you want to add extra pips?? :slight_smile:

Sure, it might up the win rateā€¦ But a higher win rate does not necessarily mean more profit!

As for question 2ā€¦ Yes, I considered that and factored it into my backtesting. If that happened I dropped down to a lower time frame so I could tell what really happened.

gone thru many times, i think this should be right?

  1. find the closest sunday candle and draw a box and SL TP with it
    =====> set inMarket, OSP_Buy_inMarket, OSP_Sell_inMarket = false
    =====> after this is done, do not do it again
    =====> this should probably be put in the init module

  2. if the Day=Monday, and 0100 hour candle is just formed
    =====> draw the box with SL and TP
    =====> set inMarket flag = true

  3. if inMarket flag is true
    =====> if Ask price >= OSP_Buy, send in buy order at ask price, with SL/TP, set OSP_Buy_inMarket flag = true
    =====> if Bid price <= OSP_Sell, send in sell order at bid price, with SL/TP, set OSP_Sell_inMarket flag = true
    =====> check if current ATR is more than 40% of the weekly ATR(14), if true, remove all pending orders
    =====> check if Friday GMT 1200, close all inMarket Orders, set inMarket, OSP_Buy_inMarket, OSP_Sell_inMarket = false

=====> if OSP_Buy_inMarket = true
==========> if Ask price >= OSP_Buy_BE, modify orderā€™s SL to BE

=====> if OSP_Sell_inMarket = true
==========> if Bid price <= OSP_Sell_BE, modify orderā€™s SL to BE

hmmmm, big if statement!

You need a flag to check if the BE point has already been changed, and to make sure itā€™s only changed once, otherwise the EA is going to change it again everytime the price moves.

Itā€™s a bug that wouldnā€™t hurt the EA since itā€™s being changed to the same value over and over, but itā€™s still a bug. :smiley:

Other than that it looks great!

Welcome back Phil! quite a dramatic come back i must say.

Iā€™ve only just gone live with this method this week. Not a great start but im not bothered. The previous couple of weeks were so good I was wishing the demo profits were real.

GBP USD was a loss and a BE for me by a couple of pips. But GBP JPY was a loss and currently in a free trade going short. If i get a win with this one trade it will more than cancel the other two losses.

Quote Phil -

I donā€™t think we need to add any more than the 10 pip buffer to the Sunday candle. I may not fully understanding your thought process here, but it seems to me youā€™re wanting to increase the win rate at the expense of profit!! If adding extra pips to the candles will reduce profitability, then why do you want to add extra pips?? :slight_smile:

==> Yes, my concern arises because of so many close shaves, such has this weekā€™s - just off by 1.5 pip in my case. :stuck_out_tongue:

Sure, it might up the win rateā€¦ But a higher win rate does not necessarily mean more profit!

==> agreed, itā€™s the animal in me again!:o

As for question 2ā€¦ Yes, I considered that and factored it into my backtesting. If that happened I dropped down to a lower time frame so I could tell what really happened.
==> and you said you did this back test manuallyā€¦:eek:

Thanks Phil!

I was programming one EA already, anyway do yours and i will continue mine.

1- not reallyā€¦ only in the part of being on the init module, you still need to keep track of the values and many cases will arise were init is not enouthā€¦

2- be carefull not all broker have same timezones

3- try to use metatrader price orders has flags and not logic flags unless you really have no choice, metatrader flags lets you better backtest + its more reliable in actual foward testing. the only good thing logic flags has is that sometimes in diference of small ammount of ā€œpipsā€ it will prevent your order from being closed prematurely.

could u let me know what are the priceorder flags? Iā€™ll search on help for more info.

[QUOTE=gif;130077]I was programming one EA already, anyway do yours and i will continue mine.

1- not reallyā€¦ only in the part of being on the init module, you still need to keep track of the values and many cases will arise were init is not enouthā€¦

2- be carefull not all broker have same timezones

[QUOTE]

for (1) itā€™s only trying to draw on the screen for the user, esp when itā€™s tuesday, and they want to know whatā€™s going on, donā€™t have to open mt4 to wait for Monday GMT 0000

(2) going to use ibfx, gmt0

Congratulations on going live Rei! Hopefully you wonā€™t have to wait too long for a winner! :smiley:

yes and no. il explain for the server they are, for your metatrader client they arent. metatrader client builds history with imcoming data tick, if you lag abit, metatrader will not build the last tick and will prioritise the most recent, and what happens is that if you use logic flags sometimes orders wont trigger and other orders wont be closed because even if the ea executes every single tick if data is missing the code is strict and nothing will happen and in this case (if <= value -> close) if theres no thick even if it was there it wont close.

if you use metatrader flags the order is already there (pending orders) what happens is even if you miss that tick it doesnt matter, the server has all values in correct orders and there and for real every value is check so your order will be more ā€œrealā€ and will be opened or closed.

im not good at explaining, anyway feel free to ask more questions.

1 - the first one is solved by itself, for the ea to work properly you will have to have it on at the time of change (when the 4H sunday bar just finished closing), what you have to keep in mind is that everytime the user turns on the metatrader the init() function will be used once, so yes to ease your work you could use it to read some values from files and make some check up to see if those are the correct values, but later you will need to keep track of those values because many things can depend on that, not only during week days and people needing to see whats going on and all, but you will need then for future improvements, making reports, tracking bugs, use management, and alot other stuff.

2 - im making mine adaptable to any broker so that everyone can use in any broker they would like, and im even building something for much later, im gonna place the ā€œreal broker (your primary broker since many people dont use IBFx has main) + IBFxā€ working together exchanging info in case someone wants to keep track of those values, it will be better and worst in some stuff but yes it is possible.

Hi Phil,

You may want to consider the e-video course like NickBā€™s. Have your own blog and forum, I believed people want support you as you are more patience and supportive in helping newbies esp.

Count me in, off course!

sat on my hands for a 208 pip gain this week. anyone else was on the trade? this was a good week. :slight_smile:

Edit: oops forgot to caveat - the first long trade was a loss! :rolleyes:

yeah, i took off too with some nice profit.

A question to the strategy author, is it absolutly necessary for the 2 pending orders to be opened at the same time? I need to know this to continue making the ea.

EDIT: Since no one replied i made it a ruleā€¦ 2 orders or no order. the EA is ready and i will be adding the module later to support any broker at all based on user input! now il take a break! btw results seam promising.

Cool :slight_smile:

While you were resting up in a plaster cast, I had my own little computer adventure as you may remember.

Iā€™m a happy Ubuntu user and running MT4 without a care in the world through WINE and with the help of Winetricks.

Friggin sweet, as Peter Griffin would say.