Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

Slopey Peaky Bob User Guide

Introduction
Slopey Peaky Bob uses Baluda's (Paul) Super Slope indicator available from here. Paul
provided the code to bring the calculations into an EA, so you only need it for studying
individual charts.

Super Slope uses moving averages to assess the relative strength of the two currencies
and assigns them a value of >0 and <0:
• We should be looking for buy trades when the first currency in the pair is >0 and the
second is <0.
• We should be looking for sell trades when the first currency in the pair is <0 and the
second is >0.

Slopey Peaky Bob uses three colours to describe the state of Super Slope at the close of
the previous candle. "White" represents whatever colour you have your Super Slope
version showing weak crosses. I think Thomas must have his set to white as he made a
contribution here – code readers can see my acknowledgement of his contribution in the
HTF Super Slope section.

My Super Slope version has sort-of-blue for buy, sort-of-red for sell, and a pale yellow for
exit trades. For Slopey Peaky Bob:
• Blue means buy.
• Red means sell.
• White means do nothing. It means trade exit when using Super Slope elsewhere,
but not here.

You may well have your Super Slope indi set to different colours; that does not matter as
Slopey Peaky Bob does not call the indi. All you need to do is make a mental translation to
whatever colours you have yours set to.

Traders discovered early on that using a HtfSsDifferenceThreshold of 1 rather than 0


made a big difference to profitability, so these inputs (SuperSlope sections) default to 1.
Remember to set the Super Slope indicator's differenceThreshold input to 1 or it will be
displaying values that are not those the EA is working with.

Peaky
'Peaky' is the HiLo Peak Indicator attached to the thread. If you are new to it: Peaky is an
indicator that highlights the highest and lowest close prices over a long period of time. It is
to help us with that age-old trading principle of 'buy low and sell high. I have attached a
document to post 1 that describes how to use it so to summarise briefly:
• If the highest high is later than the lowest low, we should be selling.
• If the lowest low is later than the highest high, we should be buying.
• There are EA's already devoted to this principle:
◦ Peaky available here. This is the single pair trader.
◦ Peaky on Steroids available here. This is a multi-pair, multi-time frame trader.

To use the HiLo indi:


• Zoom the chart out so you can see as many candles as possible.
• Turn the chart to line chart.
• Load the indi. Remember to set the time frames you want it to display.
• Shut any windows showing on the right of your chart, such as Navigator.

That will show you the peak hilo information that Slopey Peaky Bob is working with.

Trading
Slopey Peaky Bob trades in only one direction; that is the direction indicated by Super
Slope at the close of the previous candle i.e. buy when blue, sell when red, stay out when
white.
• He will only trade long if Peak's direction is up.
• He will only trade short if Peaky is heading down.
• The chart column header “PK” stands for “Peaky”.
• Up green arrows mean the direction is long.
• Down red arrows mean the direction is short.
• The arrows will be coloured white if the direction is not tradable even though it is
agreeing with Super Slope. I do not want Slopey Peaky Bob trading if the market is
in the wrong half of the chart:
◦ He will not buy if the market is in the upper half of the chart as it is getting close
to a new peak high.
◦ He will not sell if the market is in the lower half of the chart as it is getting close
to a new peak low.
• Slopey Peaky Bob will close trades if Peaky changes direction.

Slopey Peaky Bob is a grid trader. Imagine that: Super Slope was blue at the close of the
previous candle; Peaky is indicating long trades: the market is in the lower half of the
chart. Slopey Peaky Bob will:
• Either send an immediate market trade or a buy stop order x pips above the market.
The inputs allow you to tailor this to your own tastes.
• Send a grid of x buy stops at intervals of your choice of pips.
• Imagine your interval between trades is 20 pips. If the market falls 40 pips below
your lowest buy trade, Slopey Peaky Bob will send a fresh buy stop 20 pips below
that lowest trade. It makes no difference whether the lowest trade is a stop or a
market order.
• Trade closure. Slopey Peaky Bob will:
◦ Close all market buy trades and delete all pending orders if the trend time frame
Super Slope closes red and the market reaches a new peak high on the trading
time frame, generating a sell signal.
◦ Close all buy trades when Peaky forms a new peak high and a retrace short is
overdue.
◦ Close all market sell trades and delete all pending orders if the trend time frame
Super Slope closes blue and the market reaches a new peak low on the trading
time frame, generating a buy signal.
◦ Close all sells when Peaky forms a new peak low and a retrace long is overdue
• Manage the trades as individual pair baskets and as a whole position basket,
should you with this.
Whole position basket trading
Members rapidly learned that SPB is massively profitable when trading the entire position
as a complete entity i.e. as a “basket” of trades and you will see that discussion quickly
moved to increasing the profitability.

The advantage of basket trading is that the individual trades do not matter; it is the overall
profitability that is important. Resident genius' Thomas and Rene are collaborating in a
fantastic enterprise where users automatically send their results to a central database
where the best-performing EA's and their settings are highlighted. Learn how to join in the
fun at Tests Database Announcements

Experimentation has shown that the higher the basket take profit is set, the more profitable
trading is. My best demo has basket TP of 10,000 pips; this has taken a starting deposit of
$10,000 to $14,0s9 at the time of writing this - 2 nd Feb 2019.

I am trading Slopey Peaky Bob on my live account shooting for 10,000 pips.

Two versions of Slopey Peaky Bob


There are two versions of Slopey Peaky Bob:
• Slopey Peaky Bob 10000 pips:
◦ The simplified version. This has minimal inputs and can by used by people new
to all this. It trades:
▪ In the direction indicated by D1 Super Slope.
▪ In the direction indicated by Peaky.
▪ Aims for a whole-position basket closure at +10,000 pips.
◦ The only inputs are for your lot size, magic number and basket take profit target,
and a few display choices.
◦ It is a renamed version of FXT-SPB-1 that Thomas posted in the "SPB detail
testing" thread.
◦ Read the “Thomas' dashboard element” section and then you can stop reading.
• Slopey Peaky Bob Latest version:
◦ The bells and whistles version. This has a mountain of stuff to allow you to
control Slopey Peaky Bob's behaviour. All the inputs and their functions are
described further down this document.

