stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Hanover: an auto-trader using Recent Strength
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=31
Page 4 of 4
Author:  SteveHopwood [ Fri Dec 16, 2011 12:40 am ]
Post subject:  Re: Hanover: an auto-trader using Recent Strength

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
Author:  zkucera [ Fri Dec 16, 2011 7:38 am ]
Post subject:  Re: Hanover: an auto-trader using Recent Strength

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) )
Author:  gaheitman [ Fri Dec 16, 2011 9:15 am ]
Post subject:  Re: Hanover: an auto-trader using Recent Strength

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
Author:  zkucera [ Fri Dec 16, 2011 9:21 am ]
Post subject:  Re: Hanover: an auto-trader using Recent Strength

Hi George,

Thanks for looking into it.

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

Regards,
Zeljko
Author:  SteveHopwood [ Fri Dec 16, 2011 11:36 am ]
Post subject:  Re: Hanover: an auto-trader using Recent Strength

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
Author:  pipcruiser [ Mon Jan 16, 2012 4:18 pm ]
Post subject:  Re: Hanover: an auto-trader using Recent Strength

Hi there,

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

Thx guys,

PC
Author:  SteveHopwood [ Tue Jan 17, 2012 10:29 pm ]
Post subject:  Re: Hanover: an auto-trader using Recent Strength

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
Author:  theforexedge [ Mon Apr 30, 2012 12:17 pm ]
Post subject:  Re: Hanover: an auto-trader using Recent Strength

Has anyone experimented with Strong & Weak Threshold settings?

Jason
Author:  MrLong [ Mon Apr 30, 2012 5:08 pm ]
Post subject:  Re: Hanover: an auto-trader using Recent Strength

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
All times are UTC Page 4 of 4