Changing code of one of Steves old EA's...

Ask your basic questions confidently here. Flaming is not allowed. Sympathetic help is the order of the day.
HannesJoubert
Trader
Posts: 282
Joined: Wed Oct 30, 2013 11:06 am
Location: South Africa

Changing code of one of Steves old EA's...

Post by HannesJoubert »

Hi Steve, everyone, I am a new member here, having been directed here from FF.

I came across an old open source EA coded by Steve called The Captain: an always-in-auto-trader. The concept intrigued me, but as is usual, I have my own ideas surrounding this method and would like 1 or 2 "simple" changes to the EA.

Given the fact that I have no absolutely no coding experience or ability whatsoever I have come to this forum, hat in hand, in the hope that those changes might be made here...keep in mind, to me, these changes seem simple, but that in reality they might no be so much... :oops:

So, in light of the above, is anybody willing to have a look, perhaps give an opinion and after all that maybe make the changes??

Thanks

Hannes

Edit by Steve:
I have hijacked this bit of Hannes post so I can put updates to the EA where they can be found easily.

Attached is the latest version of the update I made to the original that Hannes posted. This includes all the usual bells and whistles - details in the Shell User Guide.

Note that Slop and CSS are no help if you turn on TradeOppositeOfTrigger.

:D
You do not have the required permissions to view the files attached to this post.
phil_trade

Re: Changing code of one of Steves old EA's...

Post by phil_trade »

HannesJoubert wrote:Hi Steve, everyone, I am a new member here, having been directed here from FF.

I came across an old open source EA coded by Steve called The Captain: an always-in-auto-trader. The concept intrigued me, but as is usual, I have my own ideas surrounding this method and would like 1 or 2 "simple" changes to the EA.

Given the fact that I have no absolutely no coding experience or ability whatsoever I have come to this forum, hat in hand, in the hope that those changes might be made here...keep in mind, to me, these changes seem simple, but that in reality they might no be so much... :oops:

So, in light of the above, is anybody willing to have a look, perhaps give an opinion and after all that maybe make the changes??

Thanks

Hannes
Hello and Welcome

publish the EA source code and what you would want to modify ! Sure someone will do this ;)

cheers

Philippe
HannesJoubert
Trader
Posts: 282
Joined: Wed Oct 30, 2013 11:06 am
Location: South Africa

Re: Changing code of one of Steves old EA's...

Post by HannesJoubert »

Hi Philippe, many thanks for the warm welcome, it's really appreciated.

Okay, following is the basic premise of the EA as from the original post on FF quite a few years back

"Steve,

I am an intraday trader but am testing a new system and I need an EA. I'm wondering if you would be willing to help me out.

It is a very simple EA, I'm willing to bet one of the simplest you've ever coded. Here is what I am looking for.

Let's assume blue are bullish candles and red are bearish.

Candle prints blue, buy.
Candle prints red, sell.

But have it continuous. Fore example. keep buying on every blue candle close, until a red prints, and then close all and reverse.

Blue-buy, blue-buy, blue-buy, red-close all and sell, red-sell blue-close all and buy etc.

With the following selections

Lot Size
Time Frame
TP and SL (in Pips)

That is it, very simple. Hopefully you could help me out or point me in the right direction.

Cheers!
"

Steve was kind enough to code the EA for the OP and it works as he/she intended. So the "backbone" of the EA is fine. However ( ;) ) I would need the EA to work in the following manner to suit the trading method that I am developing:

Assume blue are bullish candles and red are bearish.

EA waits for two candles of the same colour (specifically colour, not price, is that possible?) to open a trade at the close of the second candle of the same colour, in the direction implied by the colour of the candle. i.e. two consecutive blue candles (By above definition, bullish) the EA opens a long trade as soon as the second candle has finished printing. (This is the 1st change to the original code, the original only looked for one candle to choose direction) Only one trade is opened,not continuously as per the original EA (this is the 2nd change)

For short trades, the exact mirror is to take place.

The EA is still designed to be a "continuous-in-the-market" trader, so any long trades are to be replaced by short trades, as per the original code, but, using the above mentioned 2nd candle confirmation entry method.

If I may explain via example:

1st ever Candle: Bull Candle (EA does nothing, it waits for the close of the next candle for confirmation); 2nd Candle bull candle (EA opens trade at close of second candle, long direction); 3rd Candle bull candle (EA does nothing, leaves trade open in long direction); 4th Candle: bull candle (EA does nothing, leaves trade open in long direction; 5th candle: Bear candle (EA does nothing, leaves trade open whilst waiting for a confirmation Bear candle or continuation bull candle); 6th candle: Bull candle (EA does nothing leaves trade open); 7th Candle: Bear Candle (EA does nothing, leaves trade open whilst waiting for a confirmation Bear candle or continuation bull candle); 8th Candle: Bear candle (EA closes open long trade; opens a short position on seeing 2nd confirmation bear candle) and so on and so on..

The user changeable variables of the original code seem fine, with the exception of I would like to elect the TP myself whilst monitoring price action, either manually or by moving up the original stop loss, therefore, I see the parameters as being:

Lot Size
SL (Is it possible to hide this from the broker, just in case?)
NO time frame (The OP requested time frame to be a variable, but later, in consultation with Steve, opted to leave this out, so this must please remain out...)

That's all I can think of at the moment...

Any takers? :D

Take care,

Hannes
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.

Re: Changing code of one of Steves old EA's...

Post by SteveHopwood »

I did a quick update to take in the 2 candle rules - it will show up as V1 if your download has succeeded.

Hannes, one of the benefit of running this forum has been that professional coders have dragged my code kicking and screaming into the late 2010's. The code you have posted here is old and not a beneficiary of any of the latest developments that make my code so robust these days.

Let me know if the EA is profitable and I will re-write it.

Cheers
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.
HannesJoubert
Trader
Posts: 282
Joined: Wed Oct 30, 2013 11:06 am
Location: South Africa

Re: Changing code of one of Steves old EA's...

Post by HannesJoubert »

Thanks so much for the quick reply Steve...

Yes, the code is old, I can imagine.

One question, if I may, did you also remove the part of the code that related to the opening of a new trade on every candle that is in the same direction?

The reason I ask, the EA opened two trades on EU this morning, whilst it only should have opened one according to the new parameters...

I am running the EA across 5 pairs at the moment, and a trade has been opened on each successfully (two on EU).

I am running the EA on a small live account to accumulate live forward testing results, to see if the EA and trading idea has any merit. I suppose that I should also be running it on a VPS seeing as it is an "always-in" type setup, will see how it goes, if the potential justifies the cost of setting up a VPS account.

I will keep you all up to date. Having said that, should this thread stay here on this forum, or should it be moved to the "testing" forum?

Okay, I hope to hear from you regarding the multiple / single trade question above, and will continue to post feedback and opinions on the performance of the EA.

Stay well

Hannes
HannesJoubert
Trader
Posts: 282
Joined: Wed Oct 30, 2013 11:06 am
Location: South Africa

Re: Changing code of one of Steves old EA's...

Post by HannesJoubert »

Yip, it seems that the EA is still opening "continuation" trades upon seeing a candle that is in the same direction of the open trade. Whilst this in itself in not a problem, it plays havoc with the MM, especially now that the EA is waiting for a second candle in the opposite direction before it closes and reverses the trade...

Is that fixable?

H
:?:
HannesJoubert
Trader
Posts: 282
Joined: Wed Oct 30, 2013 11:06 am
Location: South Africa

Re: Changing code of one of Steves old EA's...

Post by HannesJoubert »

Just a quick update on what is happening with this EA.

The EA has successfully closed open trades and opened trades in the opposite direction (whilst I am NOT happy at taking a loss :arrow: it does mean that that part of the EA code is working properly, and that I was on the wrong side of the trend, or that the market is now just ranging.)

A trend would be really nice right now :)

Cheers

H

Edit: EA is still opening multiple trades on the pairs, in the same direction as per previous post
Last edited by HannesJoubert on Thu Oct 31, 2013 10:26 am, edited 1 time in total.
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.

Re: Changing code of one of Steves old EA's...

Post by SteveHopwood »

All I did was add the second candle requirement. Everything else is as it was.

: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. 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.
HannesJoubert
Trader
Posts: 282
Joined: Wed Oct 30, 2013 11:06 am
Location: South Africa

Re: Changing code of one of Steves old EA's...

Post by HannesJoubert »

SteveHopwood wrote:All I did was add the second candle requirement. Everything else is as it was.

:D

OIC, is it perhaps, at all possible, to change the continuous opening thingy? If not, for testing purposes, it is fine and I will reduce the number of pairs used to free up margin...but, this method may skew results because of the change in MM

BTW, thanks for your effort in making the changes and replying.

Cheers

H
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.

Re: Changing code of one of Steves old EA's...

Post by SteveHopwood »

HannesJoubert wrote: OIC, is it perhaps, at all possible, to change the continuous opening thingy? If not, for testing purposes, it is fine and I will reduce the number of pairs used to free up margin...but, this method may skew results because of the change in MM

BTW, thanks for your effort in making the changes and replying.

Cheers

H
It will take me longer to type this post than it will to adapt my shell to this system. My shell contains all sorts of goodies that you might find helpful.

So you want:
  • close existing short and go long if two successive candles rise. Vice-versa for an existing buy.
  • only ever one trade open at a time, per pair.
Correct?

: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. 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 “EA's for Dummies.”