Easy 5 minute Trading

Still having issues being able to maintain the proper fib for a trade, once it ceases to be a pending trade and opens an actually buy or sell. I was constructing by the date of the pending trade, but MT4, in its wisdom, change the origin date of the pending trade, once it opens a buy or sell to the date this occurs, and the record of when the pending trade opened evaporates into digital dust. And the trade ticket remains the same, only with new date of origin. So, I no longer have a reference to draw the correct fib for the now live trade, to maintain proper trailing step stops. Can’t even base it on hard tp/sl, because the instant the sl is moved, those reference points are gone. Anyway, if anyone has a suggestion, great. Else, I’ll keep trying to think of a way. Thanks.

Damn +255… Making me drool lol. Im not trading the USDCHF or EURJPY on your list just as i thought they were a bit unstable

But even then my results are so far on the DAILY CHART:

Closed Trades:

AUDUSD = +0
GBPUSD = +0
USDCAD = +13.8
AUDCAD = +26.3

Open Trades: +17.3

The 4 hour chart has one massive trade currently live at + 84.0 pips, and two breakeven at 0 pips, so im not too convienced at the moment of running this on anything lower than the daily time frame.

Ok just something to bring us back to the real world, this strategy and James EA looks amazing, so anyone reading these threads don’t get greedy with your money management, it will end bad !

But on a plus side i was only after an average of 25 pips a day and so far this strategy has met these requirements and then some.

Nice find with the changes for the EA.

Thanks for the updated EA will apply it later when i get a chance. Im not sure if you have included the auto GMT time setting to the EA that you wanted to do, an alternative or backup would be just to let us manually set in the EA what time the market closes acording to our MT4 broker chart.

Might make life easier for you coding wise ?

I do have one suggestion with regards to the breakeven SL level. What about if we moved this SL to be Fibs + 1 pip for buys and Fibs - 1 pip for sells. The logic would be that these trades which break even would end up with +1 pip profit instead of 0 pips. I know this level of profit is tiny, but if we have say 20 trading days in a month, and say one to two breakevens a day we could get ourselves an extra 20 - 40 pips a month, as if the trade has gone that for to breakeven then sure allowing us to gain one pip won’t make a difference to real profit ?

If this 1 pip gain per breakeven trade added up to say 20 - 40 pips per month it could equal one of our loosing trades.

By the way this was only for the Breakeven Fib level, no others.

This is what i get with my rebate from Hot Forex, so from them i get 60% of the spread back per trade i make, it may only be about 1 pip trade, but a few hundred trades later and it will add up. We could do the same here without hurting ourselves ?

Just stick the EA onto a chart, make sure live trading is applied and your good to go. James has been great and every release he does comes with the best settings for the EA we have at that time.

This EA and this strategy is set for the daily charts. If you do try it out on anything lower let us know the results, im currently doing a forward test on the 4H chart.

What about if we have the EA dump into a text file all of the details for the pending order something like this:

Order Number: 342424
Date : 12/09/2012
Time : 15:12
Fib BE : 111.1
Fib Level 1 : 113.1
Fib Level 2 : 115.1
Fib Level 3 : 117.1
TP : 118.1
(as well as any other data you might need for that trade)

If the ticket number remains the same then you could dump these details for order “1234” into a txt file, call it “1234.txt” and have the EA delete it once the live trade is closed or use a text based database to store all this data for each trade ?

If MT4 can’t do it, then surely if we used a DLL function we should be able to do it through windows.

If the details are dumping into a text file when the pending order is created then maybe the EA can read that txt file when the trade goes from pending to live for what the Fib levels should be for the trades when they go live ?

Or what about using market orders like you had the EA previously, does this make the strategy less reliable ?


Ok did a quick google and found this:

[B]Trade From CSV File[/B]
[I]Developed by Paul Hampton-Smith[/I]

This is a “crude” API for Metatrader 4. It allows external programs to control Metatrader to execute, modify and delete trades. This EA should be stored in Experts/Scripts folder before compiling. It checks the folder Experts/Files every n seconds for the file commandfile.txt, a text file which should include a single trade command.

List of MT4 Expert Advisors (EA) For Download | AsiaPacFinance - Trading Courses | Technical Analysis | Trading Strategies

