Category Archives: Market Commentary

Another Good Year For Trend Following

Take a Look at the Last Two Years

Simple Donchian on a one contract basis.  $100 Commission/slippage.  Tested from 2000 thru December 31, 2021.  Do you see why most trend followers failed after the 2008 monstrous year.   Many funds caught the 2008 move and more funds were added soon thereafter.  Promises of similar performance came to fruition in 2011.  This kept much of the “new money” on the board.  However, reality set in and weak handed funds left for greener pastures.  Those that stuck it out were rewarded in 2014.  The trend drought of 2014 -2019 eroded most of the confidence in managed futures.  The rationalization that limited resources would eventually rise in price sounded good initially, but then fell on deaf ears after months of draw down.  Well known CTAs and hedge funds shut their doors forever.   The long awaited promise of 2008 came in the form of a pandemic – but it was too late.   Maybe now the deluge that ended the drought will persevere (hopefully not in the form of a pandemic) into the future.  Prices do not need to rise endlessly, but they need to move one direction or another without many hiccups.   

Simple Donchian Caught Most of the Commodities Up Moves

Which Sectors Pushed this Curve through the Roof

These reports were generated by my Python based Trading Simula-18 using Pinnacle continuous data – rollover triggered by date.  This is my new sector analysis report where I graph the last four years performance.  The tabular data is for the entire 21 year history.  The best sectors were energy, grains, financials and metals.  Lumber was extraordinary

Sector Analysis Report
################################################
Currency   -------------------------------------
BN           -28012      44681 
SN           -26925      55337 
AN             6560      34350 
DX            16284      24387 
FN            67463      31737 
JN           -22212      50362 
CN           -25355      44110 
------------------------------------------------
Totals:      -12198     141445 
------------------------------------------------
Currency   Last 4 Years    ---------------------
        |                                       
      ||| |                                     
     ||||||                                     
 |   ||||||||                                   
 |  |||||||||                                   
 | ||||||||||                                   
 |||||||||||||                                  
 ||||||||||||||                                 
 ||||||||||||||  |                              
|||||||||||||||||||                             
|||||||||||||||||||||           |               
||||||||||||||||||||||          |      |        
||||||||||||||||||||||          |      |        
||||||||||||||||||||||  |      ||   |  |  |     
------------------------------------------------ 0
|||||||||||||||||||||||||      |||  |||| ||| |  
|||||||||||||||||||||||||      |||| ||||||||||| 
||||||||||||||||||||||||| |    |||| ||||||||||||
|||||||||||||||||||||||||||    |||||||||||||||||
||||||||||||||||||||||||||||  ||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||
2018--------2019--------2020--------2021--------
################################################
Energies   -------------------------------------
ZU           180750      38330 
ZH           155696      85541 
ZN            70630      74400 
ZB           131874      66651 
------------------------------------------------
Totals:      538951     154434 
------------------------------------------------
Energies   Last 4 Years    ---------------------
                                      |       | 
                                      ||  ||  ||
                                      ||| || |||
                            |         ||||||||||
                            |        |||||||||||
                           |||       |||||||||||
                           |||| |   ||||||||||||
                           |||||||  ||||||||||||
                           |||||||||||||||||||||
                           |||||||||||||||||||||
                           |||||||||||||||||||||
                           |||||||||||||||||||||
            |   ||         |||||||||||||||||||||
           ||   ||         |||||||||||||||||||||
           ||  ||||        |||||||||||||||||||||
           |||||||||      ||||||||||||||||||||||
 |         ||||||||||    |||||||||||||||||||||||
||  ||     |||||||||||||||||||||||||||||||||||||
||||||     |||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||
2018--------2019--------2020--------2021--------
################################################
Metals     -------------------------------------
ZG           -17070      43540 
ZI            68395     146885 
ZK           101888      29475 
ZP            82885      27600 
ZA           174955      83910 
------------------------------------------------
Totals:      411052     166703 
------------------------------------------------
Metals     Last 4 Years    ---------------------
                                             |  
                                |       |    |  
                               ||       ||   |  
                               ||       |||| |||
                          |    ||| |   |||||||||
                          ||   |||||||||||||||||
                          || |||||||||||||||||||
                         |||||||||||||||||||||||
                         |||||||||||||||||||||||
                         |||||||||||||||||||||||
                    | | ||||||||||||||||||||||||
                    ||||||||||||||||||||||||||||
              |   ||||||||||||||||||||||||||||||
              || |||||||||||||||||||||||||||||||
             |||||||||||||||||||||||||||||||||||
            ||||||||||||||||||||||||||||||||||||
         | |||||||||||||||||||||||||||||||||||||
        ||||||||||||||||||||||||||||||||||||||||
||     |||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||
2018--------2019--------2020--------2021--------
################################################
Grains     -------------------------------------
ZS            79175      20312 
ZW           -43438      51975 
ZC             5238      26688 
ZL            13248      24588 
ZM            29860      28810 
------------------------------------------------
Totals:       84083      88850 
------------------------------------------------
Grains     Last 4 Years    ---------------------
                                        |       
                                        |       
                                        ||      
                                        ||      
                                      ||||||||| 
                                     |||||||||||
                                     |||||||||||
                                     |||||||||||
                                    ||||||||||||
  |                                 ||||||||||||
  |   |                             ||||||||||||
| ||  |||                           ||||||||||||
||||| |||||                        |||||||||||||
||||||||||||                       |||||||||||||
||||||||||||    ||| |              |||||||||||||
||||||||||||| ||||||| ||          ||||||||||||||
||||||||||||||||||||||||||||      ||||||||||||||
||||||||||||||||||||||||||||||   |||||||||||||||
|||||||||||||||||||||||||||||||  |||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||
2018--------2019--------2020--------2021--------
################################################
Financials -------------------------------------
US            35991      24959 
TY             -350      29175 
TU             1473      23969 
EC             4700       9650 
------------------------------------------------
Totals:       41813      56453 
------------------------------------------------
Financials Last 4 Years    ---------------------
                            |          |   |||| 
                           |||         |   |||||
                           ||| |       || ||||||
                           |||||      ||||||||||
                           ||||||     ||||||||||
                           ||||||||   ||||||||||
                           ||||||||   ||||||||||
                          |||||||||  |||||||||||
                          ||||||||||||||||||||||
                    |     ||||||||||||||||||||||
                    |     ||||||||||||||||||||||
                  | |     ||||||||||||||||||||||
  |               | ||    ||||||||||||||||||||||
  ||             ||||||  |||||||||||||||||||||||
 |||             |||||||||||||||||||||||||||||||
 ||||       || | |||||||||||||||||||||||||||||||
 |||||      |||| |||||||||||||||||||||||||||||||
|||||||     ||||||||||||||||||||||||||||||||||||
||||||||    ||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||
2018--------2019--------2020--------2021--------
################################################
Softs      -------------------------------------
SB            25927      15035 
KC           -49775      94069 
CC           -72140      76660 
CT            16785      45470 
Lumber       218513      51745 
JO             2588      15760 
------------------------------------------------
Totals:      141898     128540 
------------------------------------------------
Softs      Last 4 Years    ---------------------
                                            | ||
                                            ||||
                                           |||||
                                           |||||
                                          ||||||
                                        | ||||||
                                        ||||||||
                                        ||||||||
                                        ||||||||
                                        ||||||||
------------------------------------------------ 0
                                |   |  |||||||||
                                |   | ||||||||||
                                ||||||||||||||||
                                ||||||||||||||||
                               |||||||||||||||||
                               |||||||||||||||||
         ||                |  ||||||||||||||||||
     |  ||||||||||| |      |||||||||||||||||||||
    ||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||
2018--------2019--------2020--------2021--------
################################################
Meats      -------------------------------------
ZT           -29940      57680 
ZZ            38480      15080 
ZF            18413      57550 
------------------------------------------------
Totals:       26952      66515 
------------------------------------------------
Meats      Last 4 Years    ---------------------
                            |           ||      
                            |    ||     ||      
                           ||  | ||     ||      
                           ||| | ||     ||      
                           |||||||||   ||||     
   |                      ||||||||||   ||||     
|  |                      ||||||||||| |||||     
|  |                      ||||||||||| |||||| |  
|  ||                     |||||||||||||||||| |  
|  |||            |      |||||||||||||||||||||  
|| |||            |      |||||||||||||||||||||  
||||||           ||    | ||||||||||||||||||||| |
||||||           ||   |||||||||||||||||||||||| |
||||||           ||   ||||||||||||||||||||||||||
|||||||| |       ||   ||||||||||||||||||||||||||
|||||||| |       |||  ||||||||||||||||||||||||||
||||||||||    |  |||||||||||||||||||||||||||||||
|||||||||||   |  |||||||||||||||||||||||||||||||
|||||||||||| || ||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||
2018--------2019--------2020--------2021--------

How Do You Program this in Python

Here is the module for TS-18.  There is a little extra code to keep track of sectors in case you want to limit sector exposure.  However, this code takes every trade on a one contract basis.  This code reflects my latest version of TS-18, which will be released shortly.

#  Define Long, Short, ExitLong and ExitShort Levels - mind your indentations
            buyLevel = highest(myHigh,40,curBar,1)
            shortLevel = lowest(myLow,40,curBar,1)
            longExit = lowest(myLow,20,curBar,1)
            shortExit = highest(myHigh,20,curBar,1)
            ATR = sAverage(myTrueRange,30,curBar,1)
            stopAmt = 2000/myBPV

            ATR = sAverage(myTrueRange,30,curBar,1)

            posSize = 1
            mmLxit = 99999999
            mmSxit = -99999999
            if mp == 1 : mmLxit = entryPrice[-1] - stopAmt
            if mp ==-1 : mmSxit = entryPrice[-1] + stopAmt



#  Long Exit
            if mp == 1 and myLow[curBar] <= mmLxit and mmLxit > longExit and barsSinceEntry > 1:
                price = min(myOpen[curBar],mmLxit)
                tradeName = "LxitMM"
                numShares = curShares
                exitPosition(price, curShares, tradeName, sysMarkDict)
                unPackDict(sysMarkDict)
#  Long Exit
            if mp == 1 and myLow[curBar] <= longExit and barsSinceEntry > 1:
                price = min(myOpen[curBar],longExit)
                tradeName = "Lxit"
                numShares = curShares
                exitPosition(price, curShares, tradeName, sysMarkDict)
                unPackDict(sysMarkDict)
#  Short Exit
            if mp == -1 and myHigh[curBar] >= shortExit and barsSinceEntry > 1:
                price = max(myOpen[curBar],shortExit)
                tradeName = "Sxit"
                numShares = curShares
                exitPosition(price, curShares, tradeName, sysMarkDict)
                unPackDict(sysMarkDict)
#  Short Exit
            if mp == -1 and myHigh[curBar] >= entryPrice[-1] + stopAmt and barsSinceEntry > 1:
                price = max(myOpen[curBar],entryPrice[-1] + stopAmt)
                tradeName = "SxitMM"
                numShares = curShares
                exitPosition(price, curShares, tradeName,sysMarkDict)
                unPackDict(sysMarkDict)
#  Long Entry
            if myHigh[curBar] >= buyLevel and mp !=1:
                price = max(myOpen[curBar],buyLevel)
                tradeName = "Simple Buy"
                numShares = posSize
                enterLongPosition(price,numShares,tradeName,sysMarkDict)
                unPackDict(sysMarkDict)
#  Short Entry
            if myLow[curBar] <= shortLevel and mp !=-1 :
                price = min(myOpen[curBar],shortLevel)
                if mp == 0 : sectorTradesTodayList[curSector] +=1
                tradeName = "Simple Sell"
                numShares = posSize
                enterShortPosition(price, numShares, tradeName, sysMarkDict)
                unPackDict(sysMarkDict)
Python within Trading Simula-18