Fractalated Bob

EA's inspired by nanningbob's work here, especially those based on his 240 Moving Average trend detection filter.
Post Reply
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Fractalated Bob

Post by SteveHopwood »

SERIOUS WARNING
  • Most Forex traders lose all their money.
  • Using the robot posted here in trading Forex does not guarantee success.
  • Trading this robot could lead to serious financial loss.
  • Trading this robot without understanding its underlying trading strategies guarantees traders will lose their money.
  • This is not a set-and-forget ea; there is no such thing and anyone who tries to claim there is, is either stupid or lying. This ea requires frequent manual intervention.
  • At best, a trading robot is only 90% as good as the manual strategy it trades. At best. At worst, it can be much less effective. If the strategy is rubbish, so is the robot.
  • To trade this robot, you have to understand:
    • How to use EA's.
    • Fractals, although I explain these further down.
    • Stochastic indi if you use the optional filter.
OK folks. Droolometers at the ready? Fractalated Bob's first week of demo trading:
USDCHFDaily.png
Intro
I had a good long lol in the bath on Saturday. Old stagers will understand the import of this. My thoughts returned yet again to using Bob's 10.x stuff as the trade setup, then finding something to act as the trigger. My mind was already occupied by thoughts of trend detection because I was coding something privately that used different methods of td, but which drew my attention to it.

I mused about trend detection. Anyone who has been around Forex for more than about 5 minutes will be familiar with this:
  • long trend: a series of higher highs and lows.
  • short trend: a series of lower highs and lows.
-----------------------------------------------------------------------------------------------------------------------------
Insert. Info for newbies
Newbies, 'higher highs and lows' is not always a simple concept to grasp. It took me a few years to grasp it, but I am an idiot so this should not come as a surprise. In case you are unsure:
  • a 'high' is a 5 candle pattern with the highest in the middle. Preceeding it are two candles with lower highs than the one in the middle. Succeeding it are two candles with lower highs than the one in the middle. Think of a neck and shoulders.
  • a 'low' is a 5 candle pattern with the lowest in the middle. Preceeding it are two candles with higher lows than the one in the middle. Succeeding it are two candles with higher lows than the one in the middle. Think of the neck and shoulders turned upside down.
There is an indicator that will make all this clearer for you. Open your CrapTx platform and any old chart. Open the Navigator window (Ctrl + N) and double click 'Indicators'. You are looking for 'Fractals'. If 'Indicators' shows further sub-menus, then double click 'Bill Williams' to find the Fractal indi. Drag it onto your chart. Upward facing triangles indicate a 'high' whilst downward facing triangle indicate a 'low'.
-----------------------------------------------------------------------------------------------------------------------------

I thought about using Bob's H4 240 moving average as the trend filter that I include with almost everything I code, and wondered if highs and lows could be used to trigger trades in the direction of the prevailing trend.

I looked at some charts and noticed this:
  • long trades taken in a long trend after the second of two highs is rising and the second of two lows is rising, often led to profits.
  • short trades taken in a short trend after the second of two highs is falling and the second of two lows is falling, often led to profits.
So was born Fractalated Bob i.e. all of Bob's usual stuff plus Fractals to act as a trade trigger.

Here is where thingies get really interesting. By happenstance, I put FB onto 15 minute charts in order to generate trades to test the EA, on just the charts in the profits pic above. They did indeed generate a fair few trades - some of them picture-perfect. Study this one:
Picture perfect.png
Load the pic into a separate window so you can zoom in. The vertical, dashed turquoise lines highlight the candle at which a trade was taken - EU is in a downtrend so all the trades are sells and you can see the red arrow the EA draws on the charts. Look back 3 candles and you will see the fractals the EA used to decide that a trade was appropriate.

Magenta lines join the high fractals, whilst yellow lines join the low fractals involved in the trading decision. Bear in mind that FB is an EA not an indi, so these lines only occur after a trade is taken and do not extend back into history unless FB was running on the chart at the time. Also, if you delete the lines from your chart after FB has been running for a while, they disappear for good.

Trades are sent without a take profit or stop loss. Losing sequences will ultimately close if the H4 240 MA trend definition changes. Initially, I wanted to see what would happen if the bot opened a string of trades at each new trade trigger. Here is what I found:
  • all the pairs on the demo M15 charts had trades open within a few hours.
  • one or two of the pairs would shoot off in the 'correct' direction and the positive upl of the entire open position would rise.
So, rather than do my usual thing of leaving the ea to its own devices and allow profits to drain away, I started to step in and close all the trades once the overall position reached +2% of balance. I added mptm into the mix to make sure I would not miss any closure opportunities - the attached version is already coded to work with FB. Use it or not as suits you.

