@1of3, John, thank you very much for the fix.
Yannis
Slopey Peaky Bob
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Slopey Peaky Bob
V 1n is in post 1. This has the fix presented by John a couple of days ago.
I have added a new input to the swap filter section - MaximumAcceptableNegativeSwap. From the updated user guide:
Last week saw three baskets closing on each of my live trading accounts. The third closed after FridayCloseAllHour and cost c. 20 over the three accounts.
Altogether, the 6 baskets that closed at TP added $303 everall, which makes the running total $1,131 since taking SPB live. Gareth's account topped $600 last week and is recovering well from its pre-SPB low of c. $230.

I have added a new input to the swap filter section - MaximumAcceptableNegativeSwap. From the updated user guide:
- Swap filter: some pairs have dreadful swap in one direction. This filter allows you to avoid trading pairs in the direction that would cost a fortune in swap. How much relevance this has to a system that could follow a trend for hundreds of pips is open to debate, but once you have seen one of these adverse-swap pairs hang around going nowhere for a couple of weeks, you will see why a lot of us want nothing to do with them.
- MaximumAcceptableNegativeSwap: this input allows you to trade the negative swap pairs but to a maximum swap cost. You need to visit your broker's swap page to view the cost per fair; find Global Prime's at https://www.globalprime.com.au/forex-trading/swaps/. Note that the default of -1,000,000 turns this filter off.
- Copy the declaration at line 346 into your version.
- Go to 5042 and copy the code block.
- Go to 4866 and copy John's fix.
Last week saw three baskets closing on each of my live trading accounts. The third closed after FridayCloseAllHour and cost c. 20 over the three accounts.
Altogether, the 6 baskets that closed at TP added $303 everall, which makes the running total $1,131 since taking SPB live. Gareth's account topped $600 last week and is recovering well from its pre-SPB low of c. $230.
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.
Slopey Peaky Bob
I have added a couple of set files to post 1. Details in post 1.

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.
Slopey Peaky Bob
For coders and US SHF members, it turns out that we are just lucky when my FIFO code works correctly. Here is the explanation that Kopan just sent me:

US members, definitely give Kopan's version a try.The FIFO nonsense was almost solved, but not quite. Unfortunately those tiny details matter when it comes to successful trading. The issue comes when trying to close multiple trades of the same currency pair. It does not happen often, but it is possible for orders to have the exact same Open Time stamp. In can happen when the EA places multiple orders all at the same time or more specifically in a fast moving market when the price jumps more than the Minimum Gap.
Having the same Open Time Stamp then can cause an FIFO ERROR 130 when the EA attempts to close the trade out or order. With the exact same time stamp you have a 50/50 chance of the Broker's server picking the First IN trade and it will refuse to close the trade if it guesses wrong. You are left with two open trades that should be closed, and a repetitive error message that will eventually get your account frozen.
By avoiding STOP orders altogether and introducing an even more stringent Order Close function() appears to get around the issue. I no longer get any FIFO errors with this method (Note: FIFO can also be accomplished by only allowing 1 trade per currency pair but this defeats the power of Grid Trading)
I have played with Gary's Varied Lot solution as well, but it can quickly add up to more lots at risk than I was comfortable with. Hence I needed an alternative solution. I have been trading with this format in a much more customized version for several months, the results have been promising and I can use a lot size of .01 on all trade entries.
It was time to share the FIFO related code changes with your user group and get validation that the approach was sound and repeatable.
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.
Slopey Peaky Bob
V 1o is in post 1 with John's basket trailing stop. Huge contribution, John.
There are three inputs in the basket trading inputs section. From the updated user guide:

There are three inputs in the basket trading inputs section. From the updated user guide:
- Basket Trailing Stop: this feature was added by SHF member 1of3. Once the cash value of our basket reaches a point of our choosing, a cash trailing stop kicks in. The idea is to catch more of the moves that are in our favour than is possible with our standard basket take profit. We can use this to lock in profit whilst hoping to reach a much larger basket TP:
- UseBasketTrailingStop: turns this feature on/off. Note that it is disabled by default.
- BasketTrailingStopStartValue: the basket profit at which the TS kicks in. The default is based on a 0.01 lot size on a Global Prime account.
- BasketTrailingStopGapValue: the distance between the stop loss and the basket profit. The default is based on a 0.01 lot size on a Global Prime account.
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.
- Wavegarrick
- Trader
- Posts: 1172
- Joined: Sun Dec 30, 2012 11:21 am
- Location: South Africa
Slopey Peaky Bob
A huge contribution indeed. Many thanks John and Steve.Huge contribution, John.
Cheers
Leon
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Slopey Peaky Bob
A question for The Thinkers here. Bear in mind that everything I produce here applies to Koban's US version and I shall pass it to him for easy addition. There is nothing different in the trading methodology, only in the trade closure.
So, we have a basket close and cheer mightily. Mine just did and I am indeed cheering mightily. Another $120 in the equity across two of my accounts.
The bot instantly sends a new grid of stop orders because the trading conditions are still in place. Here is the question. Should we introduce a delay before this happens?

