Once a day basket trading EA

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.

Once a day basket trading 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 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.
    • The concept of basket trading.
THIS IS AN EXPERIMENTAL EA NOT YET BEING USED ON OUR LIVE ACCOUNTS

Bob pointed out in his 10.7 thread that weekly candles tend to have full bodies - not always but a strong tendency. Look at a few W1 charts and you will see this.

This suggests that once the weekly trading direction is established, there is every likelihood it is going to continue in that direction. This gave me the idea for the Once a Week basket trader EA at http://www.stevehopwoodforex.com/phpBB3 ... f=5&t=3587

It was not long before I was changing the EA inputs so that it opened a basket at 8.00 London time, then closed it at 16.00. This worked well until Wednesday, when a near +300 pip high point turned into a near -600 pip loss basket close.

Given that I was already trading the EA once a day rather than once a week, and that I needed slightly more effective trade management, I decided to adapt OAW.

Once a Day trades thus:
  • open the basket at the start of my chosen trading hour in the direction of the weekly movement.
  • closes the trades at a pre-chosen cash profit target.
  • closes the basket at my chosen closure hour if the tp has not been hit.
That is all that OAD does. There are no management features apart from a cash take profit - although this is a tad more sophisticated than at inception, so read the inputs details below. You can opt for individual trade management or more advanced basket trading management by using: The inputs:
  • PairsToTrade: this is the list of comma-separated pairs you want to include in your basket. Linked to this and much further down is ShowPairInfo. If ShowPairInfo is set to true, OAW will display a list of your pairs and their Bid on the chart. The purpose of this is to allow you to check that all the pairs are available via your broker. The pair is not available to you if the Bid shows up as zero. Once you have deleted unwanted pairs, set ShowPairInfo to false to cut down on processor use. Forget about pair suffixes - anything I code automatically takes care of these.
  • MinimumTradableMovementPips: this is the smallest number of pips the market must move away from the weekly open to allow a trade. OAD and its mum, OAW, quickly showed that taking trades when the market was close to the weekly open often resulted in them looking as though they had been taken in the wrong direction after the market quickly reversed. I have no idea whether the default of 20 is any use - we are talking pure guesswork here.
  • anyone who needs Lot or TradeComment explaining needs to spend time with a therapist.
  • CashProfitTarget: you have in your mind the profit in dollars, euros, pounds, martian qqxzzxqq or whatever you want to bank as a profit target. The default represents c. 2% of the balance of my GP demo, so play with this and find a value that suits your account.
  • CashProfitTargetPerTrade: if > 0, this tells OAD to multiply the number of trades on your account by this figure, to create a CashProfitTarget resulting from this calculation.
  • AlwaysOn. If left to the default of 'true', this input tells the ea to loop around its decision code twice a second instead of waiting for the next tick. To see the difference this makes, turn it off and compare the displayed 'Current profit' on the chart with the actual profit displayed by your platform. If 'true', this causes difficulties with accessing the inputs window and platform freezes if you try to do anything at all whilst EA's are enabled, so remember to disable them first. You will see what I mean the first time you forget.
  • TradeMonday. If left at the default of 'true' OAD will trade on Monday. If set to false, it will sleep for the day.
  • MondayTradeOpenHour is the input that tells you at which time of your trading day to send the trade on Monday. This input works on your own local computer clock time, so it you want trades sending at 10.00 am then enter 10. Forget about broker time etc.
  • MondayTradeCloseHour tell OAD when to close the basket if it has not hit tp.
  • Subsequent TradeTuesday etc inputs give you day to day control over your trading days and hours.
  • ShowTradingChoices tells OAD to show a list of your trading day/open/close choices.
So, on my machine, using default inputs in my own local time:
  • at 8.00 AM on each morning, OAD sends trades in the direction already established by the current W1 direction. W1 has risen, it buys the pair. W1 has fallen, it sells the pair.
  • at 4.00 PM on each afternoon, OAD closes all open trades owned by the bot unless the basket has already hit tp.