The story of FB's first week does not quite end there. Do the markets always cooperate and does FB always get it right? Does it buggery. :D Over in the OAM thread (http://www.stevehopwoodforex.com/phpBB3 ... f=5&t=3649 and if you haven't visited there yet despite all my promptings to do so then you are an idiot) I had been talking about FB as the EA I planned to release over the weekend and whose development had highlighted the futility of fighting the overall trend.

So, I had a OAM EU trade fighting the overall trend. I decided on Friday to set FB loose on the chart, to see what it could do about the situation. First damn thing it did, of course, was close the OAM EU trade because it was on the wrong side of the h4 240 MA. :arrrg: Remember guys, if you must mix EA's on the same platform, at least use different magic numbers for each EA. :arrrg:

Here is what happened:
not so great.png
Load the chart into a separate window again so you can zoom in. This time, you will see several trades taken in the correct direction for the trend - sells in a long trend. This time though, we were in a decent retrace and each sell was taken at a successively higher level. At one point, there were about 10 trades open, all nicely into drawdown. :arrrg:

This pic is taken from my live trading Cowboy IBFX account. Trading 0.01 lots on a c. $500 trading account there is like trading 0.01 lots on a c. $5,000 account pretty much everywhere else a la Bob and his tiny lot sizes but loads of trades. The draw down never even considered becoming an issue to notice, let alone to be concerned about.

So what happened? Some Fed Chairperson Talking Head happened and sent the EU into a spiral - I happened to be at my computer at the time, and closed out all those trades with c. +205 that more than wiped out the loser that FB closed when I first loaded it up.

I have become used to regarding all the trades opened by all the instances of the bot as a 'basket'. On Friday, the demo 'basket' of trades went nicely into drawdown - a couple of hundred pips overall. The Fed spokesperson's pronouncements sent this beautifully into reverse and I was able to close out at c. +70. Not sure what would have happened had the Talking Head's pronouncements sent the markets in the opposite direction. Hey ho. It aint bust yet.......................

Summing up the introduction
Yes, I know. I have imbibed a bit. Plus I am tired because I did not sleep well last night, so in the end I gave up and added the functions to OAM that I posted earlier. I will sort out the intro when I am a tad more compis mentis, OK?

As traded live:
  • recommended time frame: H1
  • pairs: majors + GJ.
  • trades in the direction of Bob's H4 240 MA trend-detection function.
  • takes trades based on Fractals.
  • all trades opened by FB on all charts are regarded as being part of a basket of trades. The basket is closed by mptm at $6 profit per 0.01 lot size. 0.02 lost, profit target is $12. 0.03 lots, target is $18. Global Prime live trading account: 1 pip = 10 cents, so a 10 pip movement is $1.
Other Bob stuff
It is all there along with the usual other stuff, so read the attached user guide for details. You can combine the above with Slope, Css, RSI2 etc. Take your pick. Use different time frames and play to your hearts content.

The TradingTimeFrame input
This must be the time frame you intend to trade as FB bases all of its calculations on it. This allows you to change time frames on your chart to view different scenarios without disturbing FB. The downside of getting this wrong is something you will discover to your cost.

Optional maximum distance filters
  • Minimum distance from the Moving Average. If enabled, FB draws a dashed Turquoise line to show this price on our charts, then:
    • MinDistanceToMaPips: the closest that FB will allow the market to approach the MA before cancelling a trade. Zero value to disable this filter.
    • ShowMinDistanceOnly: defaults to 'false'. This allows you to have the line on your chart for reference and research, but FB will not use it to cancel a trade.
  • Maximum distance from the Moving Average. If enabled, FB uses ATR to calculate the price for drawing a dotted Turquoise line to show this price on our charts, then:
    • AtrPeriod: the default equates to roughly a month of D1 trading. Zero value disables this filter.
    • AtrTimeFrame: the time frame used to calculate the ATR. Enter this input in minutes. The default is the D1.
    • AtrMultiplier: multiplies the calculated ATR by this figure.
    • ShowMaxDistanceOnly: defaults to 'true'. This allows you to have the line on your chart for reference and research, but FB will not use it to cancel a trade.
  • Minimum pips between trades. These allow you to set the pips distance between the latest trade opened and a new one. The idea is to prevent too many trades being opened at close opening prices.
    • MinBetweenWinTradesPips: imagine you are in a long trend and taking buy trades. The market moves in your favour and your latest trade is in profit. FB will not take a new trade until the market has moved MinBetweenWinTradesPips upwards. So, if the input is 20 pips, then FB will only take new trades when the market has moved 20 more pips in our favour, and there is a fresh buy signal.
    • MinBetweenLossTradesPips: imagine you are in a long trend and taking buy trades. The market moves against you and your latest trade is in loss. FB will not take a new trade until the market has moved MinBetweenLossTradesPips downwards. So, if the input is 40 pips, then FB will only take new trades when the market has moved 40 more pips against us, and there is a fresh buy signal. The idea is that the pair will reach breakeven if the market then moves back in our favour by 20 pips. The first trade will be -20 but the latest will be +20. The upside of this sort of Recovery is: a pair reaches breakeven then profitability much more quickly than if the first trade is the only one. The downside is: if the market continues to move against us, we find ourselves with more losing trades. What happens in a sustained run against us is the big question FB has to answer.