Avoiding over-trading
It is easy to over-trade when grid trading. You can avoid this in two ways:
1. Do not allow a high number of trades in the grid.
2. Set one of the minimum margin inputs – described further down. Remember:
• Once the first pending fills or you take an immediate market order, then Slopey
will do nothing about the remaining pendings in the grid. He will continue to add
to the grid as described earlier even though these trades are filling when your
margin level has dropped below your minimum level.
• Slopey will delete pending trades on all pairs without a market order if the
margin percent level on your account drops below your minimum.
Account size and lot sizing
I am writing this section of the User Guide on 2nd Feb 2019. Slopey Peaky Bob is just
coming up to 1 year old – birthday in a couple of days. Slopey Peaky Bob is the best-
tested EA I have ever used and have been able to come to some firm conclusions:
• 0.01 lots per $10,000 USD is as near to perfect safety as we can get in the volatile
world of Forex trading.
• I was trading 0.01 lots per $4,000 last summer when we were hit by the first
sustained run of markets turning against our trades. This was before the power of
huge-pips basket TP's became clear. I took Slopey Peaky Bob off the account and
managed the trades manually. He is back on the account now, trading the 10,000
pips version.
• I minimum starter account of $500 flourished for a while and had more than tripled
the account by the time the sustained run against us; it wiped out the account.
There has only been the one sustained run against us so you might be lucky and
grow the account to a point of safety when the next on arrives. It is best if you
mentally kiss goodbye to your deposit, and then be really happy if it survives and
thrives.

Thomas' dashboard element


This is breathtaking coding by Thomas – SHF user name tomele. You are presented by
the dashboard on loading the EA; manual traders can turn off auto-trading and use the
dashboard to spot trade setups easily.

The full dashboard occupies a lot of screen space but it is possible to adjust this. Anything
coloured cyan does something, so have a click around and see what happens. The
column headers will shrink/expand the details and the fontSize input towards the bottom of
the inputs window allow you to adjust the size of the print.

The dashboard:
• Displays the trading direction indicated by the higher time frame Super Slope.
• Optionally opens charts and adds your chosen template to each new chart when
there is a trade setup.
• Delete the chart if there are no open trades and there is no longer a trade setup.
• Optionally minimise the charts to save cpu resources as minimised charts use far
less than maximised ones. This is invaluable if you are using a VPS.
• Open charts if you click on the symbol in the left-most column and apply your
chosen template to it. Once a chart is open, the EA will:
▪ Add arrows showing the candle where trades were taken.
▪ Draw a dashed line showing the price movement from where the trades
opened until now.
• The inputs are:
◦ AutomateChartOpeningAndClosing: tells the ea to open and close charts
automatically. Turn this to 'false' if you want complete control of your charts.
◦ MinimiseChartsAfterOpening: this tells the EA whether or not to minimise all
the charts.
◦ ReservedPair: this is the chart that will host this dashboard EA. It will leave this
chart alone. It should be a pair that you would not usually trade; mine is
XAUUSD.
◦ TemplateName: the name of the template to apply to each chart.
◦ Trade arrows: play with these inputs to show the size, colour and location of the
trade arrows as you find best. The minimum size is 0; the maximum is 5. Slopey
Peaky Bob places up arrows below the candle where a buy trade was taken,
and down arrows above those where there was a sell trade.
◦ PairsToTrade: these are the pairs that Slopey Peaky Bob will scan for trading
opportunities, opening the relevant charts for you if you are trading manually, or
trading for you if you are using the bot to do the work for you.
◦ ChartTimeFrame: this is the time frame for the charts that Slopey Peaky Bob
opens for you. This has no impact on the two Super Slope time frames.
◦ EventTimerIntervalSeconds: this EA does not work with quotes from the
broker. It works on a timer and this input controls how often the timer fires. This
is in seconds, so the default is once a second
▪ Important note: the timer will continue to fire even if the markets themselves
are closed. There are platform events that can stop an EA working without
deleting it from the chart, so you can think it is still working. Check the clocks
at the top of the chart periodically; the EA has stopped if they have stopped.
◦ ChartCloseTimerMultiple: this is multiplied by EventTimerIntervalSeconds and
times two events:
▪ Open charts take up cpu resources, so they are closed when there are no
open trades or the pair is no longer tradable.
▪ Slopey Peaky Bob refreshes the chart periodically and reprints missing trade
arrows.
▪ The default EventTimerIntervalSeconds and ChartCloseTimerMultiple inputs
will cause these two events to occur every 15 seconds.
◦ WriteFileForTestDatabase: this tells the EA to participate in building the SHF
trading database. This database tells us which EA's are successful, along with
the settings being used. Thomas explains in detail here.

To use the EA purely as a dashboard for manual trading.:


• Set up a chart as you wish it to look, and save the template.
• Load your 'reserved chart';
• Drag the dashboard EA onto the chart, inserting your template name into the
TemplateName input and turning AutoTradingEnabled to 'false'.

The code that has gone into the dashboard is amazing and all done by Thomas. I could
not have done it. Thank you Thomas. This is yet another fantastic contribution from you.
We are all deeply grateful.

Using SPB as a TDesk 'drone'


You can harness the power of TDesk and Desky by using SPB purely as a signals
generator. SPB will send its data to TDesk and Desky will then do all the trading and
management. You need to set these inputs in order to achieve this:
• SendToTDesk = 'true'. Find the input at the end of the, “Other stuff” inputs.
• AutoTradingEnabled = 'false'. This is the first input in the, “Using the dashboard as
an auto-trader” inputs. This turns off all of SPB's trading and trade management
features.
• ShowDashboard = 'false' and SendTDeskSignals = 'true'. You have to scroll down
to the, “Dashboard display” inputs to find these inputs. They are the final group of
inputs, so it is a long way down. Telling SPB not to show its own dashboard cuts
down on a lot of CPU use.
You run TDesk on one chart and SPB on a second. Desky runs on a third if you want it to
do all the trading and management.

