James16: the EA

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

James16: the EA

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 tells you there is, is either a liar or an idiot.
    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:
DO NOT TRADE THIS EA ON A LIVE ACCOUNT. IT IS EXPERIMENTAL.

Ehup all

James16's thread is one of the oldest at Forex Factory. Started in about 2005, it is still going strong. Shelley is ploughing her way through it in the hope of being able to provide synopses that I can automate.

Automated strategies
I have automated tow of the trading methods: Note to users
As I add new trading strategies to the EA, each fresh block will have the same input names with a prefix that is the initials for the method - hence all those Bovb.TakeProfit etc inputs. Each block will also start with a link to the post in which Shelley publishes her summary.

xxx.AtrPeriod allows you to use Atr to calculate stop losses and take profits. Disable this by setting the value to zero.

xxx.RsiPeriod allows you to use the Rsi to determine an overall trend direction. This little masterpiece was provided by scooby-doo a couple of years ago. Scoobs is a rich, retired former pro trader who gave us this gem:
  • Take a 20 period, D1 Rsi:
    • Rsi > 55: trend is long
      Rsi < 45: trend is short
      Rsi is in between these values: market is ranging
The attached MTF Rsi allows you to have the indi on your chart should you find this helpful.

xxx.Trade turns the individual trading method on or off.

xxx.TimeFrame allows you to specify the trading time frame. The default of 0 means, 'current chart', but some methods may be better suited to different time frames, so these inputs will allow you to be specific.

I have abandoned all attempts to hide from the crims the fact that we are trading using an EA here. We are going to end up with an EA that trades a wide range of systems on the same chart, so James has to know which one is which. Each system will have its own magic number and trade comment.

General inputs:
  • CriminalIsECN=false; set this to true if your crim insists on the two-stage order thingy. J automatically detects Cowboy IBFX.
    CriminalAllowsHedging=true; In case it is possible for one system to generate a buy, whilst a different one generates a sell. Set this to false, if your crim does not allow this. Then find another crim.
    MaxSpread=120; this will need to be set on a pair-by-pair basis. If the spread exceeds this figure, the bot will not trade.
    SendAlertNotTrade=false; for the manual traders wanting to use the EA to generate warnings that the conditions appear to be met for trading, but who want the final say over when to pull the trigger. If true, this tells J to send an Alert rather than take the trade.
    Email=false; for the manuals again. This will send an email if your platform is set up for this.
You can see some of the usual features missing - swap filter, trading hours etc. These are easily added should the need for them arise. With trading hours especially, I want to see if these can be used overall or have to be personalised for each trading system.

I am in no hurry to add further trading methods at this stage. Once the existing code is watertight, then adding them will be simple. For now, let's concentrate on debugging.

Note to coders
I have given a lot of thought to the code structure. I wanted to create a structure that allows strategies to be added easily, with just a few copy/paste amendments. Here is how to add new strategies:
  • - add an extern input block. Copy the existing Bovp.xxxxx block, then change the Bovp bit to reflect the new strategy e.g. TM (Two Matching ....).
    - initialise any variables that need this in int init() - candle bars etc
    - add code to ReadIndicatorValues() to read Rsi etc
    - update DisplayUserFeedback to show the trigger details.
    - update CountOpenTrades() to reflect the added trigger.
    - add a xxxTrading() where 'xxx' is the relevant trigger e.g. void BovbTrading()
    - add a call to the new trading function to void TradingOpportunitiesModule()
In conclusion
No idea where all this is heading. Let's see.

:D

Matters of general interest

Read this post:
http://www.forexfactory.com/showthread. ... ost4923611 Newbie traders, read this for inspiration and warning. Those of you who have suffered losses, read it for inspiration. There is a thread devoted to Sam's trading method at http://www.forexfactory.com/showthre...25#post5118825

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.forexfactory.com/showthread. ... ost4431794, at the bottom of the post.

Useful utilities/EA's/scripts
Matt's chart-population script at http://www.stevehopwoodforex.com/phpBB3 ... 5733#p5733. Use this every time you start a fresh platform.
MaryJane has posted a fabulous utility to allow us to resize EA input windows: http://www.forexfactory.com/showthread.php?t=299017
Multi purpose trade manager: http://www.forexfactory.com/showthread.php?t=89371
Account equity analyser: http://www.forexfactory.com/showthread. ... ost4693716 Also at 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 ... p?f=5&t=15
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. [email protected] 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.
okehiedon
Trader
Posts: 21
Joined: Tue Nov 15, 2011 10:38 pm

Re: James16: the EA

Post by okehiedon »

This looks good. Will follow closely cos the manual strategy is sound.
User avatar
hiredwhip
Trader
Posts: 90
Joined: Tue Nov 15, 2011 7:36 pm
Location: Mountains, East Coast USA

Re: James16: the EA

Post by hiredwhip »

This is a great thread Steve......Been around a long while......Will give this a go

Have a great week

whip
A rainy day is of enormous value to both the farm and the farmer....Stay Hungry. Stay Foolish....
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: James16: the EA

Post by SteveHopwood »

Hehe. Dozy twazzock that I am, there is a magnificent bloop in the code. Fix in post 1.