Optional Stochastic Filter
Perceived wisdom is this: Stochastic > 70 means the market is overbought i.e. has risen for a substantial period of time and is due a retrace downwards; Stochastic < 30 means the market is oversold i.e. has fallen for a substantial period of time and is due a retrace upwards.

Using the Stoch filter is an attempt to avoid buying when Stoch is overbought and selling when oversold, an so cut down on those frustrating periods of drawdown that we all experience.
  • UseStochastic: turns the filter on/off. On by default.
  • StochTF: the time frame for your Stochastic, to make it independent of the chart time frame. The H4 default is pure guesswork based on my Stochy Bob demo.
  • StochBuyBelow: only take a buy trade when all the other filters line up and Stoch is <= StochBuyBelow - 'buying the dips'.
  • StochSellAbove: only take a sell trade when all the other filters line up and Stoch is >= StochSellAbove - 'selling the rallies'.
Leave the other inputs alone unless you know what you are doing.

Mike's individual pair as a basket inputs
magft (Mike) has contributed code to this EA that allows us to treat the pair it is trading as an individual basket. This is different to using mptm to treat all open trades as a basket. Imagine you have 3 GU, 2 EU and 5 GJ trades open. Mikes code allows us to treat each individual pair as a 'basket' and manage each 'basket' individually. The inputs are:
  • BasketCashSl: the individual pairs' basket of trades closes when their combined loss hits this cash total.
  • BasketCashSlPercent: the individual pairs' basket of trades closes when their combined loss hits this percentage of balance figure.
  • BasketCashTp: the individual pairs' basket of trades closes when their combined profit hits this cash total.
  • BasketCashTpPercent: the individual pairs' basket of trades closes when their combined profit hits this percentage of balance figure.
Chart screenshots
FB can take a picture of your chart when it opens or closes a trade. Use this to post pictures here if you suspect that FB has not behaved as expected. There is a section of inputs just underneath the minimum pips section, with inputs to turn this featureon/ off and to adjust the height and width of the snap. Files are saved with the name "ChartScreenShot" and the ticket number, when the EA opens or closes a trade. Navigate to the files via File/Open Data Folder/MQL4/Files. Remember to delete these files from time to time to avoid clogging up your disk drive.

Keeping track with iHistory
The attached iHistory indi is the indi I use to keep track of my progress and generate the pictures I post here. Copy it in your platform's Indicators folder. Open a chart you do not trade, add the Blank template to it and drag iHistory onto the chart. It works with the information you have in your History tab. Sometimes it needs reloading before showing any information, especially at the weekends.

In conclusion
Have fun guyesses and guys

:xm:


Attached scripts
We have 2 fantastic scripts presented by members. They save a hell of a lot of work, so warm thanks guys: :clap: :clap: :clap:
  • Copy template to all charts script, contributed by michaeldz. Add your charts, setting your time frames as you go. Then set up one chart with all your indi's and EA. Then drag this script onto the chart and it will add the chart template to all the other charts.
  • Charts Into Alphabetical Order script, contributed by Arts. Add your charts - forget about time frame. The pick one chart, select your required time frame. Add your indi's and EA. Drag the script onto the chart and it will convert all the others into the same time frame, add the same same template and sort them into alphabetical order. Fantastic, or what.
Matters of general interest
Go here to download and run the script that will fill your platform's missing chart history: http://www.stevehopwoodforex.com/phpBB3 ... f=15&t=254
Read this post:
http://www.stevehopwoodforex.com/phpBB3 ... p?f=6&t=78 Newbie traders, read this for inspiration and warning. Those of you who have suffered losses, read it for inspiration.

Masterly summary of hedging: http://www.forexfactory.com/showthread. ... ost4977179