Auto-trading Inputs
Enter all pip inputs as pips. Forget the x digit crap so beloved by the crims; my EA's all
convert your pips into the points required by your crim. We are indebted to Lifesys for the
code initially, then to milanese (Tommaso) for enhancing it.

• General Inputs
◦ AutoTradingEnabled: turns trading on/off. Set this to 'false' if you are only
using the dashboard.
◦ MustObeyFIFO: this is for our friends in the US. The 'normal' full trade closure
function closes market trades before deleting pending orders, which is no use to
those who have to obey FIFO. Set this to 'true' and Slopey Peaky Bob will
close/delete trades/orders in their FIFO order.
◦ Lot: your chosen lot size. Make sure your lot size is acceptable to your criminal.
◦ RiskPercent: this tells an EA to calculate the lot size as a risk percentage of
your account balance. It uses the pips count in StopLossPips, so no stop loss
means you cannot use this feature.
◦ LotsPerDollopOfCash: you can have your lot size automatically calculated this
lot size per amount of cash in the account balance or equity. The default settings
would deliver 0.01 lots per $1,000. A zero input turns this feature off.
◦ SizeOfDollop: the cash increments used.
◦ UseBalance: use the account balance for the calculation.
◦ UseEquity: use the account equity for the calculation.
▪ Example of use, choosing the equity:
• equity = $2133.56
• LotPerDollopOfCash = 0.01.
• SizeOfDollop = $1,000.
▪ Calculated lot size is 0.02.
◦ StopTrading: allow you to stop Slopey Peaky Bob trading altogether if all you
want this EA to do is manage an open trade.
◦ TakeProfitPips: your take profit.
◦ StopLossPips: your stop loss.
◦ HideStopLossAndTakeProfit: I added this feature after this discussion at SHF.
It will prevent stops being taken out unprofitably when the spread has widened
to an unacceptable level. Enabling this feature tells SPB not to send 'hard' stop
loss and take profit prices with a trade. Instead he monitors the market, calculate
notional SLTP's and closes the trade if either of these are breeched i.e.
▪ Buys close when the Bid price rises to the notional take profit or falls to the
notional stop loss.
▪ Sells close when the Ask price falls to the notional take profit or rises to the
notional stop loss.
◦ Magic number and trade comment: leave these alone unless you know what
you are doing. Just bear in mind that the default magic of 0 is the same as that
of manually entered trades, so scp will take over management of these as well.
You need a different magic number if you do not want that
◦ IsGlobalPrimeOrECNCriminal: set this to true if your criminal insists on two-
stage order-sending; this means sending the order first then adding any take
profit and stop loss figures in a second round of communication with the crim's
server. This is irrelevant if you do not use StopLoss and TakeProfit. The EA has
code to detect Global Prime accounts automatically.
◦ MaxSlippagePips: 'slippage' is the price changing in between you sending off
your trade and it being accepted by the market maker on the other side of your
trade. The trade is cancelled if slippage exceeds this figure.
◦ Pair prefix/suffix: you can enter these if your broker uses either a prefix to the
chart symbol, or a suffix. Desky will automatically add them to your 'bigger
picture' or swap directional pair lists.
◦ PostTradeAttemptWaitSeconds: a safety feature. Slopey Peaky Bob will not
attempt to resend a trade for this period of time after an order-sending failure.
This is to avoid multiple orders being placed at the same price when
Craptrader4 lets us down again.
◦ Scale out stop loss: this is an idea put to me by ilworking. Instead of allowing a
trade that is going wrong to hit its stop loss entirely, we close parts of the original
trade at successive stop out levels. IMPORTANT NOTE: this function can only
work accurately with a fixed lot size. Using it in conjunction with variable lot
sizing will give unpredictable results. ANOTHER NOTE: this function may not be
available to all members of the Slopey Peaky Bob tribe. You will know it is not
available if the inputs do not appear immediately above the lot sizing inputs.
▪ The inputs:
• UseScaleOutStopLoss: turns this feature on/off.
• NoOfLevels: the number of stop out levels you want.
▪ How it works:
• Imagine you have a 0.4 lot size buy trade open. There are 100 pips in
between the order opening price and the stop loss. You have NoOfLevels
set to 4. There are 4 stop out levels, 25 pips apart (i.e. 100 pip stop loss
divided by 4).
• The market falls 25 pips, so Desky closes 0.1 lots of the trade, leaving 0.3
still open.
• The market falls another 25 pips, so Desky closes 0.1 lots of the trade,
leaving 0.2 still open.
• The market falls another 25 pips, so Desky closes 0.1 lots of the trade,
leaving 0.1 still open.
• The market falls another 25 pips, so either Desky closes the remaining
0.1 lots or the order hits its stop loss, whichever happens first.
▪ The pros: we save a lot of loss on a trade that hits its full stop loss.
▪ The cons: we lose profits on a trade that is part-closed before returning in
our direction and hitting its take profit unless we enable scaling back in..
• Scaling back in: this is the opposite to scaling out. This tells SPB to send a
pending order one level up to catch the move if the market turns around in the
direction of the original trade. There is a good illustration of how profitable this could
be here.
◦ The inputs:
▪ UseScaleBackIn: turns this feature on/off.
▪ ScaleBackInTradeComment: a comment to send with the order to show
that it is a scale-in trade.
◦ How it works:
▪ Imagine that buy trade I used to illustrate scaling out. The order price was
1.50250
▪ The market falls 25 pips to 1.50000 and SPB closes a quarter of the trade,
leaving a 0.3 lot trade open.
• SPB sends a buy stop order of 0.1 lots at 1.50250.
▪ The market falls a further 25 pips and SPB closes another quarter of the
market trade, leaving it with 0.2 lots open.
• SPB sends a second stop order of 0.1 lots, this time at 1.50000.
▪ Now if the market turns around, our stop orders fill and eventually wipe out
our losses during the fall. Alternatively, if the market continues to fall and the
trade eventually stops out altogether, then SPB deletes the 'orphaned' stop
orders.
• Lot sizing: there are a variety of methods to calculate the size of your trades:
◦ “Hard” lot size: this is a fixed trade size that is sent with every trade except for
a hedge trade.
▪ Lot: your chosen lot size. Make sure your lot size is acceptable to your
criminal.
◦ Percentage based lot sizing: this only applies to trades sent with a stop loss. It
calculates your lot size so that you lose x% of your account balance should the
stop loss be hit.
▪ RiskPercent: this tells an EA to calculate the lot size as a risk percentage of
your account balance. It uses the pips count in StopLossPips.
◦ Account size lot sizing: this allows your lot size to increase automatically as
your account balance/equity grows. It can be used in conjunction with differential
lot sizing:
▪ LotsPerDollopOfCash: you can have your lot size automatically calculated
this lot size per amount of cash in the account balance or equity. The default
settings would deliver 0.01 lots per $1,000. A zero input turns this feature off.
• SizeOfDollop: the cash increments used.
• UseBalance: use the account balance for the calculation.
• UseEquity: use the account equity for the calculation.
◦ Example of use, choosing the equity:
▪ equity = $2133.56
▪ LotPerDollopOfCash = 0.01.
▪ SizeOfDollop = $1,000.
▪ Calculated lot size is 0.02.
◦ Differential lot sizing: different pairs cause different cash movements per pip.
This feature attempts to even this up over the course of a pair making its
average daily movement as measured by ATR. Find this indicator by going to
your platform's Navigator/Indicators/Oscillators window and loading up the
Average True Range indi. There is some fancy equation footwork involved in the
calculations – all provided by Rene. Read his post here for details. Rene is a
genius folks; his contribution to everything I have coded is colossal. You can use
this feature in conjunction with account size lot sizing.
▪ UseDifferentialLotSizing: turns this feature on/off.
▪ AtrPeriod: the number of days to use in the ATR calculation. The default of
14 is the customary period.
• Trade direction controls: these allow you to set the only direction to trade
individual pairs. This is something suggested by Bill (billv) that allows you to trade
only in the direction of the 'bigger picture':
◦ The 'bigger picture':
▪ This is where you have decided that the market is ultimately going in one
direction and do not want SPB taking signals in the opposite direction. For
example:
• You are using W1 Peaky to define your overall trading direction. Peaky
says long trades only.
• You enter this pair into PairsToTradeLongOnly. Desky will only take buy
signals for opening new positions.
◦ 'The inputs. These are comma separated lists. Remember that SPB will add any
pair prefix's and suffix's if you have entered them into the inputs higher up. Also
bear in mind that this feature is entirely separate from the direction swap
features listed further down:
▪ PairsToTradeLongOnly: this is a comma separated list of pairs that you
only want to trade long. Do not leave spaces and do not add a comma at the
end. For example:
• PairsToTradeLongOnly could hold GBPCHF, USDCHF
▪ PairsToTradeShortOnly: this is a comma separated list of pairs that you
only want to trade short. Do not leave spaces and do not add a comma at the
end. For example:
• PairsToTradeShortOnly could hold EURUSD,EURAUD
• Super Slope: Super Slope defines the direction of trade: buy when Super Slope is
blue; sell when Super Slope is red; stay out when Super Slope is white. There are
three SS time frames that can be used in any combination. I will describe the
highest time frame inputs here. The equivalent medium and low time frame inputs
work in the same way:
◦ UseHtfSs: turns this time fame's Super Slope on/off.
◦ HtfSsTimeFrame: the chart time frame used to measure the slope.
◦ The next 3 inputs: play with these by loading the indi onto a chart. Make sure
you have the same input values in Slopey Peaky Bob as you have in Super
Slope – it is easy to get this wrong and find the indi and Slopey Peaky Bob
giving different readings. Slopey Peaky Bob works with the inputs you enter and
has no knowledge of any instances of Super Slope loaded onto the chart.
◦ HtfSsBarShift: this is the candle to read to get the value of the slope:
▪ the default of 0 means the current bar. SPB will read Super Slope every five
minutes.
▪ Mql4 coders talk about the 'shift' of bars. We are looking backwards in time
but still use positive numbers so a few examples:
• 1 means the close 1 bar ago.
• 4 means the close 4 bars ago.
◦ SuperSlope strength inputs: these tell Slopey Peaky Bob what the minimum
strength must reach to allow trading:
▪ HtfSsSlopeBuyAbove: SuperSlope must have risen to this level before
Slopey Peaky Bob can send buy trades. The default of 1 is guesswork.
▪ HtfSsSlopeSellBelow: SuperSlope must have fallen to this level before
Slopey Peaky Bob can send sell trades. The default of -1 is guesswork. Yyy
will convert this input to a negative number if you forget.
◦ Colour change inputs: these tell Slopey Peaky Bob what to do in the event that
the colour changes from red to blue or back again and retains the change at the
close of the candle. He ignores white:
▪ CloseMarketTradesOnOppositeColour: tells Slopey Peaky Bob to close
open market trades. You chose the level at which to close trades:
• CloseBuysBelow: SuperSlope has turned red. This can be temporary so
you wait until its value has fallen to this level before activating the closure.
• CloseSellsAbove: SuperSlope has turned blue. This can be temporary
so you wait until its value has risen to this level before activating the
closure.
▪ DeletePendingTradesOnOppositeColour: tells Slopey Peaky Bob to delete
outstanding pending trades.
• Peaky inputs:
◦ PeakyTimeFrame: the chart time frame to use for measuring the peak highs
and lows.
◦ NoOfBarsOnChart: this is the number of bars over which to measure the
peaks. The default represents the usual maximum that can be viewed.
◦ CloseAllWhenPeakyChanges: this tells SPB to:
▪ Close buy trades following a new high.
▪ Close sell trades following a new low.
• The D1 Moving Average trend filter: read this post to see why I added this filter. It
only applies to Slopey Peaky Bob's Candle Power at the time of editing this guide,
so do not be surprised that the inputs do not appear in other members of the tribe.
◦ UseMovingAverageFilter: turns this filter on/off.
◦ You do not need an explanation of the remaining inputs if you understand how to
use the moving average indi. Leave them alone if not. You will find the indi in
your platform's Navigator/Indicators/Trend window.
• Grid inputs:
◦ SendImmediateMarketTrade: tells Slopey Peaky Bob to send a market trade
immediately and then add the grid of pending orders.
◦ GridSize: the number of pending orders to send initially. More will be added if
the market retraces below the lowest buy and above the highest sell.
◦ DistanceBetweenTradesPips: the interval in pips between the individual stop
orders in the grid.
◦ UseAtrForGrid: this allows you to use ATR to calculate
DistanceBetweenTradesPips dynamically. ATR stands for “Average True Range”
and is explained well in this article: ATR explained. Find it via your platform's
Navigator/Indicators/Oscillators window. The advantage of using this is that your
grid can be more widely spaced when there has been a period of high volatility,
or closer when volatility was low. The following three inputs allow you to set your
ATR inputs:
▪ GridAtrTimeFrame: the time frame for the calculation.
▪ GridAtrPeriod: the period over which the calculation is made:
• The default time frame and period means that the calculation is done on
the previous four week's trading.
▪ GridAtrDivisor: this is used to divide the ATR value into fractions of the
whole and thus the spacing of the grid.
◦ 'Rolling' grid inputs: imagine this scenario. All your buy stop orders have filled
and the market has screamed to the stars. This feature tells Desky to add a new
stop order grid to take advantage of the market moving so strongly in your
favour:
▪ RollingGrid: turns this feature on/off.
▪ MaxRolledTrades: this limits the number of trades to open in a rolling grid.
▪ CloseGridAtMrtPlusOneLevel: this tells Desky to close all the trades on the
chart when MaxRolledTrades have filled and the market has progressed one
level further. The idea is to bank the profits before the inevitable retrace as
the market has moved a long way in our favour.
◦ Setting individual grid trades take profit: you can use the set take profit
options in the “Trade exit strategies” inputs. Here you have the option to set the
take profit of each trade in the grid at the open price of the next one. There are
pros and cons to this approach, so it is up to you to decide whether to use this
option.
▪ UseNextLevelForTP: turns this option on/off.
• Basket trading: this is for those of us wanting to trade either individual pairs as a
basket, and/or treating every trade sent by Slopey Peaky Bob as part of a whole-
position basket:
◦ Individual pairs: this is treating each pair as its own basket with its own profit
target:
▪ TreatIndividualPairsAsBasket: turns this feature on/off.
▪ IndividualBasketTargetPips: a target in pips. Slopey Peaky Bob will ignore
this target if it is set to 0.
▪ IndividualBasketTargetCash: a target in cash. Slopey Peaky Bob will
ignore this target if it is set to 0.
▪ LeaveIndividualBasketPendingsOpen: this is a feature requested by
MurphyMan. This is his explanation: “One thing I would like to see. Would it
be possible to allow the open trades to close when our targets are hit, but
keep the pending trades open? Currently, when all trades are closed, it takes
SPB a day or two to repopulate the pending orders. Keeping the pendings
intact might be a better way to keep us in the game.”
▪ Dynamic individual pair basket take profit: these inputs allow you to
calculate a dynamic IndividualBasketTargetCash basket cash take profit:
• UseDynamicCashTPIndividualPair: turns this feature on/off.
• CashTakeProfitIndividualePairPerLot: a notional target for a one lot
trade. Slopey Peaky Bob calculates the basket cash take profit by
multiplying this figure by the value of your Lot input. The default would
give a $10 TP on 0.01 lot sizes, so play with it:
◦ This includes lot sizes based on RiskPercent and
LotsPerDollopOfCash.
▪ There is a TP value displayed on the chart so you know where you are.
◦ All trades belong to a single basket: this is treating all trades with the EA's
magic number as part of a whole-position basket. The use of the three inputs
TreatAllPairsAsBasket, BasketTargetPips and BasketTargetCash should be
obvious. You are seriously in the wrong forum if not. We are finding that the
higher the pips take profit is, the better the profits – 10,000 is the best so far.
▪ LeaveAllPairsBasketPendingsOpen: this is the global equivalent to
LeaveIndividualBasketPendingsOpen, so the explanation further up is the
same here.
▪ Dynamic basket take profit: these inputs allow you to calculate a dynamic
TreatAllPairsAsBasket basket cash take profit:
• UseDynamicCashTP: turns this feature on/off.
• CashTakeProfitPerLot: a notional target for a one lot trade. Slopey
Peaky Bob calculates the basket cash take profit by multiplying this figure
by the value of your Lot input. The default would give a $30 TP on 0.01 lot
sizes, so play with it:
◦ This includes lot sizes based on RiskPercent and
LotsPerDollopOfCash.
◦ There is a TP value displayed on the chart so you know where you
are.
• 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.
There are both cash and pips trails available.
◦ Inputs for the cash TS are:
▪ UseBasketTrailingStopCash: turns this feature on/off. Note that it
is disabled by default.
▪ BasketTrailingStopStartValueCash: the basket profit at which
the TS kicks in. The default is based on a 0.01 lot size on a Global
Prime account.
▪ BasketTrailingStopGapValueCash: 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.
◦ The equivalent inputs for the pips TS end in “Pips” instead of “Cash”.
◦ Basket trailing stop as a percentage of the account balance: note
that enabling this automatically disables UseBasketTrailingStopCash:
▪ UseBasketTrailingStopPercentage: turns this TS on/off.
▪ BasketTrailingStopStartValuePercent: the percentage of the
account balance at which to trigger the trail.
▪ BasketTrailingStopGapValuePercent: the percentage of the
account balance by which to trail the position profit.
▪ For example:
• Account balance = $10,000;
• BasketTrailingStopStartValuePercent = 0.5%.
• BasketTrailingStopGapValuePercent = 0.1%.
◦ SPB will start trailing when the cash profit on the basket
reaches $50.
◦ SPB will trail the basket cash profit by $10.
• Recovery: imagine this scenario:
◦ You have a buy trade open.
◦ The market drops 100 pips and PoS has left a buy stop at the buy trade open
price minus DistanceBetweenTradesPips (imagine this is 50), using the fill-the-
gap feature.
◦ The market rises and fills the stop order. We have two market trades.
◦ The market falls another 100 pips (yep, it happens) so Slopey Peaky Bob leaves
another buy stop order.
◦ The market rises again and fills the stop order. We now have 3 market trades:
▪ Trade 1 is -100 pips.
▪ Trade 2 is -50 pips.
▪ Trade 3 is at 0 minus the spread.
◦ Now imagine the market rises 50 pips:
▪ Trade 1 is -50 pips.
▪ Trade 2 is at breakeven.
▪ Trade 3 is at +50 pips.
◦ .We are at break even over the group of trades and can close without loss, or at
worst with a tiny one from commission, spread and swap. That is what Recovery
is all about, and is a modified version of Bob's 10.x teaching. I have modified it
still further here. SPB will only close a position when the cash UPL is positive.
The inputs are:
▪ UseRecovery: turns this feature on/off.
▪ TradesToStartLookingForRecovery: the number of market trades that
need to be open before Slopey considers the position to be in need of
Recovery.
▪ MinimumLosersToTriggerRecovery: we only need Recovery if we have
some losers. This input specifies the number of losing trades to trigger
looking to close out at breakeven.
▪ RecoveryProfitCash: no need to suffer the pain of Recovery without some
reward, so this input tells PoS how many dollars (or whatever your account
currency is) profit to lock in before closing the group of trades.
• Safety feature:
◦ MinMinutesBetweenTrades: is the post close sleep period. The EA scans the
order history tab for the latest closed trade, and will not attempt to trade again
until MinMinutesBetweenTrades has passed.
• Trading hours. This is fantastic functionality provided by Baluda.
◦ Sort these out for yourself, using the information here. Never ask questions
about it in my threads. You will regret doing so should you ignore this warning.
◦ Use the 24 hour clock format.
◦ Enter trading periods in your own local time. Forget broker server time and GMT
offsets.
◦ Enter as many trading times as you want:
▪ precede trading start times with a '+' e.g. +08.00
▪ precede trading stop times with a '-' e.g. -13.15
▪ separate each value with a comma. Do not leave spaces.
▪ An example. Imagine you want to trade between 7 and 11 am and 1 and 5.30
pm, your input will look like this:
• +07.00,-11.00,+13.00,-17.30
• Inputs applied to individual days: these allow extra control over when you trade
on individual days. Enter these in your own local time, 24 hour format. An input of
24 or more disables the feature. Zero means midnight:
◦ FridayStopTradingHour: the hour on Friday at which the EA will stop initiating
new trading cycles. It will continue to monitor and manage open positions.
◦ FridayCloseAllHour: this is the hour at the end of the trading week when you
want Slopey Peaky Bob to start looking for an opportunity to close all your
trades and be 'flat' for the weekend.
◦ SaturdayStopTradingHour: the equivalent of FridayStopTradingHour for our
friends in Upside Down land.
◦ SaturdayCloseAllHour: a close position time for Upside Down land.
◦ MaxAllowableCashLoss: this is the maximum loss that scp will accept when
looking for an opportunity to close the position at the end of the week. Slopey
Peaky Bob converts this input into a negative number should you forget and
enter a positive one.
◦ TradeSundayCandle: for those whose broker has a Sunday candle. You might
not want your Slopey Peaky Bob trading the moment the markets open.
◦ MondayStartHour: the time on Monday to start trading. The default is London's
opening in the UK.
• BasketFridayTargets: this brilliant feature was added by John (SHF user name
1of3) . It will set the Basket Cash or Pip Take Profit progressively lower throughout
the day on a Friday.
◦ BasketFridayCashTargets: a CSV string of times in hours, and values, which
will lower the BasketTargetCash at the time you specify:
▪ For example the following setting "10,30,12,20,14,10,16,5,18,1" for the
BasketFridayCashTargets will change the Basket Cash Take profit to 30 at
10am, 20 at 12noon, 10 at 2pm, 5 at 4pm and 1 at 6pm (times are in 24 Hour
format, local time not broker time).
◦ BasketFridayPipsTargets: a CSV string of times in hours, and values, which
will lower the BasketTargetPips at the time you specify:
▪ For example the following setting "10,200,12,150,14,100,16,50,18,20" for the
BasketFridayPipsTargets will change the Basket Pip Take profit to 200 at
10am, 150 at 12noon, 100 at 2pm, 50 at 4pm and 20 at 6pm (times are in 24
Hour format, local time not broker time).
• Trading done for the week inputs: This applies to treating the whole open position
as a basket and is all to do with the way the baskets move. They commonly take a
couple of days to reach their take profit, so a basket sent on Thursday is usually
open over the weekend. Most of us like to be out of the markets over the weekend.
There is also this lovely quote from a post by Thomas in response to my enquiring
whether there was a demand for this feature: “Being the guy who is after the big
fish (like 10,000 pips as basket target), I would say yes. Lets say such a basket
took 5 weeks to develop and closes on Tuesday or Wednesday. I would like to
enjoy that for the rest of the week. Especially on turnaround Thursday and boring or
possibly volatile NFP Friday I wouldn't want a new cycle to start then. So yes, this
feature looks useful to me.”
◦ UseTradingDoneForTheWeek: turns this feature on/off.
◦ TargetDay: the day on which you want Slopey Peaky Bob to stop trading after a
basket closure.
◦ WeeklyCashTarget: stop trading once you have made this cash profit.
◦ WeeklyPipsTarget: stop trading once you have made this profit in pips.
◦ Dynamic target profit calculation: this allows you to base your target profit on
a multiple of your basket take profit:
▪ UseDynamicWeeklyTargetCash: calculates a target profit in cash.
▪ UseDynamicWeeklyTargetPips: calculates a target profit in pips.
▪ WeeklyTargetBasketTpMultiplier: Slopey Peaky Bob multiplies your basket
take profit by this figure to create your target profit. Some examples:
• Your whole basket cash TP is $30: your WeeklyTargetBasketTpMultiplier
is 2: Slopey Peaky Bob will knock off for the week once your profits hit
$60, i.e. two closed baskets.
• Your whole basket pips TP is 500 pips: your
WeeklyTargetBasketTpMultiplier is 2: Slopey Peaky Bob will knock off for
the week once your profits hit 1000 pips i.e. or two closed baskets.
▪ SlippageTolerancePercent: “Slippage” is the difference between the price
we want a trade to close and the price at which it actually closes. A basket
can easily have 20 open trades and will take a few seconds to close, even
though Slopey Peaky Bob closes all the market trades before deleting the
pendings. Slippage can run in our favour; the basket often hits TP with the
speed of an express train and the basket can close at more than we
intended. We might want to keep on trading if slippage caused the baskets to
close. For example:
◦ our weekly cash profit target is $100 and SlippageTolerancePercent is
10%. We are happy to call it a week so long as our profit for the week
is $91 or more. Less that $91 and we want to keep trading.
• Rollover time: this is the time at which brokers apply their swap charges. Spreads
widen hugely during this period – anything up to 30 times their normal spread. You
do not want your EA doing anything during this period:
◦ DisableEaDuringRollover: stops normal EA behaviour. You will see an
example of how to set the times in the EA's inputs window.
• Trade balance filters: these help you to avoid entering trades that could prove
detrimental if the market turns against you for a particular currency, and to avoid
entering trades at news-release times.
◦ UseZeljko: named after Zeljko who corrected the code for this filter and made it
work. This filter ensures 'balanced' trading. The easiest way to describe it is to
use hypothetical trades. Imagine that:
1. this EA buys GBPUSD.
2. this EA buys GBPJPY. You are now heavily exposed to GBP.
3. Something unexpected happens (and something unexpected always
happens in Forex) and the pound plummets, dropping like a stone into
the abyss. Both your trades scream into huge drawdown.
4. To avoid this, having taken the GBPUSD trade, this EA will not buy
another GBPxxx pair. Imagine instead that a Sell GBPJPY trade arises,
just before the market plummets. This time, your GU trade is screaming
into the abyss, but your GJ trade is going stratospheric. One trade
'balances' the other in the event of something dramatic happening.
◦ OnlyTradeCurrencyTwice: works in conjunction with UseZeljko. Again, imagine
the above scenario nos 1 & 4. Now you have a GU Buy and a GJ sell open –
perfectly balanced trades. If you now further trade any pair involving GBP, you
will unbalance your trading again, leaving you exposed to unexpected events.
This filter prevents a third trade being opened involving GBP.
◦ Note: both UseZeljco and OTCT work more deeply than the example I have just
given. For example, now you have a GU buy open, balanced trading does not
allow a further buy xxxUSD trade to open, only a sell xxxUSD – then OTCT
kicks in again........... Got a headache yet?
• Swap filters: 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:
◦ Cad/Aud/NzdPairsPositiveOnly: these have traditionally been high swap pairs,
so this tells Desky only to trade in the direction of positive swap on these pairs.
◦ OnlyTradePositiveSwap: tells Desky only to trade in the direction of positive
swap.
◦ MaximumAcceptableNegativeSwap: this allows you to acceptnegative swap
trades but limits the swap per full lot that you are willing to accept. The default of
-1000000 disables this feature.
◦ BuyOnlyPairs: this is a comma separated list of pairs that you only want to
trade long. Do not leave spaces and do not add a comma at the end. For
example:
▪ BuyOnlyPairs could hold GBPCHF, USDCHF
◦ SellOnlyPairs: this is a comma separated list of pairs that you only want to
trade short. Do not leave spaces and do not add a comma at the end. For
example:
▪ SellOnlyPairs could hold EURUSD,EURAUD
• Margin checks: these help avoid over-trading by limiting the number of trades that
can be opened. this EA will make the calculations before sending a trade and abort
if there is insufficient margin to allow further trading. There are two to chose from;
the default indicates my preference, but remember that they will be ignored once a
market trading cycle has been initiated:
◦ Scoobs check: scooby-doo is a former pro trader with the big banks; we have
benefited hugely from his advice. This filter compares the current account
margin with the free margin divided by 100, and aborts the trade if the margin is
greater than the result of this calculation.
◦ ForexKiwi check.ForexKiwi contributed this filter. It looks at the margin percent
figure and aborts the trade if yours is less than the figure you specify in
FkMinimumMarginPercent.
• Shirt Protection: we have a saying in the UK of gamblers who lose everything; we
say, “He lost his shirt”. Our equivalent as traders is the dreaded “margin call”, where
your broker closes your worst losing trade when ever your margin level drops below
a certain point. This is 100% on a Global Prime account with 100:1 leverage.
Slopey Peaky Bob has two features to help avoid this:
◦ DeletePendingsBelowThisMarginLevelPercent: this tells Slopey Peaky Bob
to delete all pending orders once your margin level drops below this figure. This
is not quite the same as the FkMinimumMarginPercent:
▪ FkMinimumMarginPercent will only delete pending trades if there are no
market trades. The rationale is that we want the grid trades to fill and take us
to our basket take profit figure as quickly as possible.
▪ DeletePendingsBelowThisMarginLevelPercent will delete all pending trades.
The rationale is that our margin level is already at a dangerously low level, so
we do not want more pending orders becoming market trades and depleting
our margin level still more..
◦ CloseDeleteAllBelowThisMarginLevelPercent: this protects at least some of
the account when our trading has gone disastrously wrong – maybe enough to
allow trading to resume. A “margin call” sounds innocent; this is why it is a total
disaster:
▪ Closing the biggest loosing trade(s) may well take our margin level above the
minimum but:
• Our trading has gone hideously wrong to reach this point. The margin
level will usually drop below the minimum level again as the markets
continue to go against our trades, so the broker again closes the biggest
loosing trade(s).
• This process will repeat until all trades have closed and there is nothing
left in the account. It has “blown”.
• Average spread inputs: We do not want an EA trading during a stop hunt. To learn
about the crim's stop hunting tactics, go to CJ's thread at
http://www.stevehopwoodforex.com/phpBB3/viewtopic.php?f=59&t=1572. There is
code to calculate the average spread and store it for retrieval every time you restart
the bot.
◦ The first time you run the ea it will take time to calculate the average spread.
The screen will display a message telling you how far into the process it is.
◦ The average spreads are saved in Global Variables:.
▪ Press the F3 key to open the Global Variables window.
▪ The relevant GV's begin with the chart symbol then " average spread" e.g.
"EURUSD average spread".
◦ TicksToCount: the number of ticks to use as the averaging period.
◦ MultiplierToDetectStopHunt: this multiplies the average spread and pauses
the bot if the spread exceeds this.
◦ The EA keeps a running tally of the spread and recalculates the average every
500 ticks. The chart includes a display of the average, along with a notification of
the widest spread since the EA was last started/restarted.

Trade Management
The remaining inputs are all about individual trade management. Management is a cut-
down module from Multi-purpose trade management EA available from
http://www.forexfactory.com/showthread.php?t=89371. The full management EA has a
wide range of extra features, and there is a User Guide to describe it.

Features included here:


• Break even settings: set a break even stop loss after the price reaches the setting
in BreakEvenPips. You can use this in conjunction with the Part-closure routine
(details later), as well as a stand-alone routine.
◦ BreakEven: set to true to enable this facility.
◦ BreakEvenPips: the number of pips you want the market to move in your favour
before setting the stop loss to the order entry price, ensuring the trade cannot
turn into a loss.
◦ BreakEvenProfit: will add this to the stop loss to a buy order, subtract it for a
sell order. My default of 2 pips means the sl is set to break even + 2, ensuring a
minimum of 2 pips profit. Set it to 0 if you do not want this feature.
◦ HalfCloseEnabled: will close half the trade when the market reaches your
breakeven point. It is up to you to ensure that your lot size allows this.
• Jumping stop loss settings: this will jump the stop loss by JumpingStopPips
when the price moves in your favour by that number of pips. Many traders consider
this to be a better option than a straight trailing stop. The first time this option is
triggered by the market price, it will set the stop loss to break even. After that, it will
increment the sl by JumpingStopPips every time the market moves sufficiently in
your favour.
◦ JumpingStop: set to true to enable this facility.
◦ JumpingStopPips: the number of pips to jump. For example, my default of 300
works like this:
▪ Market price hits order open price + 300: moves sl to break even.
▪ Market price hits order open price + 600: moves sl to + 300.
▪ Market price hits order open price + 900: moves sl to + 600.
• Candlestick jumping stop. This jumps the stop at the close of a candle:
◦ UseCandlestickTrailingStop: turns this on/off.
◦ CstTimeFrame: this allows you to use a different time frame to that of the chart.
Use integer values to correspond with your chosen time frame I.e. 1 for M1, 240
for H4, 1440 for D1 etc.
◦ CstTrailCandles: the number of candles ago to use as the trail. For example,
you are in a buy trade and want the stop loss to trail the default of 1, then the EA
will set the stop at the low of the previous candle, so long as this is higher then
the current stop loss.
◦ TrailMustLockInProfit: tells the EA to start moving the stop loss only when it
will be moved to > break even.
• Trailing stop loss settings: works like the conventional trailing stop you can enter
into the MT4 platform.
◦ TrailingStop: turns this on/off.
◦ TrailingStopPips: your trail distance.

Chart feedback display.


The shells place information about the EA's inputs on the chart. You have the option to use
the general Comment text, which you cannot personalise, or the text function provided by
Paul Bachelor (lifesys) at SHF.
• DisplayAsText: tells the EA to use Paul's display function. This puts text into labels
drawn on the chart; these sometimes split words and so sometimes appears a little
strange.
• KeepTextOnTop: stops the chart candles from obscuring Paul's text.
• The remaining inputs control the start point, font and colour of the text in Paul's
labels. Play with these to personalise your feedback.

Disclaimer and Risk Disclosure:

Trading foreign exchange on margin carries a high level of risk, and may not be suitable
for all investors. The high degree of leverage can work with as well as against you. Before
deciding to invest in foreign exchange you should carefully consider your investment
objectives, level of experience, and risk appetite. The possibility exists that you could
sustain a loss of some or all of your initial investment and therefore you should not invest
money you cannot afford to lose. You should be aware of all the risks associated with
foreign exchange trading, and seek advice from an independent financial advisor should
you have any doubts.

I will put this a tad more bluntly:


Most Forex traders lose all their money.
• Using this EA in trading Forex does not guarantee success.
• Trading with this EA could lead to serious financial loss.
• Trading this EA without understanding its underlying trading strategies guarantees
traders will lose their money.

Good luck. Have fun.

You might also like