Category Archives: Algorithmic Trading Commentary

Build your Technical/Trading Library for less than $150

Great books that are dirt cheap!

These books cover a wide range of technical analysis and trading topics.  I have read and/or utilized ideas from these books for developing trading ideas and in help writing my own books.  I wanted to see what I could get for less than $13 a book.  I was pleasantly surprised at what I could get at Thriftbooks.com for this price or lower.  If you go a little higher in price, you will get some really great deals too.  Yes, these books are old, and I am sure I have left out some great names, but the bang for the buck is ridiculous.

Note – I captured the Add to Cart button in the IMAGES – IT DOES NOT WORK.  I wanted to show the various editions of each book.  Go to www.thriftbooks.com and search for the title or author and you should be able to find these books just like I did.  Also check out amazon.com

The Gallacher, Taleb, McKay, Schwager, and Livermore (Lefevre) books are fun reads that give an honest view of trading in general.  Elders’ book just needs to be any trader’s library.

The Edwards and Magee, Sklarew and Darvas books are classics.

Sunny Harris’ book is great for beginners.

The Stridsman and Rotella books are concrete methods to systematic trading.

Kaufman and McCormick/Katz are great reference books.

The Conway book has great EasyLanguage examples.

You can learn a lot from Schwager’s first book.

Learn optimization from Robert Pardo and money management from Fred Gehm’s classic.

If you go up in price a little bit, you will get Ralph Vince, Larry Williams, John Carter, Rober Carver, Andreas Clenow, and Ernie Chan.  If you are just starting out, you must have a trading library, and this would be a great start for the first shelf.

 

Should you use a profit taking algorithm in your Trend Following system?

If letting profits run is key to the success of a trend following approach, is there a way to take profit without diminishing returns?

Most trend following approaches win less than 40% of the time.   So, the big profitable trades are what saves the day for this type of trading approach.  However, it is pure pain to simply sit there and watch a large profit erode, just because the criteria to exit the trade takes many days to be met.

Three methods to take a profit on a Trend Following algorithm

  1.  Simple profit objective – take a profit at a multiple of market risk.
  2.  Trail a stop (% of ATR) after a profit level (% of ATR) is achieved.
  3. Trail a stop (Donchian Channel) after a profit level (% of ATR) is achieved.

Use an input switch to determine which exit to incorporate

Inputs: initCapital(200000),rskAmt(.02),
useMoneyManagement(False),exitLen(13),
maxTradeLoss$(2500),
// the following allows the user to pick
// which exit to use
// 1: pure profit objective
// exit1ProfATRMult allows use to select
// amount of profit in terms of ATR
// 2: trailing stop 1 - the user can choose
// the treshhold amount in terms of ATR
// to be reached before trailing begins
// 3: trailing stop 2 - the user can chose
// the threshold amount in terms of ATR
// to be reached before tailing begins
whichExit(1),
exit1ProfATRMult(3),
exit2ThreshATRMult(2),exit2TrailATRMult(1),
exit3ThreshATRMult(2),exit3ChanDays(5);
Exit switch and the parameters needed for each switch.

The switch determines which exit to use later in the code.  Using inputs to allow the user to change via the interface also allows us to use an optimizer to search for the best combination of inputs.  I used MultiCharts Portfolio Trader to optimize across a basket of 21 diverse markets.  Here are the values I used for each exit switch.

MR = Market risk was defined as 2 X avgTrueRange(15).

  • Pure profit objective -Multiple from 2 to 10 in increments of 0.25.  Take profit at entryPrice + or – Profit Multiple X MR
  • Trailing stop using MR – Profit Thresh Multiple from 2 to 4 in increments of 0.1.  Trailing Stop Multiple from 1 to 4 in increments of 0.1.
  • Trailing stop using MR and Donchian Channel – Profit Thresh Multiple from 2 to 4 in increments of 0.1.  Donchian length from 3 to 10 days.

Complete strategy code incorporating exit switch.  This code is from Michael Covel’s 2005 Trend Following book (Covel, Michael. Trend Following: How Great Traders Make Millions in Up or Down Markets. FT Press, 2005.)  This strategy is highlighted in my latest installment in my Easing into EasyLanguage series – Trend Following edition.


vars:buyLevel(0),shortLevel(0),longExit(0),shortExit(0);

Inputs: initCapital(200000),rskAmt(.02),
useMoneyManagement(False),exitLen(13),
maxTradeLoss$(2500),whichExit(1),
exit1ProfATRMult(3),
exit2ThreshATRMult(2),exit2TrailATRMult(1),
exit3ThreshATRMult(2),exit3ChanDays(5);

Vars: marketRisk(0), workingCapital(0),
marketRisk1(0),marketRisk2(0),
numContracts1(0),numContracts2(0);

//Reinvest profits? - uncomment the first line and comment out the second
//workingCapital = Portfolio_Equity-Portfolio_OpenPositionProfit;
workingCapital = initCapital;


buyLevel = highest(High,89) + minMove/priceScale;
shortLevel = lowest(Low,89) - minMove/priceScale;
longExit = lowest(Low,exitLen) - minMove/priceScale;
shortExit = highest(High,exitLen) + minMove/priceScale;

marketRisk = avgTrueRange(15)*2*BigPointValue;
marketRisk1 =(buyLevel - longExit)*BigPointValue;
marketRisk2 =(shortExit - shortLevel)*BigPointValue;
marketRisk1 = minList(marketRisk,marketRisk1);
marketRisk2 = minList(marketRisk,marketRisk2);

numContracts1 = (workingCapital * rskAmt) /marketRisk1;
numContracts2 = (workingCapital * rskAmt) /marketRisk2;

if not(useMoneyManagement) then
begin
numContracts1 = 1;
numContracts2 =1;
end;

numContracts1 = maxList(numContracts1,intPortion(numContracts1)); {Round down to the nearest whole number}
numContracts2 = MaxList(numContracts2,intPortion(numContracts1));


if c < buyLevel then buy numContracts1 contracts next bar at buyLevel stop;
if c > shortLevel then Sellshort numContracts2 contracts next bar at shortLevel stop;

buytocover next bar at shortExit stop;
Sell next bar at longExit stop;

vars: marketRiskPoints(0);
marketRiskPoints = marketRisk/bigPointValue;
if marketPosition = 1 then
begin
if whichExit = 1 then
sell("Lxit-1") next bar at entryPrice + exit1ProfATRMult * marketRiskPoints limit;
if whichExit = 2 then
if maxcontractprofit > (exit2ThreshATRMult * marketRiskPoints ) * bigPointValue then
sell("Lxit-2") next bar at entryPrice + maxContractProfit/bigPointValue - exit2TrailATRMult*marketRiskPoints stop;
if whichExit = 3 then
if maxcontractprofit > (exit3ThreshATRMult * marketRiskPoints ) * bigPointValue then
sell("Lxit-3") next bar at lowest(l,exit3ChanDays) stop;
end;

if marketPosition = -1 then
begin
if whichExit = 1 then
buyToCover("Sxit-1") next bar at entryPrice - exit1ProfATRMult * marketRiskPoints limit;
if whichExit = 2 then
if maxcontractprofit > (exit2ThreshATRMult * marketRiskPoints ) * bigPointValue then
buyToCover("Sxit-2") next bar at entryPrice - maxContractProfit/bigPointValue + exit2TrailATRMult*marketRiskPoints stop;
if whichExit = 3 then
if maxcontractprofit > (exit3ThreshATRMult * marketRiskPoints ) * bigPointValue then
buyToCover("Sxit-3") next bar at highest(h,exit3ChanDays) stop;
end;

setStopLoss(maxTradeLoss$);

Here’s the fun code from the complete listing.

vars: marketRiskPoints(0);
marketRiskPoints = marketRisk/bigPointValue;
if marketPosition = 1 then
begin
if whichExit = 1 then
sell("Lxit-1") next bar at entryPrice + exit1ProfATRMult * marketRiskPoints limit;
if whichExit = 2 then
if maxContractProfit > (exit2ThreshATRMult * marketRiskPoints ) * bigPointValue then
sell("Lxit-2") next bar at entryPrice + maxContractProfit/bigPointValue - exit2TrailATRMult*marketRiskPoints stop;
if whichExit = 3 then
if maxContractProfit > (exit3ThreshATRMult * marketRiskPoints ) * bigPointValue then
sell("Lxit-3") next bar at lowest(l,exit3ChanDays) stop;
end;

if marketPosition = -1 then
begin
if whichExit = 1 then
buyToCover("Sxit-1") next bar at entryPrice - exit1ProfATRMult * marketRiskPoints limit;
if whichExit = 2 then
if maxContractProfit > (exit2ThreshATRMult * marketRiskPoints ) * bigPointValue then
buyToCover("Sxit-2") next bar at entryPrice - maxContractProfit/bigPointValue + exit2TrailATRMult*marketRiskPoints stop;
if whichExit = 3 then
if maxContractProfit > (exit3ThreshATRMult * marketRiskPoints ) * bigPointValue then
buyToCover("Sxit-3") next bar at highest(h,exit3ChanDays) stop;
end;

The first exit is rather simple – just get out on a limit order at a nice profit level.  The second and third exit mechanisms are a little more complicated.  The key variable in the code is the maxContractProfit keyword.  This value stores the highest level, from a long side perspective, reached during the life of the trade.  If max profit exceeds the exit2ThreshATRMult, then trail the apex by exit2TrailATRMult.  Let’s take a look at the math from a long side trade.

if maxContractProfit > (exit2ThreshATRMult * marketRiskPoints ) * bigPointValue

Since maxContractProfit is in dollar you must convert the exit2ThreshATRMult X marketRiskPoints into dollars as well.  If you review the full code listing you will see that I convert the dollar value, marketRisk, into points and store the value in marketRiskPoints.  The conversion to dollars is accomplished by multiplying the product by bigPointValue.

sell("Lxit-2") next bar at
entryPrice + maxContractProfit / bigPointValue - exit2TrailATRMult * marketRiskPoints stop;

I know this looks complicated, so let’s break it down.  Once I exceed a certain profit level, I calculate a trailing stop at the entryPrice plus the apex in price during the trade (maxContractProfit / bigPointValue) minus the exit2TrailATRMult X marketRiskPoints. If the price of the market keeps rising, so will the trailing stop.  That last statement is not necessarily true, since the trailing stop is based on market volatility in terms of the ATR.  If the market rises a slight amount, and the ATR increases more dramatically, then the trailing stop could actually move down.  This might be what you want.  Give the market more room in a noisier market.  What could you do to ratchet this stop?  Mind your dollars and your points in your calculations.

The third exit uses the same profit trigger, but simply installs an exit based on a shorter term Donchian channel.  This is a trailing stop too, but it utilizes a chart point to help define the exit price.

Results of the three exits

Exit 1 – Pure Profit Objective

Take a profit on a limit order once profit reaches a multiple of market risk aka 2 X ATR(15).

Pure profit object. Profit in terms of ATR or perceived market risk.

The profit objective that proved to be the best was using a multiple of 7.  A multiple of 10 basically negates the profit objective.   With this system several profit objective multiples seemed to work.

Exit – 2 – Profit Threshold and Trailing Stop in terms of ATR or market risk

Trail a stop a multiple of ATR after a multiple of ATR in profit is reached.

Trailing Stop using ATR
3-D view of parameters
3D view of parameter pairs

This strategy liked 3 multiples of ATR of profit before trailing and applying a multiple of 1.3 ATR as a stop.

Like I said in the video, watch out for 1.3 as you trailing amount multiple as it seems to be on a mountain ridge.

Exit – 3 – Profit Threshold in terms of ATR or market risk and a Donchain Channel trailing stop

Trail a stop using a Donchian Channel after a multiple of ATR in profit is reached.  Here was a profit level is reached, incorporate a tailing stop at the lowest low or the highest high of N days back.

Using Donchian Channel as trailing stop.
3-D view of parameters
3D view of parameters for Exit 3.

Conclusion

The core strategy is just an 89-day Donchian Channel for entry and a 13-Day Donchian Channel for exit.  The existing exit is a trailing exit and after I wrote this lengthy post, I started to think that a different strategy might be more appropriate.  However, as you can see from the contour charts, using a trailing stop that is closer than a 13-day Donchian might be more productive.   From this analysis you would be led to believe the ATR based profit and exit triggers (Exit #2) is superior.  But this may not be the case for all strategies.  I will leave this up to you to decide.  Here is the benchmark performance analysis with just the core logic.

Core logic results.

If you like this type of explanation and code, make sure you check at my latest book at amazon.com.  Easing into EasyLanguage – Trend Following Edition.

Prune Your Trend Following Algorithm

Multiple trading decisions based on “logic” may not add to the bottom line

In this post, I will present a trend following system that uses four exit techniques.  These techniques are based on experience and also logic.  The problem with using multiple exit techniques is that it is difficult to see the synergy that is generated from all the moving parts.  Pruning your algorithm may help cut down on invisible redundancy and opportunities to over curve fit.  The trading strategy I will be presenting will use a very popular entry technique overlaid with trade risk compression.

Entry logic

Long:

Criteria #1:  Penetration of the closing price above an 85 day (closing prices) and 1.5X standard deviation-based Bollinger Band.

Criteria #2:  The mid-band or moving average must be increasing for the past three consecutive days.

Criteria #3: The trade risk (1.5X standard deviation) must be less than 3 X average true range for the past twenty days and also must be less than $4,500.

Risk is initially defined by the standard deviation of the market but is then compared to $4,500. If the trade risk is less than $4,500, then a trade is entered. I am allowing the market movement to define risk, but I am putting a ceiling on it if necessary.

Short:

Criteria #1:  Penetration of the closing price below an 85 day (closing prices) and 1.5X standard deviation-based Bollinger Band.

Criteria #2:  The mid-band or moving average must be decreasing for the past three consecutive days.

Criteria #3:  Same as criteria #3 on the long side

Exit Logic

Exit #1:  Like any Bollinger Band strategy, the mid band or moving average is the initial exit point.  This exit must be included in this particular strategy, because it allows exits at profitable levels and works synergistically with the entry technique.

Exit #2:  Fixed $ stop loss ($3,000)

Exit #3:  The mid-band must be decreasing for three consecutive days and today’s close must be below the entry price.

Exit #4:  Todays true range must be greater than 3X average true range for the past twenty days, and today’s close is below yesterday’s, and yesterday’s close must be below the prior days.

Here is the logic of exits #2 through exit #4.  With longer term trend following system, risk can increase quickly during a trade and capping the maximum loss to $3,000 can help in extreme situations.  If the mid-band starts to move down for three consecutive days and the trade is underwater, then the trade probably should be aborted.  If you have a very wide bar and the market has closed twice against the trade, there is a good chance the trade should be aborted.

Short exits use the same logic but in reverse.  The close must close below the midband, or a $3,000 maximum loss, or three bars where each moving average is greater than the one before, or a wide bar and two consecutive up closes.

Here is the logic in PowerLanguage/EasyLanguage that includes the which exit seletor.

[LegacyColorValue = true]; 
Inputs: maxEntryRisk$(4500),maxNATRLossMult(3),maxTradeLoss$(3000),
indicLen(85),numStdDevs(1.5),highVolMult(3),whichExit(7);

Vars: upperBand(0), lowerBand(0),slopeUp(False),slopeDn(False),
largeAtr(0),sma(0),
initialRisk(0),tradeRisk(0),
longLoss(0),shortLoss(0),permString("");

upperBand = bollingerBand(close,indicLen,numStdDevs);
lowerBand = bollingerBand(close,indicLen,-numStdDevs);
largeATR = highVolMult*(AvgTrueRange(20));

sma = average(close,indicLen);

slopeUp = sma>sma[1] and sma[1]>sma[2] and sma[2]>sma[3];
slopeDn = sma<sma[1] and sma[1]<sma[2] and sma[2]<sma[3];

initialRisk = AvgTrueRange(20);
largeATR = highVolMult * initialRisk;
tradeRisk = (upperBand - sma);
// 3 objects in our permutations
// exit 1, exit 2, exit 3
// perm # exit #
// 1 1
// 2 1,2
// 3 1,3
// 4 2
// 5 2,3
// 6 3
// 7 1,2,3

if whichExit = 1 then permString = "1";
if whichExit = 2 then permString = "1,2";
if whichExit = 3 then permString = "1,3";
if whichExit = 4 then permString = "2";
if whichExit = 5 then permString = "2,3";
if whichExit = 6 then permString = "3";
if whichExit = 7 then permString = "1,2,3";



{Long Entry:}
If (MarketPosition = 0) and
Close crosses above upperBand and slopeUp and
(tradeRisk < initialRisk*maxNATRLossMult and tradeRisk<maxEntryRisk$/bigPointValue) then
begin
Buy ("LE") Next Bar at Market;
End;


{Short Entry:}

If (MarketPosition = 0) and slopeDn and
Close crosses below lowerBand and
(tradeRisk < initialRisk*maxNATRLossMult and tradeRisk<maxEntryRisk$/bigPointValue) then
begin
Sell Short ("SE") Next Bar at Market;
End;


{Long Exits:}

if marketPosition = 1 Then
Begin
longLoss = initialRisk * maxNATRLossMult;
longLoss = minList(longLoss,maxTradeLoss$/bigPointValue);

If Close < sma then
Sell ("LX Stop") Next Bar at Market;;

if inStr(permString,"1") > 0 then
sell("LX MaxL") next bar at entryPrice - longLoss stop;

if inStr(permString,"2") > 0 then
If sma < sma[1] and sma[1] < sma[2] and sma[2] < sma[3] and close < entryPrice then
Sell ("LX MA") Next Bar at Market;
if inStr(permString,"3") > 0 then
If TrueRange > largeATR and close < close[1] and close[1] < close[2] then
Sell ("LX ATR") Next Bar at Market;
end;

{Short Exit:}

If (MarketPosition = -1) Then
Begin

shortLoss = initialRisk * maxNATRLossMult;
shortLoss = minList(shortLoss,maxTradeLoss$/bigPointValue);
if Close > sma then
Buy to Cover ("SX Stop") Next Bar at Market;

if inStr(permString,"1") > 0 then
buyToCover("SX MaxL") next bar at entryPrice + shortLoss stop;

if inStr(permString,"2") > 0 then
If sma > sma[1] and sma[1] > sma[2] and sma[2] > sma[3] and close > entryPrice then
Buy to Cover ("SX MA") Next Bar at Market;
if inStr(permString,"3") > 0 then
If TrueRange > largeAtr and close > close[1] and close[1] > close[2] then
Buy to Cover ("SX ATR") Next Bar at Market;
end;
Trend following with exit selector

Please note that I modified the code from my original by forcing the close to cross above or below the Bollinger Bands.  There is a slight chance that one of the exits could get you out of a trade outside of the bands, and this could potentially cause and automatic re-entry in the same direction at the same price.  Forcing a crossing, makes sure the market is currently within the bands’ boundaries.

This code has an input that will allow the user to select which combination of exits to use.

Since we have three exits, and we want to evaluate all the combinations of each exit separately, taken two of the exits and finally all the exits, we will need to rely on a combinatorial table.    In long form, here are the combinations:

3 objects in our combinations of exit 1, exit 2, exit 3

  • one  – 1
  • two  – 1,2
  • three  –  1,3
  • four –  2
  • five  – 2,3
  • six –  3
  • seven  –  1,2,3

There are a total of seven different combinations. Given the small set, we can effectively hard-code this using string manipulation to create a combinatorial table. For larger sets, you may find my post on the Pattern Smasher beneficial. A robust programming language like Easy/PowerLanguage offers extensive libraries for string manipulation. The inStr string function, for instance, identifies the starting position of a substring within a larger string. When keyed to the whichExit input, I can dynamically recreate the various combinations using string values.

  1. if whichExit = 1 then permString = “1”
  2. if whichExit = 2 then permString= “1,2”
  3. if whichExit = 3 then permString = “1,2,3”
  4.  etc…

As I optimize from one to seven, permString will dynamically change its value, representing different rows in the table. For my exit logic, I simply check if the enumerated string value corresponding to each exit is present within the string.

	if inStr(permString,"1") > 0 then
sell("LX MaxL") next bar at entryPrice - longLoss stop;
if inStr(permString,"2") > 0 then
If sma < sma[1] and sma[1] < sma[2] and sma[2] < sma[3] and close < entryPrice then
Sell ("LX MA") Next Bar at Market;
if inStr(permString,"3") > 0 then
If TrueRange > largeATR and close < close[1] and close[1] < close[2] then
Sell ("LX ATR") Next Bar at Market;
Using inStr to see if the current whichExit input applies

When permString = “1,2,3” then all exits are used.  If permString = “1,2”, then only the first two exits are utilized.  Now all we need to do is optimize whichExit from 1 to 7.  Let’s see what happens:

Combination of all three exits

The best combination of exits was “3”.  Remember 3 is the permString  that = “1,3” – this combination includes the money management loss exit, and the wide bar against position exit.  It only slightly improved overall profitability instead of using all the exits – combo #7.  In reality, just using the max loss stop wouldn’t be a bad way to go either.  Occam uses his razor to shave away unnecessary complexities again!

If you like this code, you should check out the Summer Special at my digital store. I showcase over ten more trend-following algorithms with different entry and exit logic constructs.  These other algorithms are derived from the best Trend Following “Masters” of the twentieth century.  IMHO!

Here is a video you can watch that goes over the core of this trading strategy.

 

Is your Big Point Value right?

Thinking of using futures data from a vendor such as CSI, Pinnacle, Norgate…?

You would be surprised how many quants still use Excel or they own homegrown back-testing software.  Determining trade execution is simple.  On a stop order, all you need to do is see if today’s bar is higher than the prior bars calculated trade signal – right.  And if it is then a buy stop order is executed and the calculated signal price.  Store the entry price and when the exit occurs do the math to calculate the profit or loss.  Before you can do this, you must know two very important contract specs on the futures data you are testing:

  1. big point value – I will explain how to calculate this a little later
  2. minimum tick move

That’s it.  You don’t need to know anything beyond this to properly calculate trade signals and trade P and L.  As long as you store this information for each futures/commodity market you are testing, then you will be good to go.  Many testing platforms store more information such as contract size, trading hours, expiration date and several other contract specs.  You don’t need to know this information if you all you are interested is proper signal placement and accurate trade accounting.  Once you set the big point value and minimum tick move you are good to go, right?  Yes, if you stick with the same data vendor.  I kid you not.  Data vendors often quote the same exact market with different decimal places.  If you look up a sugar quote at the CME website, you will see it quoted like 0.1908.  If you look it up on TradeStation it is quoted as 19.08.  It’s the same size contract 112,000 pounds, but if you use the big point value at the CME, it will not produce accurate calculations on the TradeStation quote.  You can’t use the contract size of 112,000 pounds to help with the math either.  You have to delve into how each data vendor quotes their data and this will impact the big point move and minimum tick move.  Most vendors are gracious enough to provide a futures dictionary with these specs.  But it is wise to know how to do this by hand as well.

If you had to take a test, could you calculate the profit or loss from a trade in soybeans, in sugar or in euro currency?

Are you kidding me this is super simple.  Just program the strategy in TradeStation or Amibroker or Multicharts or TradingSimula-18.  I took the NFA Series 3 test more than two decades ago, and this type of question was on the test.  The following information was given:

  • contract size – 5000 bushels
  • minimum tick or move – 1/4th of a cent or penny
  • long entry price 8.32’2 and sell exit price 8.48’6 (per bushel)

The entry and exit price may look a little funny.  The entry price is eight dollars and 32 1/4 cents.   Many still quote soybeans in 1/8ths.  So, 2 X 1/8th = 1/4th.  For fun let’s calculate the notional value of the entry and exit prices.  The notional value of a soybean contract at the entry price is $8.3225 * 5000 = $41,612.50.  As you know futures are highly leveraged and you can control this quantity of soybeans for a small percentage of the notional value (margin.)  Now the exit price is $8.4875 (6*1/8th = 3/4th of a cent) and the notional value of the contract at exit is $8.4875 * 5000 = $42,437.5.  The result of the trade was $42,437.50 – $41,612.50 = $825.  Or you could simply multiple the difference between entry and exit by 5000.  This would $0.165 * 5000.  This makes perfect sense, but as a broker it was difficult to keep the contract size of a market and its minimum tick move in your memory.  Well, if you did it long enough it wasn’t that difficult.  You can reduce the math down to one easy to remember value and quickly do the math in your head.  The concept of the big point move allows for this.  If you download your data from Pinnacle or CSI the price of soybeans is usually quoted like this:  848.75.  This would be eight hundred and 48.75 cents.  The big point move is the amount of dollars required to lift (or drop) the first digit to the left of the decimal by one.  The first digit to the left of the decimal in beans is a penny or one cent.  A one cent move in beans is 5000 * $0.01 or $50.  Going back to our trade example 848.75 – 832.25 = 16.5 – multiply this by $50 you get $825.  You can also derive the minimum move dollar value too.  If the minimum move is 1/4th of a cent, then you can multiply 5000 * $.0025 and this yields $12.5.

Why is this important to know?

You should know this if you are trading the market, period.  Also, if you are a quant and are using some back testing software that requires you to set up the database outside the purview of the back-tester, then these values must be known, and must also be accurate.  Since TradeStation integrates its own data, you don’t have to worry about this.  But if you want to use a database from Pinnacle, BarChart, CSI or Norgate, then you have to take the time to set this up, right off the bat.  I feel like the leading data vendors, provide accurate data.  But there are differences from one vendor to another.  Not all data vendors use the same number of decimal places in their market quotes, so you must be able to determine the big point value and minimum move from the data.   You can do all the math to determine profit and loss from the big point value.  Here is a snapshot of a few markets in the TS-18 dataMasterPinnacle and the TS-18 dataMasterCSI text files. Like I said, all vendors will provide this information for you, so you can set your database properly.  Some back-testing platforms require more contract specs, but TS-18 just needs this information to carry out accurate calculations.  Here TS-18 wants to know the symbol, big point value, minimum tick move, and market name.

Pinnacle Data
AN,1000,0.01,Aus.Dol
ZL,600,0.01,BeanOil
BN,625,0.01,B.Pound
ZU,1000,0.01,Crude
ZC,50,0.25,Corn
CC,10,1,Cocoa
CL,1000,0.01,Crude
CN,1000,0.01,Can.Dol
CT,500,0.01,Cotton
FN,1250,0.005,EuroCur


CSI Data
AD,100000,0.0001,Aus.Dol
BO,600,0.01,BeanOil
BP,62500,0.0001,B.Pound
CL,1000,0.01,Crude
C2,50,0.25,Corn
C_,50,0.25,Corn
CC,10,1,Cocoa
CD,100000,0.0001,Can.Dol
CL,1000,0.01,Crude
CT,500,0.01,Cotton
CU,125000,0.00005,EuroCur
EC,125000,0.00005,EuroCur

Other than the symbol names the values for each symbol are very similar.  Most data vendors, including CSI quote the Euro currency like this:

1.08735 and a move to 1.08740 = 0.00005 *$125,000 = $6.25

But Pinnacle data quotes it like this:

108.735 and a move to 108.740 = 0.005 * $1,250 = $6.25

The size of the contract isn’t different here.  It is the quote that is different.  The big point value is tied to the contract size and the format of the quote.  This is why knowing the big point value is so important.  If you don’t set up the contract specifications correctly, then you will receive inaccurate results.

One more test in sugar – from the CME website

  • contract size – 112,000 pounds
  • minimum tick or move – $0.0001
  • long entry price $0.1910 and sell exit price $0.1980 (per pound)
  • big point value = $112,000
  • $0.0070 * 112,000 = $784

From TradeStation

  • contract size – 112,000 pounds
  • minimum tick or move – $0.01
  • long entry price $19.10 and sell exit price $19.80 (per pound??)
  • big point value = $1,120
  • $0.70 * 1,120 = $784

Most fractional quotes are delivered in decimal format and the also very important minimum tick move.

The interest rate futures have minimum tick moves ranging from 1/256ths to 1/32nds.  Most vendors will give you a quote like 120.03125 for the bonds.  If you test in TradersStudio or Excel or any other platform where the data is not integrated and are using CSI (or any other vendor), then you must force your calculated prices to fall on an even tick.  Assume you do a calculation to buy a bond future at 120.022365895.  If you don’t take the minimum tick move into considerations, you might be filled at this theoretical price.  In reality you should be filled on an even tick at 120.03125.  This is worse but realistic fill. You could create what you think is a really awesome strategy where you are shaving off the price on every trade – getting a better fill on every trade.

Thinking of purchasing and using back-testing software or Excel and data from a data vendor?

Become your own quant and do this.  You will learn a lot about algorithm testing and development.  But first things first.  Get your database set up according to your data vendor.  Once this chore is complete, testing becomes smooth sailing.  I provide the databases for Pinnacle and CSI with TS-18. Other software provides these as well, and a way to create your own databases.

Check out my interview in Traders’ Magazine [Germany]

INTERVIEW WITH THE GERMANY BASED TRADERS´ Magazine 05.2024 (May 2024 Issue)

traders-mag.com

Note from George – Original text was written in German.  The text below is translated without modification.

George Pruitt was Director of Research at Futures Truth for 30 years.

During this time he checked the performance of more than 1000 trading strategies that were commercially available. He had contact with many prominent people in the algorithmic trading industry. He has also advised domestic and foreign customers and published a total of eight books. We talk to George Pruitt about his experiences during more than three decades of trading system development.

Traders’ media Gmbh – Eisenbahnstraße 53
97084 Würzbug

info@traders-mag.com

TRADERS´: YOU BEGAN WORKING FOR FUTURES TRUTH IN 1989, WHILE YOU WERE STUDENT. HOW DID THAT HAPPEN?

Pruitt: I was in my final year of college and looking for an internship. I saw an ad for Futures Truth in the newspaper. They were looking for a part-time programmer. After the interview with founder John Hill and programmer John Fisher, I got the job.

TRADERS´: FUTURES TRUTH HAS BEEN AN INSTITUTION IN THE INDUSTRY FOR A LONG TIME. WHAT DID THE PROVIDERS OF TRADING STRATEGIES THINK ABOUT THE PERFORMANCE OF THEIR APPROACHES BEING SUBJECT TO EXTERNAL VALIDATION AND THEREFORE MADE TRANSPARENT?

Pruitt: Many system providers used the results published in the magazine as a springboard to become leaders in the heyday of the trading systems industry.

Other providers were not so happy about their results being made available to the public. Particularly in the early days of system trading, only a few traders had the computing power, data or software to check the claims about the strategies made in the providers’ advertisements. Sometimes the results shown were not accurate at all. Futures Truth used a rigorous backtesting methodology, using tick data when necessary to create authentic track records. These sometimes contradicted the advertising material of the providers, who were of course not that enthusiastic about them.

TRADERS: WHAT SURPRISED YOU THE MOST WHILE TESTING ALL THESE STRATEGIES OVER THE YEARS?

Pruitt: I was surprised that some very expensive trading systems were not worth the price the customer paid for them. In fact, price had very little to do with success. One reason for this was that many strategy providers were not traders in the true sense, but rather engineers or scientists.

TRADERS’: IN THE 1990’S YOU TESTIFIED TO YOUR FEDERAL GOVERNMENT ON THE SUBJECT OF ALGORITHMIC TRADING. WHAT WAS IT ABOUT THEN?

Pruitt: In this particular case, I was asked to essentially answer the following question: “Can an algo that has low trading success have periods of success – and could it in the future-be more successful at all?” Of course, any trading system, good or bad, can have profit and loss margins. However, in my experience at the time, an algo with a negative expected value usually didn’t last long after a winning streak.

TRADERS: YOU SAID “ACCORDING TO MY EXPERIENCE AT THE TIME”. HAS YOUR OPINION LATER CHANGED?

Pruitt: Back then, markets were relatively inefficient. One might expect a solid backtest to be pretty indicative of future performance. In the meantime, however, the markets have evolved. Don’t get me wrong: all we can lean on is the backtest, and it will always stay that way. But I don’t think it’s as meaningful today as it was in the 1990s.

TRADERS: DO YOU REMEMBER A SUPERIOR SYSTEM THAT GOT INTO TROUBLE?

Pruitt: One example was Keith Fitschen and his “aberration” system. It was a breakout system based on Bollinger bands with a period length of 80 days and two standard deviations. The exit was at the moving average (middle band). In my opinion, it was one of the most successful trading systems of all time. From 2010 to 2020, however, the strategy went through a difficult phase. Keith believed that markets have become much more efficient. With his “Paradigm Shift” system, he basically turned the trading rules around, although not exactly. This resulted in it having a really poor performance in the backtest, but succeeding after that. But only temporarily. The success of the reverse approach did not last.

The graphic shows a comparison of Keith Fitschen’s original aberration system and his practically reversed paradigm shift strategy, each applied to crude oil. For a while, it seemed like the market had undergone a paradigm shift. But then the new strategy also disappointed.

This is what the capital curve of a typical trend-following strategy looks like across a portfolio of different futures contracts. There were big movements in 2008, 2010 and 2014. After that, it became more difficult

TRADERS: YOU ARE AN EXPERT IN THE DEVELOPMENT OF TRADING SYSTEMS. WHAT ABOUT YOUR PERSONAL TRADING?

I was two years into working at Futures Truth. It took this long to complete the CompuTrac-M conversion. Futures Truth was started by John Hill who also owned Hill Financial Group and Commodity Research. At this time the managed futures business was booming and I was asked to sit for the Series 3 exam and to help start trading Fisher and Hills algorithms. John Hill, in my opinion, was the greatest market technician of his time. He had several books on bar patterns and he exposed me to discretionary trading. I couldn’t see the same things he did on a chart. However, Fisher had canned many of John’s concepts and programmed them into Fortran. I am a programmer and a computer scientist first and foremost and could see how the ideas, expressed by code, could work and they did for many years. I am an algorithmic trader and will always be one. I never traded futures for my personal accounts due to the conflict of interests. I spend most of my time trading stocks and working on my first love – programming.

TRADERS: WHAT WAS IT LIKE BACK THEN? YOUR APPROACH TO STOCK TRADING?

Pruitt: It was the dot-com era. We simply bought everything and sold it again a little later, which had a certain dynamism. In doing so, we also saw the signs of the times and held back a lot before the end of the bubble.

Shown is the capital curve of a short-term mean reversion strategy on the Nasdaq E-mini future. It buys pullbacks and trades in the direction of the long-term moving average. However, the drawdowns can be significant. For example, there was a 30 percent setback from trade 98 to 107.

TRADERS: YOU LED THE BACK-OFFICE TEAM OF A $180 MILLION HEDGE FUND IN THE 1990S AND DEVELOPED THE CORE ALGORITHMS OF ANOTHER HEDGE FUND IN THE 2000S. HOW DID YOU MANAGE THE GREAT SUCCESS AND LATER DISILLUSIONMENT WITH TREND-FOLLOWING STRATEGIES?

Pruitt: In the early 2000s, trend-following strategies became more and more popular. Back then, the managers of funds of funds didn’t even look at you if you were trading discretionarily, with options or anything else to follow trends. I, too, had included trend following in our programs and had some success with it. But at some point the zenith was passed. After the last major movements in raw materials and the stock market in the early 2010s, many hedge funds and commodity trading advisors (CTAs) had to give up. A two-percent fixed fee and a 20 percent performance fee are great when you’re making money, but it’s very hard when you’re not. The High Watermark became an obstacle that was difficult to overcome. At the same time, small hedge funds and CTAs in particular had to spend far too much money in relative terms to comply with the now stricter regulations.

TRADERS: NEVERTHELESS, TREND FOLLOWING IS STILL ONE OF THE MOST WELL-KNOWN TRADING STRATEGIES TODAY. WHY IS THAT?

Pruitt: For one thing, timing isn’t that important. And on the other hand, you do what the commandments of trading tell us: be selective when you enter, let the profits run, give the market room to its noise, and limit the losses. Most markets lend themselves well to trend following. And many of these systems have few parameters, so that over-optimization is hardly possible. This is also important.

TRADERS: WHAT DOES YOUR OWN TRADING APPROACH LOOK LIKE TODAY?

Pruitt: I trade a small portfolio of stocks on the daily chart. In doing so, I rely on both breakouts and mean reversion. I overlay levels on a 5-minute chart using Camarilla pivot points, for example, in order to systematically find entry levels. I derive the corresponding levels from the daily chart. The decisive factors here are indications that speak for a breakout or even a countercyclical trade. In these places, the risk can also be kept low. I also rely on the pyramiding of positions. However, my portfolio only contains stocks that I know and that I would hold for the long term.

TRADERS: IT IS SAID THAT AMONG DISCRETIONARY TRADERS ARE BOTH THE BEST AND THE WORST OF ALL. HOW MANY SUCCESSFUL DISCRETIONARY TRADERS THERE ARE IN THEIR EXPERIENCE?

Pruitt: Discretionary traders make a lot of money – but also lose it. For me, that’s not the way to go. I’ve met a lot of discretionary traders. But not many have been successful in the long run. Most eventually turn to algorithms – either as complete trading systems or as tools.

TRADERS: IT IS ALSO SAID THAT DISCRETIONARY TRADERS ALSO FOLLOW A SYSTEM. THE ONLY DIFFERENCE IS THAT THEY HAVE NOT YET SUFFICIENTLY SPECIFIED THEIR (UNCONSCIOUS) RULES. WOULD YOU AGREE WITH THAT?

Pruitt: Absolutely. We have a pattern in our head that we follow. You can’t just trade based on a gut feeling and be successful with it.

TRADERS: SYSTEMATIC TRADING HAS, BUT THERE ARE ALSO DOWNSIDES. WHAT ARE THEY?

Pruitt: It’s very challenging in a number of ways. Of course, if you’re winning non-stop with a system, it’s great. But what if ten losses occur in a row? At this point, at the latest, you start to doubt. To a certain extent, you have to enter the market with a blunt instrument and hope that your diligence in system development will pay off in the end. Remember, no matter what type of trader you are, your worst drawdown is yet to come. That’s why I believe that a multi-strategy approach works best. The hope, of course, is that diversification will improve earnings. In the end we were trading five different systems on almost the same portfolio.

TRADERS: THE MARKETS ARE CONSTANTLY CHANGING. IN 2001 YOU WROTE ABOUT IT, WHICH, FROM THEIR POINT OF VIEW, ARE THE BEST SYSTEMS FOR SHORT-TERM TRADING. HOW HAS THIS DEVELOPED OVER THE LAST TWO DECADES?

Pruitt: The best short-term swing systems in 2001 were based on breaking out of the opening range. The traders made a lot of money with this very simple approach. Toby Crabel wrote one of the best books about it. With the disappearance of the pits, the opening range was diluted. That said, I believe it still works for stocks and stock indices. Together with system developer Murray Ruggiero, we developed the Dynamic Open approach. The opening of the trading day is not based on time, but on a constant increase in volume. This also worked for a while, but unfortunately not permanently. Currently, the best short-term systems are based on mean reversion approaches.

TRADERS: CAN YOU GIVE US AN EXAMPLE?

Pruitt: You can use short-term Bollinger Bands, the Relative Strength Index, or anything else that shows a move away from the average. Buying pullbacks can be difficult because you don’t know where to end up in the downcycle.

 

TRADERS: SPEAKING OF MARKETS THAT CHANGE OVER TIME, HOW LONG DO YOU THINK IS THE IDEAL PERIOD FOR BACKTESTING?

Pruitt: The markets have undergone a change in strategy. It used to be that the more data, the better. But now I think that old data is affecting the validity of the results. A test period of ten to 15 years is more than sufficient these days.

TRADERS: ONE OF THE CHALLENGES OF BACKTESTING IS TO HAVE ENOUGH HIGH-QUALITY DATA IN THE FIRST PLACE. WHAT DO YOU WORK WITH? IS IT POSSIBLE TO ACHIEVE GOOD RESULTS EVEN WITH FREE DATA?

TO ACHIEVE THE BEST POSSIBLE RESULTS?

Pruitt: You can work with free data. This means that a positive expected value can be derived from it. But I would never trade it. Yahoo Finance and Quandl offer some free data, and good daily data is also relatively cheap. I’m using Pinnacle Data for commodities. They are very reasonably priced and very good. The same goes for CSI Data. I also test with Trade Station and their data. The integration of data, testing and trading in one package like TradeStation or MultiCharts is the main reason why I wrote my book series on EasyLanguage. Despite its limitations, it is probably the best programming language for beginners.

This capital curve looks too good to be true. That’s why caution is advised when it comes to data mining. However, it can also be the birth of a trading idea – used consciously – by optimizing all possible entry points and holding periods. Every once in a while, you’ll find something that works and can withstand rigorous testing.

TRADERS ́: WHAT ABOUT THE OLD IDEA OF DEVELOPING THE WORST POSSIBLE TRADING STRATEGY AND THEN JUST TRADING THE OPPOSITE?

Pruitt: That can work. You need to keep an eye on the average trade metric. If it’s high (big avgerage loss), why not? Often, bad systems are the ones that can’t cover their trading costs, and that’s a function of trade frequency. So a bad system that trades too much will always be a bad system.

TRADERS ́: WHAT INDICATORS WERE YOUR FAVORITES OVER THE YEARS?

Pruitt: I like Bollinger Bands, Keltner Channels, Moving Averages, and the MACD. Through Murray Ruggiero, I was introduced to John Ehlers’ indicators such as the Laguerre RSI and the Dominant Cycle. RSI and stochastic are good for the entry point, but not necessarily for making the entry decision.

TRADERS: DAY TRADING STRATEGIES ARE VERY POPULAR. HOWEVER, MANY PEOPLE UNDERESTIMATE HOW DIFFICULT IT IS TO EARN MONEY IN THE LONG RUN. WHAT ARE THE BIGGEST CHALLENGES?

Pruitt: Day trading can be successful, but you can’t trade too many times a day, and you can’t trade every day. The algorithms need appropriate filter rules. However, it’s hard for many traders to skip a day if they’re day traders. You have to wait for a setup. Waiting is perhaps the hardest part.

TRADERS: DO YOU HAVE ANY TIPS FOR DAY TRADERS THAT CAN BE USED TO IMPROVE RESULTS?

Pruitt: Identify support and resistance levels and trade around those levels. Be selective about which trades you make and don’t trade more than three times a day. In addition, filters should be developed to avoid bad trades in the first place.

TRADERS: WHAT ARE THE ANOMALIES IN RETURNS? THAT STILL EXIST TODAY?

Pruitt: There are still patterns in the market. They are a reflection of human nature. And there are persistent anomalies that can be detected with data mining tools. One example is the turn-of-the-month strategy. For day traders, there are specific times on the trading day that are suitable for long or short trades.

And the aforementioned open range breakout, which I still believe in, as well as the trade in the opposite direction in case the initial setup fails.

TRADERS: NO STRATEGY ALWAYS YIELDS PROFITS. THAT’S WHY SYSTEMATIC TRADERS NEED DIFFERENT APPROACHES THAT COMPLEMENT EACH OTHER. CAN YOU SHOW US A COMBINATION TO START WITH?

Pruitt: I would combine a trend-following approach with mean reversion and day trading. The trend-following portfolio should be the largest.

Mean Reversion only works in a handful of markets, and you should test this to see which markets are in this mode. When day trading, you should stick to markets with high volume and high volatility. As a rule, these are stocks and stock indices.

TRADERS: ONE CONTROVERSIAL ELEMENT OF STRATEGY DEVELOPMENT IS OPTIMIZATION. HOW MUCH DO YOU THINK SHOULD BE OPTIMIZED?

AND WITH WHAT APPROACH?

Pruitt: At the end of the day, all system developers are optimizing. A common question is whether you should use different parameters for different markets. When I was still working with managed futures, we didn’t allow for different parameters for different markets. We programmed concepts that were functions of the market, such as the Average True Range (ATR).

However, I believe that different parameters can work as long as you don’t overdo it, for example by optimizing individual parameters over too large a space. Data mining using genetic optimization can also be useful. On the other hand, I don’t believe in walk-forward optimization. This means that you are always behind the curve.

TRADERS: ONE METHOD OF OPTIMIZATION IS TO FILTER OUT THE LESS ATTRACTIVE SIGNALS WITHOUT COMPROMISING THE GOOD ONES. IS IT POSSIBLE TO IMPLEMENT THIS CONSCIENTIOUSLY?

Pruitt: Often, losing signals go hand in hand with a certain type of market behavior. In this case, filtering is the best approach to improve.

Let’s take a day trading system that trades every day but makes a loss overall. If you add that it only trades after days with a tight trading range, the performance of the system often increases.

TRADERS: YOU HAVE EXTENSIVE PROGRAMMING SKILLS IN DIFFERENT LANGUAGES. WHICH OF THEM ARE FOR YOU TODAY

MOST USEFUL?

Pruitt: Definitely Python and EasyLanguage. The latter is more or less identical to PowerLanguage from MultiCharts. Most trading strategies can be programmed in EasyLanguage to test and generate signals. Python allows you to test ideas outside of EasyLanguage, mainly because of the data limitations and access to academic libraries.

TRADERS: TODAY, ARTIFICIAL INTELLIGENCE (AI) IS ON EVERYONE’S LIPS. YOU HAVE ALREADY DEALT WITH SIMILAR IDEAS A FEW YEARS AGO.

IN WHICH AREAS CAN AI HELP?

Pruitt: We were already working with AI in the 1990s. She can help the trader develop the code and explain the huge library of indicators. Genetic optimization is helpful to some extent. As far as machine learning goes, I haven’t had any personal experience, but I’ve seen some disappointing results.

TRADERS: WITH YOUR KNOWLEDGE OF MORE THAN 1000 DIFFERENT ALGORITHMS, YOUR PROGRAMMING SKILLS AND ALL THE DATA AT YOUR DISPOSAL, DO YOU HAVE THE HOLY GRAIL FOUND?

Pruitt: In quantum circles, I was known as a “bubble brusher.” Often, developers and traders tested with table calculations and didn’t realize that they were cheating by unconsciously using future information. It’s easy to do. For example, you make the decision to trade at the open, but you accidentally use the daily close in your calculations for the signal. Most test platforms nowadays prevent such leaks, in the case of EasyLanguage, for example, through the “next bar” paradigm. However, if you have multiple signals that can be triggered on the same day, it is difficult to determine which one actually took place from a back testing perspective. In other words, during the back test if you need to know which long position was initiated from the various potential trade signals, the next bar paradigm makes it difficult to ascertain this.

TRADERS’: BASED ON YOUR DECADES OF EXPERIENCE, WHAT DO YOU RECOMMEND THAT ASPIRING TRADERS SHOULD START WITH?

Pruitt: John Hill’s most famous saying was, “Trading is the hardest way to make easy money!” Those of us who were able to act in the 1980s, 1990s, and a few years after were gifted. Arbitrage opportunities abounded at the time. John often said that trading bonds in those days was as easy as shooting fish in an aquarium. Today, on the other hand, it is very difficult to trade successfully. We have better instruments, but the market is more efficient. Countless market participants, access to data and fast computers have robbed us of easy profit opportunities. I would definitely recommend using an algorithm, and not trading too frequently. Don’t worry about every little movement in the market. Sooner or later, a bigger one will inevitably come. And be prepared to change your preconceived notions. Don’t try to force anything.

Infobox: Toby Crabel

Toby Crabel is a successful tennis player, US futures trader and fund manager at the hedge fund Crabel Capital Management, which he founded. In 1990, he published the book "Day Trading With Short Term Price Patterns and Opening Range Breakout", which is now considered a collector's item. On Amazon, more than 500 euros are called up, on the US site even over 1000 US dollars.

Source: Wikipedia

Infobox: Pivot-Punk Clique

Camarilla pivot points are a modified version of the classic pivot points. Introduced in 1989 by Nick Scott, a successful bond trader, they indicate potential intraday support and resistance levels. Similar to classic pivot points, they use the previous day's high, low, and close. However, Fibonacci numbers are used in the calculation of levels.

What: https://www.babypips.com