Questions about telling the time are banned. Work it out for yourselves. Old stagers know to take me seriously when I say this. Newcomers will learn to their cost that I am serious should they ignore this.

Pop the ea on a demo in time for next week. It is a basket trader, so you only need it on one chart - I suggest GJ. Change the trading hours and cash take profit to suit yourself, then leave it alone for the time being. Ideas about dealing with losing trades/adding to winning trades might come up in the future. We shall see.

Have fun.

:xm:

dudest variant on all this
dudest has posted an ea that works along the same lines, but is an interesting looking variant. Try it out.
Link: http://www.stevehopwoodforex.com/phpBB3 ... f=5&t=3612

Brief description:
1. Currently applied on 10 pairs only
( AUDUSD, CADCHF, CADJPY, EURNZD, EURSEK, GBPJPY, GBPNZD, NZDUSD, USDSGD, XAUUSD )
2. Apart from CADJPY, CADCHF and GBPJPY, the others assume that the Monday candle is telling a lie; so on Tuesday, the trade that is opened is opposite the Monday close
3. StopLossPips and JumpingStopPips are provided by half the 5-day ATR.
JS only moves SL to BreakEven ( +2 pips BEP default )
4. This one uses the Broker's time, not the local computer time.



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
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
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Once a day basket trading EA

Post by SteveHopwood »

V 1a is in post 1. I forgot to add code to tell OAD to have a rest when we disable EA's.

I decided to open charts to check that oad is trading the correct direction and immediately came across an AChf buy that looks as though it should have been a sell. I have added to the pair chart display info, so we can see the weekly open price, the direction and distance the market has moved since the open, and the spread in case this has an effect.

I also came across some trade direction code that needed tightening, so downloading the update is well worth while.

It looks as though the faulty trades are sent when the market has only moved a few pips. I am thinking that we maybe need a minimum pips movement to allow the trade. I am also thinking that a dynamic take profit might be a good idea, say x dollars per pair traded.

I shall mull this 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
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Once a day basket trading EA

Post by SteveHopwood »

V 1b is in post 1.

I am thinking that we might need a minimum pips movement before sending a trade early in the week. Later in the week, we might need an allowable maximum pips movement. To help us decide, I have added the Average True Range calculation to the chart display. I have multiplied the value returned by the indi so that it is displayed in full pips to help us compare the movement at trading time with that of the average.

OAD does nothing with the information at the moment. Let's watch the display for a while and see what conclusions we can reach.

I am not leaving Once A Week out of all this. At some point soon, I will add the facility to trade OAD in OAW mode.

: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
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Once a day basket trading EA

Post by SteveHopwood »

V 1c is in post 1. Copied from the updated post:
  • MinimumTradableMovementPips: this is the smallest number of pips the market must move away from the weekly open to allow a trade. OAD and its mum, OAW, quickly showed that taking trades when the market was close to the weekly open often resulted in them looking as though they had been taken in the wrong direction after the market quickly reversed. I have no idea whether the default of 20 is any use - we are talking pure guesswork here.
  • CashProfitTargetPerTrade: if > 0, this tells OAD to multiply the number of trades on your account by this figure, to create a CashProfitTarget resulting from this calculation
The pips movement display on the chart is fascinating. Look at UC (Global Prime demo). It has moved zero pips (at the time of writing) in two days. Granted it has a hilo of c. 36 pips, but is it asleep or what? :D

I have enjoyed OAD so far. 3 days of trading and +565 pips. The acid test comes when a losing day comes along and wipes out three months of steady progress. :arrrg: Hey ho. We shall have to see what a losing day brings with it.

: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.
excalibre30
Trader
Posts: 68
Joined: Sat Mar 08, 2014 7:45 am

Once a day basket trading EA

Post by excalibre30 »

Hi Steve, hope this finds you well. I have been enjoying OAW EA and it has been making a lot of profits and tempted to put it on real. Because of this success, I want to try OAD. I used the very first bersion but encountered an error. The error says, error (131): invalid trade volume when opening some trades and it goes to a loop. I have since updated to 1c but still get the same error.