Coders, go to void BovbTrading() and find this line of code in the Buy filters section, and its partner in the Sell section:

Code: Select all

if (Bovb.RsiPeriod > 20 && Bovb.Trend != up) SendLong = false;
Your cat can probably tell you that the code should be:

if (Bovb.RsiPeriod > 0 && Bovb.Trend != up) SendLong = false;

:D
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. [email protected] 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
fxozgirl
Trader
Posts: 1176
Joined: Wed Nov 16, 2011 9:16 am
Location: Melbourne, Australia

Re: James16: the EA

Post by fxozgirl »

I've got this set up on a chart...
looking forward to seeing how it goes

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

Re: James16: the EA

Post by SteveHopwood »

Latest update in post 1. I found a damn silly mistake when I thought to run a backtest tonight.

Coders, amend start() so it reads thus:

Code: Select all

int start()
{

   CountOpenTrades();

   ReadIndicatorValues();

   //Delete orphaned tp/sl lines
   static int M15Bars;
   if (M15Bars != iBars(NULL, PERIOD_M15) )
   {
      M15Bars = iBars(NULL, PERIOD_M15);
      DeleteOrphanTpSlLines();
   }//if (M15Bars != iBars(NULL, PERIOD_M15)

   //Look for trades
   TradingOpportunitiesModule();
   
   DisplayUserFeedback();

}
The added bit is the call to ReadIndicatorValues(); Without this, the bot is only working with figures it read at startup.

:D
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. [email protected] 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.
grimweasel
Trader
Posts: 95
Joined: Sun Nov 20, 2011 3:48 pm

Re: James16: the EA

Post by grimweasel »

The crux of the method Steve is price action reversal candles at support and resistance. When combined with Fib levels (swing high to low 38, 50 and 61% levels) for added confluence it can be quite powerful. The issue is coding the EA to recognise the candles (Bearish/Bullish Engulfing, Bear/Bull Outside Bar, Hammers and Shooting Stars) and when to trade those candles. No point trading a hammer for example in the middle of the chart not resting on a support level.

Some people wait for the first candle to trigger then trade the retrace into the signal candle as this effectively gives you a lower high confirmation with a BEEB or Shooting Star. This also prevents the trader/EA from trying to pick counter trend tops and bottoms.

You could combine the entry with Squalou's daily SR indicator? ie the signal candle must be touching one of the dynamic daily or weekly levels. This would ensure confluence with a SR level and prevent taking candles hanging in between major levels? For added security you could add a filter that only enters the trade in the direction of the 10 or 20 ema. This would ensure you only take trades with the underlying trend (ie a reversal candle on a retrace into the underlying weekly / monthly trend if using daily charts as your trading time frame)
User avatar
fxozgirl
Trader
Posts: 1176
Joined: Wed Nov 16, 2011 9:16 am
Location: Melbourne, Australia

Re: James16: the EA

Post by fxozgirl »

The EA took 3 trades this morning:

AUDUSD (currently +20 pips)
audusd_bovb001_trade.gif
NZDUSD (currently +2)
nzdusd_bovb001_trade.gif
AUDCAD (currently -9)
audcad_bovb001_trade.gif
So EA is taking trades correctly :D ...now to manage the trade ;)
You do not have the required permissions to view the files attached to this post.
grimweasel
Trader
Posts: 95
Joined: Sun Nov 20, 2011 3:48 pm

Re: James16: the EA

Post by grimweasel »

Two points on those activated trades:

1. I never take BUOB or BEOB trades unless they are in the 'correct'place. For a BUOB I would like to see this at the bottom of a move down. The bar shows buyers stepped in at that level and overcame sellers; vice versa for a BEOB which I would like to see at the top of a rally. Same principals behind trading hammers and shooting stars (or Pin Bars, as J16 calls them).

2. I have always opened orders on the breaking of the extreme of the bar and wick. This shows the full days movement and the rejected area in the case of a wick. It's safer for MM and RM to place orders above and below the bar and wick extremes, not the body of the bar.

Trading manually I would not have taken any of those trades as they are just bars in areas of consolidation. For them to be active signal bars they need to be on an area of SR or a strong trendline, and they need to be at a retrace or top/bottom of a rally/fall.
Surya buana
Trader
Posts: 17
Joined: Thu Dec 22, 2011 3:33 pm

Re: James16: the EA

Post by Surya buana »

halo everyone this is my first post ,
i learn a lot in this forum, many thanks to Steve and others

i have an idea that estimate lowest or top price for a day using RSI

we need indicator for that to make it easy to calculate

previous Bar price close - currrent Bar price close examp 1 : 1.3420 - 1.3450 = 30 pip

RSI previous Bar= 45 - RSI current Bar = 55 examp 2 : RSI 45 -55 = 10

examp 1 divided examp 2 ( 30 / 10 ) = 3 pip

conclusion : 1 RSI = 3 pip

if RSI 75 = 75-55 = 20 * 3 = 60 pips so the top price estimate = 1.3450 + 60 = 1.3

can someone make this indi it will be very useful
Locked

Return to “Automated trading systems”