So, we have a basket close and cheer mightily. Mine just did and I am indeed cheering mightily. Another $120 in the equity across two of my accounts.
The bot instantly sends a new grid of stop orders because the trading conditions are still in place. Here is the question. Should we introduce a delay before this happens?
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.
- tomele
- Administrator
- Posts: 1208
- Joined: Tue May 17, 2016 3:40 pm
- Location: Germany, Forest of Odes, Defending the Limes
Slopey Peaky Bob
Why should it wait?
How could it distinguish situations when it should wait and when it should not? The conditions are in place, aren't they?
Just asking....
How could it distinguish situations when it should wait and when it should not? The conditions are in place, aren't they?
Just asking....
Happy pippin, Thomas 
It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so. (Mark Twain)
Keep the coder going: Donate
It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so. (Mark Twain)
Keep the coder going: Donate
-
Zennor
- Trader
- Posts: 276
- Joined: Fri Feb 08, 2013 4:44 pm
- Location: On a Canal Boat travelling the waterways.
Slopey Peaky Bob
Steve, I have been considering this one and my thoughts are when a basket is closed are the conditions still in place as per the original signals? Or are we placing trades at the end of the run on the original signal?SteveHopwood » Tue Jun 19, 2018 12:57 am wrote:A question for The Thinkers here. Bear in mind that everything I produce here applies to Koban's US version and I shall pass it to him for easy addition. There is nothing different in the trading methodology, only in the trade closure.
So, we have a basket close and cheer mightily. Mine just did and I am indeed cheering mightily. Another $120 in the equity across two of my accounts.![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
The bot instantly sends a new grid of stop orders because the trading conditions are still in place. Here is the question. Should we introduce a delay before this happens?
![]()
Personally, when a basket closes I would prefer all new trades to be on new signals and not stale signals.
Tomele I hear what you are saying that if we still have two greens or two reds why not trade it? But how much juice can you squeeze out of an orange? If a particular signal has already reaped 3/4/5 good grids and the signal remains what is the highest probability that it will continue? Or reverse? Of course nobody knows for sure but personally, I think that after a basket closes it might be prudent to trade only new signals.
Just thinking out loud here but perhaps you could quantify what would warrant a new signal or not. Say if a pair only triggered one or two grids before basket closure then perhaps that pair could be made exempt from requiring a new signal?
- renexxxx
- Trader
- Posts: 860
- Joined: Sat Dec 31, 2011 3:48 am
Slopey Peaky Bob
This question comes down to conditional probabilities and independent events:
Independent Events: Two events A and B are said to be independent if the fact that one event has occurred does not affect the probability that the other event will occur.
Conditional Probability: the probability of an event (A), given that another (B) has already occurred.
Probability theory tells us: In the case where events A and B are independent (where event A has no effect on the probability of event B), the conditional probability of event B given event A is simply the probability of event B, that is P(B). Eg. Take a coin toss. What is the probability that I will get "heads" given that I got 10 "heads" in a row before. Answer: 50%. It doesn't matter what has happened before -- each coin toss is independent.
To refer back to the original question: What is the conditional probability that an entry signal produces a winning set of trades, given that that same entry signal has already produced one or more winning set of trades?
I don't believe that the Forex market is keeping track of how much money you or your trading system has already made with a given signal. If it did, you would need to put logic in your EA that --when it spots an entry signal-- it first looks back to see if that same entry signal would have already generated a winning set of trades and if so abort the trading operation for this entry signal.
So, I believe that the events A (an entry signal will produce a winning set of trades) and B (the entry signal has already produced a winning set of trades) are independent.
My 2 cents.
Independent Events: Two events A and B are said to be independent if the fact that one event has occurred does not affect the probability that the other event will occur.
Conditional Probability: the probability of an event (A), given that another (B) has already occurred.
Probability theory tells us: In the case where events A and B are independent (where event A has no effect on the probability of event B), the conditional probability of event B given event A is simply the probability of event B, that is P(B). Eg. Take a coin toss. What is the probability that I will get "heads" given that I got 10 "heads" in a row before. Answer: 50%. It doesn't matter what has happened before -- each coin toss is independent.
To refer back to the original question: What is the conditional probability that an entry signal produces a winning set of trades, given that that same entry signal has already produced one or more winning set of trades?
I don't believe that the Forex market is keeping track of how much money you or your trading system has already made with a given signal. If it did, you would need to put logic in your EA that --when it spots an entry signal-- it first looks back to see if that same entry signal would have already generated a winning set of trades and if so abort the trading operation for this entry signal.
So, I believe that the events A (an entry signal will produce a winning set of trades) and B (the entry signal has already produced a winning set of trades) are independent.
My 2 cents.