I used OOTB settings and the demo is with GP. There are a lot of margin left on the demo so I am not sure what is causing the error. I want to report it just in case others may be getting it too.

Thanks to you and this great forum!
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.

Once a day basket trading EA

Post by SteveHopwood »

V 1d is in post 1.

MinimumTradableMovementPips is a bit of a blunt instrument - I am thinking it might be better to have this as a percentage of atr instead. Ditto the as yet uncoded maximum percentage to allow a trade - at the time of writing audjpy has already moved 101% of its weekly atr, so trading it might be a bad idea. We shall see.

I have added the percentage of the weekly atr that the market has moved, to help us come to conclusions about this.

Re this:
excalibre30 » Wed May 21, 2014 1:00 am wrote:Hi Steve, hope this finds you well. I have been enjoying OAW EA and it has been making a lot of profits and tempted to put it on real. Because of this success, I want to try OAD. I used the very first bersion but encountered an error. The error says, error (131): invalid trade volume when opening some trades and it goes to a loop. I have since updated to 1c but still get the same error.

I used OOTB settings and the demo is with GP. There are a lot of margin left on the demo so I am not sure what is causing the error. I want to report it just in case others may be getting it too.

Thanks to you and this great forum!
I am developing the ea on a GP demo using ootb trading pairs and have not encountered this problem - nor have I ever done so in the basket traders I coded previously. The only thingy I can think of is so ridiculous that it is beyond laughable.

Trouble is, CrapQlx is a steaming pile of fetid dingo turd whose only redeeming feature is being so simple that even a dormant dimwit like me can learn to program it, so here is a possible explanation:
number variables that do not have decimal points are declared as integers hence extern int MondayTradeOpenHour=8 in the code; number variables that have decimal points are declared as doubles, hence extern double Lot=0.01 in the code;

So, if A and B are both integers, and both = 20, then A = B.

One of the thingies I learned early in shf's development is this: computer languages occasionally change the final zero after the decimal point to a 1 but do not show this in any value display unless the code instructs the display to show all 8 zeroes.

If A and B are both declared as doubles and both equal 20, then they actually have 20.00000000 as their value. So, if the gremlin kicks in then one of them might have a real value of 20.00000001, and so A is not equal to B all of a sudden.

So, just suppose that OAD's Lot variable suddenly becomes transformed to 0.01000001 during the loop that sends the trades? We then have an invalid trade volume that OAD cannot recover from. Sounds implausible, I know, but this is CrqpQl we are talking about here.

Programming languages not written by pre-pubescent amateurs during a drug induced high, have a function to deal with the problem. Obviously CrapQl does not have this feature, so work arounds have to be hand-coded. I have added one by fxdaytrader that fixes it should the lot size be up the pole, and this is included in V 1d. No idea whether it will fix your problem, but it never does any harm to have anti-CrapQl weaponry deployed. Try it and see.

: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.
excalibre30
Trader
Posts: 68
Joined: Sat Mar 08, 2014 7:45 am

Once a day basket trading EA

Post by excalibre30 »

Thanks for the reply, Steve. Will try this out when I get home and report back. I am thinking of putting OAD in another Empty4 and see if there are any differences.

Thanks again!

Btw, the trades that OAD managed to open before spewing the errors are in 90 pips profit as of writing.Really awesome.
User avatar
bourgenot
Trader
Posts: 159
Joined: Mon Aug 27, 2012 4:37 pm

Once a day basket trading EA

Post by bourgenot »

:cheer: hello all .. I wonder why it's no more interest for this EA, which is very promising. Never lost; + $ 10 per day. Ty Steve ..
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.

Once a day basket trading EA

Post by SteveHopwood »

New toy guys http://www.stevehopwoodforex.com/phpBB3 ... f=5&t=3643

This one puts OAW and OAD into the same ea and has a third option to send individual stop losses and take profits with the trades.

: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.
Post Reply

Return to “Automated trading systems”