Secret Bob's Basket
-
erikskenne
- Trader
- Posts: 62
- Joined: Fri Mar 30, 2012 6:27 pm
Secret Bob's Basket
Pls disregard my last post
-
everell
- Trader
- Posts: 16
- Joined: Sat Oct 11, 2014 11:07 am
- Location: Italy
Secret Bob's Basket
Yes , of course
Others positions opened and closed in a perfect way, only this one is not correct
Others positions opened and closed in a perfect way, only this one is not correct
- Elixe
- Trader
- Posts: 98
- Joined: Tue Jun 04, 2013 6:44 pm
- Location: France
Secret Bob's Basket
The arrow is probably out of visible zoneeverell » Today, 18:31 wrote:I can not understand why opened a new position: I do not see any arrow on the chart
You do not have the required permissions to view the files attached to this post.
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Secret Bob's Basket
I have just added this to the Serious Warning in post 1:

- Members whose posts show that they are too lazy and stupid to read this and post 2 properly will lose the ability to post at all. There will be no warnings.
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.
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.
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Secret Bob's Basket
Here is an oddity that I am unable to explain.
SBB is sending trades every 5 minutes on my H1 demo, but not on the H4 or M15.
Coders, CountOpenTrades() uses int index to calculate the position of the order symbol in the PairsToTrade list. It sets PairTicketNo[index] as the most recently sent trade at line 1192.
Then line 2139 should cancel the potential trade when bool IsTradingAllowed(string symbol, int cc) is called from LookForTradingOpportunities(). Can you see a flaw in the logic?
I cannot blame crapperquotes jerrybuild for this. All my demos are running 670 or earlier.

SBB is sending trades every 5 minutes on my H1 demo, but not on the H4 or M15.
Coders, CountOpenTrades() uses int index to calculate the position of the order symbol in the PairsToTrade list. It sets PairTicketNo[index] as the most recently sent trade at line 1192.
Then line 2139 should cancel the potential trade when bool IsTradingAllowed(string symbol, int cc) is called from LookForTradingOpportunities(). Can you see a flaw in the logic?
I cannot blame crapperquotes jerrybuild for this. All my demos are running 670 or earlier.
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.
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.
- renexxxx
- Trader
- Posts: 860
- Joined: Sat Dec 31, 2011 3:48 am
Secret Bob's Basket
Steve, I am not sure if this explains the problem, but ...
You need to be very careful not to place an OrderSelect() inside a loop of another OrderSelect().
For instance ... in lines 1166-1232 there is a loop (iteration) over OrdersTotal() trades and in line 1169 there is an OrderSelect(). Within that loop, there is a call to InsertTakeProfit(cc, OrderTicket(), OrderType()); and LookForTradeClosure(OrderTicket(), index); but these functions are doing a OrderSelect() in their own right.
This totally messes up the Order-cursor, as Empty4 is not able to return to the cursor-position of the outer-loop.
Anyway, that's my take on it ...
You need to be very careful not to place an OrderSelect() inside a loop of another OrderSelect().
For instance ... in lines 1166-1232 there is a loop (iteration) over OrdersTotal() trades and in line 1169 there is an OrderSelect(). Within that loop, there is a call to InsertTakeProfit(cc, OrderTicket(), OrderType()); and LookForTradeClosure(OrderTicket(), index); but these functions are doing a OrderSelect() in their own right.
This totally messes up the Order-cursor, as Empty4 is not able to return to the cursor-position of the outer-loop.
Anyway, that's my take on it ...
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Secret Bob's Basket
All of which is true. The OrderSelect calls in the various functions are there merely to ensure the order is actually still open when the called function does its thingy, so that is not what causes the bot to send a new trade every five minutes.renexxxx » Mon Oct 27, 2014 7:56 pm wrote:Steve, I am not sure if this explains the problem, but ...
You need to be very careful not to place an OrderSelect() inside a loop of another OrderSelect().
For instance ... in lines 1166-1232 there is a loop (iteration) over OrdersTotal() trades and in line 1169 there is an OrderSelect(). Within that loop, there is a call to InsertTakeProfit(cc, OrderTicket(), OrderType()); and LookForTradeClosure(OrderTicket(), index); but these functions are doing a OrderSelect() in their own right.
This totally messes up the Order-cursor, as Empty4 is not able to return to the cursor-position of the outer-loop.
Anyway, that's my take on it ...
The 5 minute wait is created by PostTradeAttemptWaitSeconds, so the bot is obediently doing its thingy there. The question is, why is it then sending a fresh trade once this period is passed? It is ignoring the coding in IsTradingAllowed, which is nothing to do with CountOpenTrades.
If it was that easy to spot the bloop, I would already have done so. It aint, so I haven't.
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.
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.
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Secret Bob's Basket
It turns out not to be merely an H1 problem, unsurprisingly.
There is something wrong with the code that prevents multiple entries on the same candle. I do not know what this is. Do not trade this bot on a live account until I have fixed this. The fix will not come anytime soon. It is nearly 10.00 pm at night and I have been coding all day. What passes for my brain is frazzled.

There is something wrong with the code that prevents multiple entries on the same candle. I do not know what this is. Do not trade this bot on a live account until I have fixed this. The fix will not come anytime soon. It is nearly 10.00 pm at night and I have been coding all day. What passes for my brain is frazzled.
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.
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.
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Secret Bob's Basket
In a breathtaking bit of bloop-spotting, Elixe appears to have spotted the cause of the multiple trades sent on the same candle. What can I say, Elixe?
Guys, unless you are a coder you have no idea how hard it is to read another person's code. What Elixe just did is phenomenal.
So, the fix is in post 1 for the peasants. Non-peasants, go to line 851 and append:
ArrayResize(PairMostRecentTime, NoOfPairs);
I forgot to resize the array, so (to quote Elixe) "the array is always returning 0, OrderOpenTime is always > 0 and as you are going backward through the tickets, the older ticket found is always the one in PairTicketNo."
Yep. It really is that bog-standard basic. Isn't it always when I get something so sadly wrong?
Hey ho. I will learn to code this stuff properly one day. Until then, thanks to Elixe and the rest of you for hauling my coals out of the fire and saving the rest of us from a load of grief.
Again.

Guys, unless you are a coder you have no idea how hard it is to read another person's code. What Elixe just did is phenomenal.
So, the fix is in post 1 for the peasants. Non-peasants, go to line 851 and append:
ArrayResize(PairMostRecentTime, NoOfPairs);
I forgot to resize the array, so (to quote Elixe) "the array is always returning 0, OrderOpenTime is always > 0 and as you are going backward through the tickets, the older ticket found is always the one in PairTicketNo."
Yep. It really is that bog-standard basic. Isn't it always when I get something so sadly wrong?
Hey ho. I will learn to code this stuff properly one day. Until then, thanks to Elixe and the rest of you for hauling my coals out of the fire and saving the rest of us from a load of grief.
Again.
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.
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.
-
thomasmore
- Trader
- Posts: 275
- Joined: Tue Nov 15, 2011 10:35 pm
- Location: Knokke, Belgium
