Hanover: an auto-trader using Recent Strength

garyfritz

Re: Hanover: an auto-trader using Recent Strength

Post by garyfritz »

FreddyFX wrote:OVERWHELMED BY ALL YOUR WORK!
OVERWHELMED is right! Steve you are a machine. I can't keep up with all the things you crank out. Doesn't help that you got a big head start on me. :D

I've skimmed through much of the Hanover EA thread at FF but I don't see an explanation of the Hanover EA logic anywhere -- did I miss something? From digging through the code it looks like it calculates the Recent Strength on a user-specified set of timeframes (M1 - MN) and initiates a trade on pair XXXYYY when (and only when) currency XXX is strongest and currency YYY is weakest on all timeframes. Correct?

Is the Hanover algorithm disclosed anywhere? I see only an ex4 and no explanation of how he generates his values. I have some ideas for how I'd create a Hanover-like indicator but I'd rather avoid reinventing the wheel. I'd like to implement some backtests of this on another platform and see how it behaves -- which might help the EA development process here. Dragos posted a simple way to calculate currency indices against the basket. You could use the short-term rate-of-change of those indices to create your own "recent strength" indicator but I don't know how that compares to the Hanover figures. Anybody know?
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Hanover: an auto-trader using Recent Strength

Post by gaheitman »

Panamamike wrote:
Panamamike wrote:I would like it to be there to be short the yen, but not long. The ability to restrict it trading long Yen when desired I.e. keep an eye on levels, turn long Yen off, then open it back up after next round of intervention. So to be more precise, is it possible to have a user selection to trade only 1 direction for the yen much like it has for the high interest pairs currently.
With all that is going on, and with what this request highlighted needed fixing in the Hanover code, nobody has addressed the request itself. I trade Hanover live on several accounts. This is the only issue that makes me nervous. I admit I have no idea how difficult or time consuming this would be to add, but it sure would be useful.
Attached is a one-off implementation of the trade direction restriction. Please test before implementing in live. As a one-off, it doesn't get any of the incremental upgrades Steve would likely do when he made changes to a bot.

To use the features, just set the following options:

Code: Select all

extern bool    UseTradeDirectionFilter=false;
extern string  TradeCurrencyShortOnly="USD,CHF"; // list of currencies to trade short only
extern string  TradeCurrencyLongOnly="AUD";  // list of currencies to trade long only
The examples are there to show you how to make a list of currencies.

Let me know if you run into any problems.

George
You do not have the required permissions to view the files attached to this post.
Panamamike
Trader
Posts: 104
Joined: Tue Nov 15, 2011 11:45 pm

Re: Hanover: an auto-trader using Recent Strength

Post by Panamamike »

Thanks. The last thing for Hanover will be to add the stack trading like with Joe, when the issues are worked out.
hankeys
Trader
Posts: 21
Joined: Fri Nov 18, 2011 12:55 pm

Re: Hanover: an auto-trader using Recent Strength

Post by hankeys »

I have one question about Hanover. For some time i see, that he didnt take any trade. If i loo to my graph, i see the weakest and stronges currency from Recent Strenght indicator but in hanover there are still another data (EURUSD). it seems that Hanover doesnt restore the new data in Strenght indicator. If i close the Empty4, it recalculates the data, and everything is OK. if i want to click to the smile :) in the Empty4 to open the settings of EA, nothing happens. Is there any solution? thx
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: Hanover: an auto-trader using Recent Strength

Post by SteveHopwood »

hankeys wrote:I have one question about Hanover. For some time i see, that he didnt take any trade. If i loo to my graph, i see the weakest and stronges currency from Recent Strenght indicator but in hanover there are still another data (EURUSD). it seems that Hanover doesnt restore the new data in Strenght indicator. If i close the Empty4, it recalculates the data, and everything is OK. if i want to click to the smile :) in the Empty4 to open the settings of EA, nothing happens. Is there any solution? thx
To be honest, I do not know. I managed to set H up on my trading machine so that it would generate signals that Carsten's utility would copy to any other platforms I want to use them. I do not want to have to do this again. My robots all ship with H as part of the code. I have no idea how the code works anymore, and fervently hope I shall never have to delve into it ever again. I simply trust enabling it and using WatchAndCopy to copy the relevant file into the platform will work. :lol:

If anybody can generate a pdf with all the info that anyone needs who is meeting H for the first time, then that individual will have the undying gratitude of a lot of people - including me.

Hehe. Welcome to my world guys. Everyone thinks coders know what we are doing. We do and we don't.
  • When we do, we smugly type the code effortlessly.
    When we do, but cannot remember how, we frantically search our old code files for the solution.
    When clueless, we Google like everyone else. :lol:
: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.
zkucera
Posts: 7
Joined: Tue Nov 15, 2011 11:04 pm

Re: Hanover: an auto-trader using Recent Strength

Post by zkucera »

I think the issue here is the following code in start()

//Find open trades.
//First check to see if a trade has closed and wait until it appears in the history tab.
//TicketNo stores the open trade ticket during each call to DoesTradeExist().
if (TicketNo > -1 && !OrderSelect(TicketNo, SELECT_BY_TICKET, MODE_TRADES) )
{
while (!OrderSelect(TicketNo, SELECT_BY_TICKET, MODE_HISTORY) ) Sleep(100);
}//if (TicketNo > -1 && !OrderSelect(TicketNo, SELECT_BY_TICKET, MODE_TRADES) )

Few lines above, the code says

if (OrdersTotal() == 0)
{
TicketNo = -1;
ForceTradeClosure = false;
}//if (OrdersTotal() == 0)

However, if there are manual orders or orders from other EAs, OrdersTotal() will NOT be 0 and TicketNo will be set to 0 (default value).

The code needs to change to

//Find open trades.
//First check to see if a trade has closed and wait until it appears in the history tab.
//TicketNo stores the open trade ticket during each call to DoesTradeExist().
if (TicketNo > 0 && !OrderSelect(TicketNo, SELECT_BY_TICKET, MODE_TRADES) )
{
while (!OrderSelect(TicketNo, SELECT_BY_TICKET, MODE_HISTORY) ) Sleep(100);
}//if (TicketNo > 0 && !OrderSelect(TicketNo, SELECT_BY_TICKET, MODE_TRADES) )
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: Hanover: an auto-trader using Recent Strength

Post by SteveHopwood »

zkucera wrote:I think the issue here is the following code in start()

//Find open trades.
//First check to see if a trade has closed and wait until it appears in the history tab.
//TicketNo stores the open trade ticket during each call to DoesTradeExist().
if (TicketNo > -1 && !OrderSelect(TicketNo, SELECT_BY_TICKET, MODE_TRADES) )
{
while (!OrderSelect(TicketNo, SELECT_BY_TICKET, MODE_HISTORY) ) Sleep(100);
}//if (TicketNo > -1 && !OrderSelect(TicketNo, SELECT_BY_TICKET, MODE_TRADES) )

Few lines above, the code says

if (OrdersTotal() == 0)
{
TicketNo = -1;
ForceTradeClosure = false;
}//if (OrdersTotal() == 0)

However, if there are manual orders or orders from other EAs, OrdersTotal() will NOT be 0 and TicketNo will be set to 0 (default value).

The code needs to change to

//Find open trades.
//First check to see if a trade has closed and wait until it appears in the history tab.
//TicketNo stores the open trade ticket during each call to DoesTradeExist().
if (TicketNo > 0 && !OrderSelect(TicketNo, SELECT_BY_TICKET, MODE_TRADES) )
{
while (!OrderSelect(TicketNo, SELECT_BY_TICKET, MODE_HISTORY) ) Sleep(100);
}//if (TicketNo > 0 && !OrderSelect(TicketNo, SELECT_BY_TICKET, MODE_TRADES) )
Sorry, but I do not understand. CountOpenTrades() first sets TicketNo to -1, which in turn is first declared as -1, so its initial value cannot be anything other than -1.

So, TicketNo is only ever >-1 if the bot discovers an open trade. This allows for backtesting, when the first trade is trade no 0 (and no, I have never understood why the first anything in a list should be thngy no 0; a ludicrous idea that merely stacks up probs for the rest of us non-mathematical but more logical people and yes, that is indeed an irritable dig at the lunatics that insist on thingy no 1 actually being thingy no 0; drives me nuts)

Hehe. I have managed to take a pot at quite a lot of people in just one post. :lol:

: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.
zkucera
Posts: 7
Joined: Tue Nov 15, 2011 11:04 pm

Re: Hanover: an auto-trader using Recent Strength

Post by zkucera »

Hi Steve,

In version attached to post 1, CountOpenTrades() is commented out and is not called from start(). Am I looking at the wrong version?

Kind Regards,
Zeljko
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Hanover: an auto-trader using Recent Strength

Post by gaheitman »

zkucera wrote:Hi Steve,

In version attached to post 1, CountOpenTrades() is commented out and is not called from start(). Am I looking at the wrong version?

Kind Regards,
Zeljko
CountOpenTrades() is the current standard. The Hanover code calls DoesTradeExist(), which also sets TicketNo to -1 if there is no active trade with the matching magic number and traded symbol. Same result, but the older code was for single-trade-at-a-time bots. :D

As for why we start things with zero... You don't learn that until after you learn the secret handshake. :lol:

George
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: Hanover: an auto-trader using Recent Strength

Post by SteveHopwood »

zkucera wrote:Hi Steve,

In version attached to post 1, CountOpenTrades() is commented out and is not called from start(). Am I looking at the wrong version?

Kind Regards,
Zeljko
Sorry about that. In my latest bots, CountOpenTrades takes care of all trade tracking.

In this one, it is DoesTradeExist() that does the equivalent job. When I started coding, DTE was fir single trade bots, whilst COT was for multiple traders. As things have evolved, DTE has lost its use and been abandoned. Sorry about that.

In this context, DoesTradeExist should fulfil the function I described in my last post.

Possibly.

: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 “Automated trading systems”