EA coding
I receive may requests to code EA's. Traders, if I code your EA for free, then I will share it here. If you want me to code your EA without sharing, then my fee is $100 payable into my paypal account. I explain why at http://www.stevehopwoodforex.com/phpBB3 ... ?f=15&t=79, at the bottom of the post.

Useful utilities/EA's/scripts
list][*]Multi purpose trade manager: http://www.stevehopwoodforex.com/phpBB3 ... ?f=21&t=64
[*]Account equity analyser: http://www.forexfactory.com/showthread. ... ost4709098, which includes a template for both USD and the Euro.
[*]Past-trades display indi by squalou; shows a graphical display of the success/failure of trades in your History tab. Breathtaking piece of work. http://www.forexfactory.com/showthread. ... ost3830610
[*]My shell EA – the code I use to produce EA's so quickly. http://www.stevehopwoodforex.com/phpBB3 ... ?f=15&t=79[/list][/list]

-
You do not have the required permissions to view the files attached to this post.
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
woodlands
Trader
Posts: 226
Joined: Sun Mar 23, 2014 6:16 pm

Fractalated Bob

Post by woodlands »

Thanks Steve for this, I had spare micro and put on it so the link below has history before your EA, it is running as you posted and very smoothly so far. The EJ is a trend trade waiting on Spider's ALR that I am putting on everything............ :roll:
Cdt
Tony
Last edited by woodlands on Fri Sep 12, 2014 5:56 am, edited 1 time in total.
spotdespot
Trader
Posts: 768
Joined: Sun Jan 22, 2012 11:38 pm

Fractalated Bob

Post by spotdespot »

I have it running on a few pairs too Steve - looking like all is running well thanks.

One suggestion would be to have a minimum distance from H4 240 MA to open a trade as I had a few trades open very close to the MA and then a small retrace knocked them out.

Cheers,
Dave.
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Fractalated Bob

Post by SteveHopwood »

spotdespot » Mon Aug 25, 2014 5:21 pm wrote:I have it running on a few pairs too Steve - looking like all is running well thanks.

One suggestion would be to have a minimum distance from H4 240 MA to open a trade as I had a few trades open very close to the MA and then a small retrace knocked them out.

Cheers,
Dave.
Good idea. Will do.

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
bourgenot
Trader
Posts: 159
Joined: Mon Aug 27, 2012 4:37 pm

Fractalated Bob

Post by bourgenot »

Hello! Please, i would like this indicator (mq4), thank you for your help!
You do not have the required permissions to view the files attached to this post.
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Fractalated Bob

Post by SteveHopwood »

bourgenot » Mon Aug 25, 2014 6:53 pm wrote:Hello! Please, i would like this indicator (mq4), thank you for your help!
Does someone fancy knocking this together? All the line drawing stuff is in the EA and it only needs someone who understands indi code - should take about 5 minutes. I am not going to attempt it - all that IndicatorCounted stuff makes my eyes glaze over.

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
bourgenot
Trader
Posts: 159
Joined: Mon Aug 27, 2012 4:37 pm

Fractalated Bob

Post by bourgenot »

I am sorry, to be stupid! thank you!
Lowphat
Trader
Posts: 121
Joined: Fri Jun 27, 2014 12:20 am

Fractalated Bob

Post by Lowphat »

bourgenot wrote:Hello! Please, i would like this indicator (mq4), thank you for your help!
Indicator that "only" connects fractals so if your looking for it to do something else this isn't for you
FractalChannel.mq4
You do not have the required permissions to view the files attached to this post.
User avatar
SpiderX
Trader
Posts: 554
Joined: Thu Aug 22, 2013 4:50 pm

Fractalated Bob

Post by SpiderX »

woodlands » Tue Aug 26, 2014 1:04 am wrote:Thanks Steve for this, I had spare micro and put on it so the link below has history before your EA, it is running as you posted and very smoothly so far. The EJ is a trend trade waiting on Spider's ALR that I am putting on everything............ :roll:
Man...you are brave.
wouldnt even dare to put the trade manager on my own accounts since it is relatively untested.

Cheers
"Love is patient, love is kind. It does not envy, it does not boast, it is not proud. It does not dishonor others, it is not self-seeking, it is not easily angered, it keeps no record of wrongs.Love does not delight in evil but rejoices with the truth. It always protects, always trusts, always hopes, always perseveres."
-Corinthians 13:4-8
User avatar
bourgenot
Trader
Posts: 159
Joined: Mon Aug 27, 2012 4:37 pm

Fractalated Bob

Post by bourgenot »

Lowphat, Thank you for the indy, have a good day!
Post Reply

Return to “Thingy Bob EA's”