Hanover: an auto-trader using Recent Strength

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 »

gaheitman wrote:
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
I will break the hand of the dimwit who first thought of this. Followed by his legs. Followed by every other bone in his body.

Notice my natural assumption that the cretin who first came up with this idea was a 'him'?

: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/George,

Sorry for being so insistent, but I still think there is an issue.

The code says

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) )

TradeExists = DoesTradeExist(TradePair);
if (TradeExists)
{
//if (OrderProfit() > 0) TradeManagementModule();
LookForTradeClosure();
}//if (TradeExists)

On my PC, the code didn't get as far as calling DoesTradeExist() because it was going into the while ... sleep loop. I have tested this adding Alert(TicketNo) line at the top of start() code and it only popped up once with value 0.

Could it be that instead of TicketNo > 0 the code needs to be rearranged to call DoesTradeExist() first?

TradeExists = DoesTradeExist(TradePair);
if (TradeExists)
{
//if (OrderProfit() > 0) TradeManagementModule();
LookForTradeClosure();
}//if (TradeExists)

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) )
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/George,

Sorry for being so insistent, but I still think there is an issue.

The code says

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) )

TradeExists = DoesTradeExist(TradePair);
if (TradeExists)
{
//if (OrderProfit() > 0) TradeManagementModule();
LookForTradeClosure();
}//if (TradeExists)

On my PC, the code didn't get as far as calling DoesTradeExist() because it was going into the while ... sleep loop. I have tested this adding Alert(TicketNo) line at the top of start() code and it only popped up once with value 0.

Could it be that instead of TicketNo > 0 the code needs to be rearranged to call DoesTradeExist() first?

TradeExists = DoesTradeExist(TradePair);
if (TradeExists)
{
//if (OrderProfit() > 0) TradeManagementModule();
LookForTradeClosure();
}//if (TradeExists)

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) )
You are correct, if you have an order open already when you start the bot, you will be stuck in that loop. Add the following to the Init() procedure:

Code: Select all

   TicketNo = -1;
Doesn't really matter where. Thanks for catching this.

BTW, in the future, use the

Code: Select all

 button at the top of the reply window when you put in code.  It makes it so much easier to read!

George
zkucera
Posts: 7
Joined: Tue Nov 15, 2011 11:04 pm

Re: Hanover: an auto-trader using Recent Strength

Post by zkucera »

Hi George,

Thanks for looking into it.

As for the "Code" button: I didn't realise there was such functionality, great feature!

Regards,
Zeljko
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/George,

Sorry for being so insistent, but I still think there is an issue.
I never mind people being insistent when they can see an error that I am missing. Cheers.

Latest update in post 1, with George's fix added.

Coders, this needs to go into the shell code, just to make sure the problem does not arise.

: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.
pipcruiser
Trader
Posts: 134
Joined: Wed Nov 16, 2011 8:24 am

Re: Hanover: an auto-trader using Recent Strength

Post by pipcruiser »

Hi there,

Has Hanover been left in the dark or are anybody still trading him (live)?

Thx guys,

PC
"Perfection is Achieved Not When There Is Nothing More to Add, But When There Is Nothing Left to Take Away"...
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 »

pipcruiser wrote:Hi there,

Has Hanover been left in the dark or are anybody still trading him (live)?

Thx guys,

PC
I am not using either the EA or the indi at the mo - takes up too much processor power. Plus, nothing I am working on at the moment requires it.

: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.
theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

Re: Hanover: an auto-trader using Recent Strength

Post by theforexedge »

Has anyone experimented with Strong & Weak Threshold settings?

Jason
MrLong

Re: Hanover: an auto-trader using Recent Strength

Post by MrLong »

Yes I used 45 and 55, you need to add this line to the Hanover Filter :
if (!strength1 || !strength2 > 0) return(false);

Otherwise, when Recent Strength, drops data to zero, you get a bum signal.

extern string TimeFrames="M1,M5,M15";
extern string SlopeConfirmationCandles="2,2,2";
extern int StrongThreshold=55;
extern int WeakThreshold=45;

Best Regards
Andy
Post Reply

Return to “Automated trading systems”