So this does look like a possibility to read/write to a text file if this helps ?

Top left is not vital information, its just giving some numbers and pip values that you can see without having it work it out yourself.

I recommend this EA ONLY on 1 day chart :slight_smile:

Also james, on every pair since 2005, my 40 min fib size beats your default 58. I was wondering so I tested out every pair.

Mitchell out of interest on your tests if we set the BE so we would make 1 pip profit instead of 0, how many additional pips do you think we could of made since 2005 ? (If you can work it out without re-doing the tests ?

Im just curious if doing this would limit out profit or help to increase it a little ?

Out of interest how profitable is the EA looking from your latest tests ?

my usd/cad had closed today.

so overall today I ended up with .44%.

It takes a lot of risk to get that .44%

I would have been in aud/cad to had I not been testing. I haven’t figured out best way to handle middle ground. I have something that says absolutely do not trade, but then I have the middle ground area. Guess I could just leave it for traders to decide if they want to be more conservative.

From my tests, depending on the currency pairs there has been around 80-200 BE trades and sometimes much more since 2005.

So depending on the lot size, (I start with $1500 with 2% risk stop loss per trade) an extra pip added to the BE fib could give $80-$500 in the 5 years :slight_smile:

And to address your other question, with the defaults of v15 except for my custom 40 pip min fib. The EA from 2005 would of made between $500-$2000 on pairs like gbp/usd, usd/chf and aus/usd.

Haven’t tested eurusd because of the similiarity to usdchf. Other pairs like audcad and weird crosses only net a few hundred dollars over the past 7 years but its better then nothing :slight_smile:

Ill be backtesting the yen pairs soon enough, love the new speed of the backtests, so quick :slight_smile:

[TH][/TH]
[TH=“class: magic”]Magic[/TH]
[TH=“class: openDate”]Open Date[/TH]
[TH=“class: closeDate”]Close date[/TH]
[TH=“class: symbol”]Symbol[/TH]
[TH=“class: action”]Action[/TH]
[TH=“class: lots”]Lots[/TH]
[TH=“class: sl”]SL[/TH]
[TH=“class: tp”]TP[/TH]
[TH=“class: openPrice”]Open Price[/TH]
[TH=“class: closePrice”]Close Price[/TH]
[TH=“class: pips”]Pips[/TH]
[TH=“class: profits”]Net Profit[/TH]
[TH=“class: durations”]Duration[/TH]
[TH][/TH]

2147483647
12.09.2012 04:15
12.09.2012 14:43
AUDCAD
Buy
0.01
1.01957
1.03327
1.01700
1.01957
25.7
2.63
10h 27m

2147483647
12.09.2012 04:52
12.09.2012 10:14
AUDUSD
Buy
0.01
1.04633
1.07936
1.04633
1.04633
0.0
0.00
5h 21m

2147483647
12.09.2012 07:40
12.09.2012 17:34
EURUSD
Buy
0.01
1.28838
1.32104
1.28838
1.28838
0.0
0.00
9h 53m

2147483647
12.09.2012 09:46
12.09.2012 11:30
GBPUSD
Buy
0.01
1.60943
1.63648
1.60943
1.60943
0.0
0.00
1h 43m

Wigglez these were my trades today using v13, going to swap to v15 of the EA shortly.

Compared to how your trading with your experimental filter, did you do better or worse in pips ?

Awesome, does seem the more we test the EA the more it looks profitable. I was hoping you would say there were quite a few BE trades. Well i guess making 1 pip profit on them is better than none. James if you agree could you add this change into v16 please ?

Thanks

Interesting, all the time i was just calculating using 0.02 lots per trade while having a live account of 100 euro’s and i found the EA could generate at least 50% profit a month.

This strategy and EA is become more feasible the more we test it. Great work James.

James remember this issue above that i mentioned i think i have found the cause of it. I believe i have two problems going on:

  1. Hot Forex Demo server is providing old tick data causing the old tick data errors. Would not worry about this as its not affecting trading.
  2. The trade context busy from what i can tell is as i have 5 EA’s running (all yours) on the 5 pairs we are testing with so they are all trying to get their pending orders in at the same time when the new bar appears.

Hope this helps.

[B]"This error means that 2 or more eas are trying to open, close or modify their orders at the same time. There is one “stream” in metatrader for ea trading, so if one ea is busy talking to server, all the rest will have to wait until it finishes.

How to solve:

  1. if you can code, just go to Error 146 (“Trade context busy”) and How to Deal with It - MQL4 Articles, there is a description of this problem and functions to add to your code to avoid this happening in future.
  2. Just use 1 ea per metatrader, or (if you want to run more than 1) make sure they will not trade too often. If you run 2 scalping eas at the same time, you will get quite a lot of errors 146."

[/B]Error 146 (“Trade context busy”) and How to Deal with It - MQL4 Articles
Trade context is busy !?

Hi all,

Good work on the testing… awsome.

Re: using a txt file to recoup last numbers, yes, it’s a good suggestion. Was already thinking about using Global Variables, but was holding off trying any “extra-mt4” environment, until I was thoroughly beat re: getting that data internally. The txt file is probably better than Global Variables, since I don’t know if they persist if you shut down the platform.

Re: making 1 pip on BreakEven – it seems reasonable to make that little extra, but imagine this, your trade that went to within 1 pip of breakeven then turned around to make full 400% Fib profit. How many 1 pip profits would it take to make up for missing that one. Or more frequently, making maybe 161.7% or 200% fib profits. Our minds usually only look for scenarios that support our hypothesis, not seeing the ones that can render it an unprofittable result.
But, sure, I can add that setting to inputs to see the truth of it. You could be right.

Re: TradeContextBusy, I’ve had this happen before, and usually just put in some code such as "If not TradeContextBusy, then do something. Not sure if that is what they recommend, but I’ll read the link above. Thanks for providing alternatives.

Re: the fib size of 40 vs 58 – I wouldn’t doubt it for a minute, since I only tested it on EURUSD 2012 Jan-Sept. Was just so impressed by the 100% jump in profit.
In your backtest of all the pairs from 2005 to now, how much difference did it make to move the fib size from 30 to 40?

Re: AutoGMT, I am using the autoGMT base time for the open of the day and adding “21:45” to the string as the time to clos, then comparing active AutoGMT time including hours/minutes to that, and close trades when it exceeds the 21:45 time of the day if you make that choice. But, that is making the assumption that trading stops at 22:00 UTC. And I think I discovered that it stops at 21:00 UTC during the summer. So I need to change the code to close trades after 20:45 on friday , if you choose those settings.
If you are testing, then I just hard coded that is the TimeHour(TimeCurrent())>=23 then close trades.
Meaning, if your platform time exceeds 11pm, close trades on Friday however you selected them.

This clearly will not work for those that have platfroms running on EST, and closing at 5pm on Friday. We need to work this one out a bit more.

Re: “The EA from 2005 would of made between $500-$2000 on pairs like gbp/usd, usd/chf and aus/usd.” I certainly hope we can do better than that. On my eurusd backtest, once I found a setup that was safe, I put the risk to 10% and made $600 from Jan-Sep on my $500 backtest account.

But, the backtest GBPUSD looked pathetic. I just closed my eyes and went back to teh EURUSD. :wink:

Im getting the 146 errors as present moment as well, stopping pending orders being placed :frowning:

That’s the TradeContextBusy error.
Ok looks like I need to address it.

By the way, re: HotForex rebates, nice to get rebates, but you pay 1.5 x that in commission. So basically, you’re just reducing the commission by the rebate amount.

I’m trading with ILQ through Elite e services (no spaces on URL), which has pretty good spreads and no commission (the good)
however, they upped the min account size to $5000 from $500 (the bad)
and they never store much history, so when you’re backtest, the most you can get on a good day is 3-6 months and sometimes only a month on higher timeframes, and a couple weeks on lower timeframes. (the ugly)

Still, in the United States, its the “best bang for the buck”

If I wasn’t stuck with US regs, I’d be with ArmadaForex.

Thanks for your reply mitchellforex, that mean i unable to use the EA because the next new day candle happen when i on the way to work.

anyway, thanks for your fast reply.

That can’t be right, is it?

I think our brokers are different. If I’m reading it right, the entry for me during that time wouldn’t have gotten hit.

If your days are different then I imagine we’d get different signals. I got a signal to buy usd/cad. My filter tells me its best not to.

Could be, i do think this EA can be quite profitable. It does generate a good amount of pips at low risk, i see the potential here :slight_smile:

This is a theory at the moment, but i was hoping when we run some backtests it would help to prove or disprove it. (sorry for the extra coding)

Hi guys I just finished reading the thread
I’m excited about this system, I want to trade it manually.
So have I got this right?

Instead of the Entry at the 100.0 Fib Level, make a custom level and ENTER at 110.0.

Use the 23.6 Fib level as the Stop Loss.

Once price hits 131.8 move SL to 110.0.

Once price continues and moves to 161.8 move SL to 131.8.

Once it hits 200 move the SL to 161.8.

If price continues and hits the 300.0 Fib Level move SL to the 200.0 Level.

The final target is the 400.0 Fib Level. Take profit at 400.0.

Pairs to use are
GBPUSD, EURUSD, AUDUSD, USDCAD, USDJPY
but be careful with the JPY pair

Anything else I need to know?

Ok,

Good news:

fibs behave (as far as I can see) exactly correctly now. They will self-modify when pending trades are open and more recent candle pattern sets up a new fib/trade,
but, as long as there is a buy/sell, it will maintain that fib structure until it closes (writing the file to the hard drive proved to be the answer to that one. Thanks SB. Although, it is a .dat and not a .txt file. All the same).

I used the suggest link re: error 146, IsTradeContextBusy so let me know if you still get the error, or if you miss some trades opening. Given these are daily charts, and nothing is happening at “breakneck speed”, I’m sure we’re not going to miss any trades due to a few hundred milliseconds, but I’m curious to see if my fix works.

You now can specify how many pips profit to close “breakeven” at, and Wigglez, you are right, it really helps. I"m backtesting for the best result as we speak, but setting it to 5 pips added about 20% from my usual Jan-Sept eurusd test.

As I mentioned before, it is using AutoGMT (UTC) time function. I added an input so you can type in the UTC time you want the EA to close your trades. As far as I can tell, trading stops at 21:00 UTC, so I put default “20:45” in the slot, but you decide for yourself. I have not had the opportunity to test this part yet, so if it matters greatly to you, make sure you test it on a Demo.

the bad news:

After the “fixes” my profit dropped by 1/3. Not sure what “bad behavior” allowed the extra profit. So, I’ll rely on you guys to test the best settings over time and multiple pairs. It’s too depressing for me to see it really bomb on different pairs. The EURUSD behavior usually gives best results from EA’s in my experience.

The 250 or so pips I was up last night shrank to less than 100 before all retraces took place. I’m currently up 64 pips in 5 open trades. Not sure if I should close them now, but wouldn’t know how the EA works if I do that.

It close AUDCAD trade automatically for 43 pips and earlier, EURJPY for 19 pips, but had a big hit on eurjpy earler (not sure if I close that one or if the EA did) for -34 pips.

Ha, just backtested with extreme settings: TP%500 and risk 15%, with BE pips 15 and FibSize 50. Was able to get profit $1185 on $500 test, Jan-Sep, Profit factor 2.39, 42 trades, DrawDown 37%, Win trades 85%. Results probably not obtainable generally. Now that the fibs and trade modifications are behaving as anticipated, should be able to get more certain results profile.

Anyway, have fun.

Let me know about the 146 error.

Wicks_ea_v16a.zip (9.19 KB)

You’ve got it exacltly right :slight_smile:

I’ve backtested every pair since 2005 and everyone is profitably by a few hundred dollars at least, except for usdcad I think, that was losing overall in the past 5 years.

The pairs like usdchf, gbpusd, eurusd, audusd, audcad are consistantly profitable, as well as usdcad in the last year :slight_smile:

Hi Mitchel, was that backtest using this v16 EA on daily TF?

What settings did you use? Auto R:R?

Thanks.

Last one Ive backtested all the pairs was v15, setting are mostly default except I use a minimum fib size of 40 instead of the deault 50-58.

Also I don’t use the setting of ‘use all open trades for risk’ calculation, ALL my trades have a 2% risk of my equity :slight_smile:

Just an update on version 16 james, backtests are back to be horribly slow and some pairs dont even backtest at all, not sure about live. I haven’t applied it to my charts yet :slight_smile: Ill post some of the errors im getting in a tick :slight_smile: