Back Testing Algorithmic Trading Modern Portfolio Simulator

      Previous Post       Next Post 

   1       CODE HERE 

   2    |ExSan| C++  |ExSan|   MSVSC2022_V17_6.3@06.16-toolSet(v143)-

   3                                                         Sat Jun 24 10:07:24 2023

   4 

   5 

   6     exsan.plusplus@gmail.com   https://twitter.com/#!/ExSan_com

   7     JOB:  hft_0724

   8 

   9    Clock now: 3285752562408800 nanoseconds since boot

  10                GLUTo Mon Jan 1, 2024

  11    License Grant for: 165 days more

  12     DBfile:  stockDB_8.txt dbfileID:  4 

  13       StockCounterDB Number of files: 42

  14 

  16    :409: 1 dbfileID: 7 stockDB15.txt

  17    :410: 2 nTickRead: 99999

  18    :411: 3 cols: 7

  19    :416: 7 minDB: 2

  20     Read From File myInvestment:  10049   Savings:  124 

  21 

  22    pp_lastIN  0   ppnt_time  1   ppnt_data  2

  23    stockCounterDB:   42   mu:  0.33     Limit Trading / Savings:  10000  FactoRun:  2

  24    ******************

  25    <--------e-x-s-a-n---------->

  26     Generate Exsan ( 43 ,  44 )

  27 

  28    Total Number of assets allocated:  42

  29 

  30    PARAMETERS

  31    Investment:   10049    min Inv/Stock:  50 # Ticks -cols-:  7  beta:  0.02   ep(little ball):  0.0001

  32    HedgeBand   0.15055   <-- nbsp="">  0.84945  R(  0.34013  ;  0.45013 )r Lineal #Ticks:   3

  33    Expected Return:   2.7  %  minDB:  2   timesLapse:  3    timeZoomFactor:  1   retFactor:  0.1

  34    Check Trigger Counter:  4  Number of times dice is thrown:  99999  EndLess:  0

  35    Run:   3   onlyInteger 0 hedge:  1  ntNodes:  1 limitWeightFactor:  0.33  tickLimitToClear:  33

  37    |<--------e-x-s-a-n---hft------->|

7852 

7853 

7854    :3192: PORTFOLIO Selected Stocks ppDB

7855    WORKSHEET 4  D[25, 7] FLOAT

7856                               A      B      C      D      E      F      G 

7857                                  >-------------------------------------------------<

7858    11    44782457.14  BRLC    1: 18.00  17.90  17.84  17.80  17.76  17.90  17.64 

7859    20    41668828.57  ATLU    2: 32.43  32.79  33.63  34.33  34.38  34.03  33.49 

7860    12    37445457.14   BGG    5: 10.83  10.69  10.63  10.97  11.34  11.35  11.18 

7861    19    51127500.00   BBY    6: 34.79  37.07  37.07  36.27  36.52  36.11  35.93 

7862    31     3744685.71  AAPL   12: 80.35  78.09  74.85  78.67  78.49  75.80  73.93 

7863    20    29326342.86   BMY   14: 26.22  26.47  25.93  25.44  25.63  25.38  25.76 

7864    22    19499771.43  BOOM   17: 15.85  15.80  15.81  15.36  15.47  15.75  15.38 

7865    16    63605585.71  ABMD   23: 17.98  18.20  17.75  17.90  18.09  18.02  17.89 

7866    14    58732728.57 AMCSA   24: 39.04  39.37  39.17  38.04  38.05  38.88  39.60 

7867    16    61438714.29  ARAC   25: 10.72  10.60   9.97   9.95   9.92   9.78   9.76 

7868                                  <------------------------------------------------->

7869                                         1     2     3     4     5     6     7

7870 

7871    :3266: NORMALIZED-SCALED Adding Up Weights:        +Sum:0.76696440  -Sum: 0.00000000  +Sum - -Sum: 0.76696440

7872    :3275: end normalizar el output °°° Adding Up Weights sum:   0.00000000  +Sum:0.76696440

7873         -Sum: 0.00000000  +Sum - -Sum: 0.76696440 last col W, previous N

7874    :3300: -----------------------------------------------

7875    :3301: HEDGING (hdplus/hdsum) Ok! In range 0.15055000 < 0.19231006 < 0.84945000    hdplus: 0.14749497   hdminus: 0

7876    :3362: Adding Up Weights:   0.00000000  +Sum:0.76696440  -Sum: 0.00000000  +Sum - -Sum: 0.76696440 last col W,

7877    :3216: run: 3  counter: 3

7878    :3454: Total number of Stocks in Portfolio db: 0  <---- nbsp=""> 2  abSum  => 0.77629776  updated myInvestment: 1004

7879    :3500: deltaPrice = myInvestment - portfolioInvestment: 10049.00 - 7800.94 = 2248.06

7880    :3501: Before if - Stock counter: 0 <---> 2 <-: mindb="" nbsp="" p="">

7881    :3502: Not invested fraction %deltaPrice: 2248.06/ 10049.00 =  -0.2237100

7882 

7883 

7884    :3192: PORTFOLIO Selected Stocks ppDB

7885    WORKSHEET 4  D[23, 7] FLOAT

7886                               A      B      C      D      E      F      G 

7887                                  >-------------------------------------------------<

7888    19     9428542.86  ATSG    5:  8.10   7.81   7.66   7.60   7.73   7.69   7.87 

7889    10     9414614.29  ANRA   23: 16.10  16.70  16.80  17.40  17.10  17.30  16.30 

7890                                  <------------------------------------------------->

7891                                         1     2     3     4     5     6     7

7892 

7893    :3266: NORMALIZED-SCALED Adding Up Weights:        +Sum:0.90196121  -Sum: 0.00000000  +Sum - -Sum: 0.90196121

7894    :3275: end normalizar el output °°° Adding Up Weights sum:   0.00000000  +Sum:0.90196121

7895         -Sum: 0.00000000  +Sum - -Sum: 0.90196121 last col W, previous N

7896    :3300: -----------------------------------------------

7897    :3301: HEDGING (hdplus/hdsum) Ok! In range 0.15055000 < 0.76005892 < 0.84945000    hdplus: 0.68554366   hdminus: 0

7898    :3362: Adding Up Weights:   0.00000000  +Sum:0.90196121  -Sum: 0.00000000  +Sum - -Sum: 0.90196121 last col W,

7899    :3216: run: 3  counter: 2

7900    :3454: Total number of Stocks in Portfolio db: 0  <---- nbsp=""> 2  abSum  => 0.76005892  updated myInvestment: 1004

7901    :3500: deltaPrice = myInvestment - portfolioInvestment: 10049.00 - 7637.76 = 2411.24

7902    :3501: Before if - Stock counter: 0 <---> 2 <-: mindb="" nbsp="" p="">

7903    :3502: Not invested fraction %deltaPrice: 2411.24/ 10049.00 =  -0.2399487

7904 

7905 

7906    :3192: PORTFOLIO Selected Stocks ppDB

7907    WORKSHEET 4  D[20, 7] FLOAT

7908                               A      B      C      D      E      F      G 

7909                                  >-------------------------------------------------<

7910     9     5003785.71   BGG    4: 10.94  11.09  11.51  11.50  11.54  11.96  11.77 

7911    11     4949714.29 ASCMA    8: 19.34  19.82  19.66  19.85  18.86  18.15  17.79 

7912    13     2910457.14   AAL   19: 15.55  15.02  15.77  15.91  15.51  15.43  14.95 

7913    12     5363942.86   BHI   20: 32.50  32.94  32.65  32.60  32.40  33.07  33.46 

7914                                  <------------------------------------------------->

7915                                         1     2     3     4     5     6     7

7916 

7917    :3266: NORMALIZED-SCALED Adding Up Weights:        +Sum:0.73618048  -Sum: -0.00118777  +Sum - -Sum: 0.73736825

7918    :3275: end normalizar el output °°° Adding Up Weights sum:   0.00000000  +Sum:0.73618048

7919         -Sum: -0.00118777  +Sum - -Sum: 0.73736825 last col W, previous N

7920    :3300: -----------------------------------------------

7921    :3301: HEDGING (hdplus/hdsum) Ok! In range 0.15055000 < 0.76307448 < 0.84945000    hdplus: 0.56266690   hdminus: 0

7922    :3362: Adding Up Weights:   0.00000000  +Sum:0.73618048  -Sum: -0.00118777  +Sum - -Sum: 0.73736825 last col W

7923    :3216: run: 3  counter: 3

7924    :3454: Total number of Stocks in Portfolio db: 0  <---- nbsp=""> 2  abSum  => 0.76146365  updated myInvestment: 1004

7925    :3500: deltaPrice = myInvestment - portfolioInvestment: 10049.00 - 7651.87 = 2397.13

7926    :3501: Before if - Stock counter: 0 <---> 2 <-: mindb="" nbsp="" p="">

7927    :3502: Not invested fraction %deltaPrice: 2397.13/ 10049.00 =  -0.2385440

7928 

7929 

7930    :3192: PORTFOLIO Selected Stocks ppDB

7931    WORKSHEET 4  D[20, 7] FLOAT

7932                               A      B      C      D      E      F      G 

7933                                  >-------------------------------------------------<

7934    19     2569357.14   BHI    2: 38.89  38.80  38.93  39.01  38.66  38.71  37.38 

7935    15     4949900.00  BOOM   17: 13.96  13.42  13.89  14.31  13.49  13.35  13.36 

7936    14     3884828.57   BAC   19: 16.03  15.80  15.55  15.64  15.63  15.86  15.68 

7937    19     4425657.14   BMY   20: 28.58  27.76  26.03  25.77  26.60  27.18  28.48 

7938                                  <------------------------------------------------->

7939                                         1     2     3     4     5     6     7

7940 

7941    :3266: NORMALIZED-SCALED Adding Up Weights:        +Sum:0.67350039  -Sum: 0.00000000  +Sum - -Sum: 0.67350039

7942    :3275: end normalizar el output °°° Adding Up Weights sum:   0.00000000  +Sum:0.67350039

7943         -Sum: 0.00000000  +Sum - -Sum: 0.67350039 last col W, previous N

7944 

7945 

7946    :3192: PORTFOLIO Selected Stocks ppDB

7947    WORKSHEET 4  D[27, 7] FLOAT

7948                               A      B      C      D      E      F      G 

7949                                  >-------------------------------------------------<

7950    22     6377114.29   BHI    2: 39.01  38.66  38.71  37.38  38.69  38.97  38.16 

7951    17     7204742.86   BAC   19: 15.64  15.63  15.86  15.68  15.67  15.82  15.86 

7952    19     5312757.14  ABMD   27: 13.58  13.18  12.27  12.57  12.01  10.75  11.24 

7953                                  <------------------------------------------------->

7954                                         1     2     3     4     5     6     7

7955 

7956    :3266: NORMALIZED-SCALED Adding Up Weights:        +Sum:0.99236896  -Sum: 0.00000000  +Sum - -Sum: 0.99236896

7957    :3275: end normalizar el output °°° Adding Up Weights sum:   0.00000000  +Sum:0.99236896

7958         -Sum: 0.00000000  +Sum - -Sum: 0.99236896 last col W, previous N

7959 

7960 

7961    :3192: PORTFOLIO Selected Stocks ppDB

7962    WORKSHEET 4  D[27, 7] FLOAT

7963                               A      B      C      D      E      F      G 

7964                                  >-------------------------------------------------<

7965    22     7423414.29   BHI    2: 39.01  38.66  38.71  37.38  38.69  38.97  38.16 

7966    18     7207928.57  ARAC   18:  8.79   9.04   8.88   9.01   9.19   9.20   8.65 

7967    17     8251042.86   BAC   19: 15.64  15.63  15.86  15.68  15.67  15.82  15.86 

7968    19     6359057.14  ABMD   27: 13.58  13.18  12.27  12.57  12.01  10.75  11.24 

7969                                  <------------------------------------------------->

7970                                         1     2     3     4     5     6     7

7971 

7972    :3266: NORMALIZED-SCALED Adding Up Weights:        +Sum:0.99236896  -Sum: 0.00000000  +Sum - -Sum: 0.99236896

7973    :3275: end normalizar el output °°° Adding Up Weights sum:   0.00000000  +Sum:0.99236896

7974         -Sum: 0.00000000  +Sum - -Sum: 0.99236896 last col W, previous N

7975 

7976 

7977    :3192: PORTFOLIO Selected Stocks ppDB

7978    WORKSHEET 4  D[27, 7] FLOAT

7979                               A      B      C      D      E      F      G 

7980                                  >-------------------------------------------------<

7981    23     8268828.57 ASCMA    1: 15.45  16.07  16.12  16.79  16.49  16.58  16.65 

7982    22     8595914.29   BHI    2: 39.01  38.66  38.71  37.38  38.69  38.97  38.16 

7983    18     8887271.43  BOOM   17: 14.31  13.49  13.35  13.36  13.48  12.76  12.70 

7984    18     8380428.57  ARAC   18:  8.79   9.04   8.88   9.01   9.19   9.20   8.65 

7985    17     9423542.86   BAC   19: 15.64  15.63  15.86  15.68  15.67  15.82  15.86 

7986    19     7531557.14  ABMD   27: 13.58  13.18  12.27  12.57  12.01  10.75  11.24 

7987                                  <------------------------------------------------->

7988                                         1     2     3     4     5     6     7

7989 

7990    :3266: NORMALIZED-SCALED Adding Up Weights:        +Sum:0.85060483  -Sum: -0.02770535  +Sum - -Sum: 0.87831019

7991    :3275: end normalizar el output °°° Adding Up Weights sum:   0.00000000  +Sum:0.85060483

7992         -Sum: -0.02770535  +Sum - -Sum: 0.87831019 last col W, previous N

7993    :3300: -----------------------------------------------

7994    :3301: HEDGING (hdplus/hdsum) Ok! In range 0.15055000 < 0.51665508 < 0.84945000    hdplus: 0.45378342   hdminus: 0

7995    :3362: Adding Up Weights:   0.00000000  +Sum:0.85060483  -Sum: -0.02770535  +Sum - -Sum: 0.87831019 last col W

7996    :3216: run: 3  counter: 5

7997    :3454: Total number of Stocks in Portfolio db: 5  <---- nbsp=""> 2  abSum  => 1.00000000  updated myInvestment: 1004

7998    :3464: w updated Portfolio, availability $myInvestment: 10049.00 minDB: 2  ppCorr

7999    WORKSHEET 8  H[27, 29] FLOAT

8000                                   Z       AA       AB       AC       AD 

8001                                  >------------------------------------<

8002     1           0.00 ASCMA    1: 3271.95   196.51    16.65     0.33 

8003     1           0.00   BHI    2:-1356.61    35.55    38.16    -0.14 

8004     1           0.00  BOOM   17:-3183.49   250.60    12.70    -0.32 

8005     1           0.00   BAC   19: 1919.87   121.03    15.86     0.19 

8006     1           0.00  ABMD   27: -316.98    28.20    11.24    -0.03 

8007                                  <------------------------------------>

8008                                          26      27      28      29

8009                                    $        n    price       Wi

8010    :3500: deltaPrice = myInvestment - portfolioInvestment: 10049.00 - 10048.90 = 0.10

8011    :3501: Before if - Stock counter: 5 <---> 2 <-: mindb="" nbsp="" p="">

8012    :3502: Not invested fraction %deltaPrice: 0.10/ 10049.00 =  -0.0000100

8013    EXECUTE PORTFOLIO  myInvestment:   10049.0000000    TickToClearPortfolio: 1000  #TicksPerStock: 33   RUN:  3

8014    R:   0.3401300   r:  0.4501300  beta:  0.0200000  %r:  2.7000000    timesLaspse:  3.0000000

8015    0.1505500      0.8494500  fabs(negSum):  0.0277054  posSum  0.8506048  Stock Counter:  5

8016    :2893: VALID PORTFOLIO initialInvestment 10048.8995100   Not invested fraction: 0.0010000% is less than 10%, OK

8017    :2904: AT THE BEGINING      Remaining Stocks to beat: 5   geNSTOCKS: 0   expectedReturn: 0.2700000

8018 

8019 

8020 

8021    :2924: Tick:->  1   row:  17     BOOM(1)   -*-*-> 12.1323350

8022    :2942: SHORT   assetRet: 0.00   from previous tick discount previous AbsRet-> 0.00 - 0.00   after discount previ

8023    :2952***: Track AbsRet = 0.00 + 143.18 = 143.18 = 0.00 + 250.60*(12.13 + -12.70) = 0.00 + 250.60 * 0.57   :2956:

8024    :2955: Portfolio Abs Ret: 143.18   retPortCurrent: 0.01   current Portfolio: 10048.90   expected retPortfolio: 0.27%

8025    :2991: Initial #SPivot is: -12.13

8026    :2967: OK current: -12.70 << > 12.13

8027 

8028    :2924: Tick:->  2   row:  19      BAC(1)   -*-*->     15.64

8029    :3135: noSHORT  assetRet: 0.00   from previous tick discount previous AbsRet-> 143.18 - 0.00   current AbsRet: 1

8030    :3145: AbsRet: 143.18 + -26.71 = 116.47 = 143.18 + 121.03 * (15.64 - 15.86)   :3147: deltaPrice: -0.22 / 15.64 =

8031    :3148: Abs Ret: 116.47   retPortCurrent: 1.16%   current Portfolio: 10048.90   expected retPortfolio: 0.27%    overa

8032    :3162: Initial pivot val: 15.86

8033    :3164: current: 15.86 << > 15.64   #oposite direction, increases/was bad_tick_counter  : 0.00   bad_tick_counter b

8034    :3128: Abrupt Opposite Jump abs retStock: 0.0141 >>> 0.0000  <- bad_tick_counter="" final="" nbsp="" p="">

8035 

8036    :2924: Tick:->  3   row:   2      BHI(1)   -*-*->        38

8037    :2942: SHORT   assetRet: 0.00   from previous tick discount previous AbsRet-> 116.47 - 0.00   after discount pre

8038    :2952***: Track AbsRet = 116.47 + -9.97 = 106.50 = 116.47 + 35.55*(38.44 + -38.16) = 116.47 + 35.55 * -0.28   :2

8039    :2955: Portfolio Abs Ret: 106.50   retPortCurrent: 0.01   current Portfolio: 10048.90   expected retPortfolio: 0.27%

8040    :2991: Initial #SPivot is: -38.16

8041    :2967: OK current: -38.16 << > 38.44   :2971: #going up -oposite direction-, increase/was  bad_tick_counter was:

8042    :2976***: verify Abrupt Jump in price -going up-  retStock: -0.0073 >>> 0.0000  <- bad_ti="" nbsp="" now="" p="">

8043 

8044    :2924: Tick:->  4   row:  17     BOOM(2)   -*-*->   12.0371

8045    :2942: SHORT   assetRet: 0.00   from previous tick discount previous AbsRet-> 106.50 - 143.18   after discount p

8046    :2952***: Track AbsRet = -36.69 + 167.05 = 130.36 = -36.69 + 250.60*(12.04 + -12.70) = -36.69 + 250.60 * 0.67   

8047    :2955: Portfolio Abs Ret: 130.36   retPortCurrent: 0.01   current Portfolio: 10048.90   expected retPortfolio: 0.27%

8048    :3004: pivot val now is: -12.04

8049    :3014: #No change -remains in ZERO- in badTickerCounter: 0.00

8050 

8051    :2924: Tick:->  5   row:   2      BHI(2)   -*-*->     38.93

8052    :2942: SHORT   assetRet: 0.00   from previous tick discount previous AbsRet-> 130.36 - -9.97   after discount pr

8053    :2952***: Track AbsRet = 140.34 + -27.31 = 113.03 = 140.34 + 35.55*(38.93 + -38.16) = 140.34 + 35.55 * -0.77   :

8054    :2955: Portfolio Abs Ret: 113.03   retPortCurrent: 0.01   current Portfolio: 10048.90   expected retPortfolio: 0.27%

8055    :2983: opposite direction to short, ticker counter was: 2   :2985: becomes: 3    no change in pivot: -38.16

8056    :2986: greather than previous val #current: 38.93 > 38.44    increases bad_tick_counter: 3.00   :2987: NO change i

8057    :2991***: Abrupt Jump respect Pivot -  real Strock ret: 0.00

8058    :2990: datum: 38.93    rStockPivot = (38.93 - 38.16) / 38.16 = 0.02 >>> 0.00 negative return is bigger than 0.

8059    :2992: Bad Tick counter was: 3.00   becomes: 4.00

8060    :3031: #Short! -stock leaves- Portfolio expectedReturn 0.0027  meanRealReturnStock: 0.0000

8061 

8062    :2924: Tick:->  6   row:   1    ASCMA(1)   -*-*->   16.5300

8063    :3135: noSHORT  assetRet: 0.00   from previous tick discount previous AbsRet-> 113.03 - 0.00   current AbsRet: 1

8064    :3145: AbsRet: 113.03 + -23.58 = 89.45 = 113.03 + 196.51 * (16.53 - 16.65)   :3147: deltaPrice: -0.12 / 16.53 = 

8065    :3148: Abs Ret: 89.45   retPortCurrent: 1.03%   current Portfolio: 8692.29   expected retPortfolio: 0.27%    overall

8066    :3162: Initial pivot val: 16.65

8067    :3164: current: 16.65 << > 16.53   #oposite direction, increases/was bad_tick_counter  : 0.00   bad_tick_counter b

8068    :3128: Abrupt Opposite Jump abs retStock: 0.0073 >>> 0.0000  <- bad_tick_counter="" final="" nbsp="" p="">

8069 

8070    :2924: Tick:->  7   row:  19      BAC(2)   -*-*->        16

8071    :3135: noSHORT  assetRet: 0.00   from previous tick discount previous AbsRet-> 89.45 - -26.71   current AbsRet: 

8072    :3145: AbsRet: 116.16 + 23.23 = 139.39 = 116.16 + 121.03 * (16.05 - 15.86)   :3147: deltaPrice: 0.19 / 16.05 = 0

8073    :3148: Abs Ret: 139.39   retPortCurrent: 1.60%   current Portfolio: 8692.29   expected retPortfolio: 0.27%    overal

8074    :3857: pivot val now is: 16.05

8075    :3863: #Good Direction, this data greather than previous,  discount Bad hit counter: 1.00

8076 

8077    :2924: Tick:->  8   row:  27     ABMD(1)   -*-*->     11.51

8078    :2942: SHORT   assetRet: 0.00   from previous tick discount previous AbsRet-> 139.39 - 0.00   after discount pre

8079    :2952***: Track AbsRet = 139.39 + -7.61 = 131.77 = 139.39 + 28.20*(11.51 + -11.24) = 139.39 + 28.20 * -0.27   :2

8080    :2955: Portfolio Abs Ret: 131.77   retPortCurrent: 0.02   current Portfolio: 8692.29   expected retPortfolio: 0.27% 

8081    :2991: Initial #SPivot is: -11.24

8082    :2967: OK current: -11.24 << > 11.51   :2971: #going up -oposite direction-, increase/was  bad_tick_counter was:

8083    :2976***: verify Abrupt Jump in price -going up-  retStock: -0.0235 >>> 0.0000  <- bad_ti="" nbsp="" now="" p="">

8084 

8085    :2924: Tick:->  9   row:  17     BOOM(3)   -*-*->   11.8562

8086    :2942: SHORT   assetRet: 0.00   from previous tick discount previous AbsRet-> 131.77 - 167.05   after discount p

8087    :2952***: Track AbsRet = -35.28 + 212.39 = 177.12 = -35.28 + 250.60*(11.86 + -12.70) = -35.28 + 250.60 * 0.85   

8088    :2955: Portfolio Abs Ret: 177.12   retPortCurrent: 0.02   current Portfolio: 8692.29   expected retPortfolio: 0.27% 

8089    :3004: pivot val now is: -11.86

8090    :3014: #No change -remains in ZERO- in badTickerCounter: 0.00

8091 

8092    :2924: Tick:-> 11   row:   1    ASCMA(2)   -*-*->     16.45

8093    :3135: noSHORT  assetRet: 0.00   from previous tick discount previous AbsRet-> 177.12 - -23.58   current AbsRet:

8094    :3145: AbsRet: 200.70 + -39.30 = 161.40 = 200.70 + 196.51 * (16.45 - 16.65)   :3147: deltaPrice: -0.20 / 16.45 =

8095    :3148: Abs Ret: 161.40   retPortCurrent: 1.86%   current Portfolio: 8692.29   expected retPortfolio: 0.27%    overal

8096    :3184: opposite direction, ticker counter was: 2   :3186: becomes: 3

8097    :3187: #current 16.45 < 16.53  <--:less bad_tick_counter:="" change="" in="" nbsp="" no="" p="" pivot:="" previous="" than="">

8098    :3193: Abrupt Jump respect Pivot, assetRet: 0.00   datum: 16.45    rStockPivot = (16.45 - 16.65) / 16.65 = -0.01

8099    :3196: bad_tick_counter was: 3   :3199: becomes: 4

8100    :3884: Clear this stock -badTick  reached the limit: 3    -1

8101 

8102    :2924: Tick:-> 12   row:  27     ABMD(2)   -*-*->        14

8103    :2942: SHORT   assetRet: 0.00   from previous tick discount previous AbsRet-> 161.40 - -7.61   after discount pr

8104    :2952***: Track AbsRet = 169.01 + -70.22 = 98.79 = 169.01 + 28.20*(13.73 + -11.24) = 169.01 + 28.20 * -2.49   :2

8105    :2955: Portfolio Abs Ret: 98.79   retPortCurrent: 0.02   current Portfolio: 5420.34   expected retPortfolio: 0.27%  

8106    :2983: opposite direction to short, ticker counter was: 2   :2985: becomes: 3    no change in pivot: -11.24

8107    :2986: greather than previous val #current: 13.73 > 11.51    increases bad_tick_counter: 3.00   :2987: NO change i

8108    :2991***: Abrupt Jump respect Pivot -  real Strock ret: 0.00

8109    :2990: datum: 13.73    rStockPivot = (13.73 - 11.24) / 11.24 = 0.22 >>> 0.00 negative return is bigger than 0.

8110    :2992: Bad Tick counter was: 3.00   becomes: 4.00

8111    :3031: #Short! -stock leaves- Portfolio expectedReturn 0.0027  meanRealReturnStock: 0.0000

8112 

8113    :2924: Tick:-> 15   row:  19      BAC(3)   -*-*->   16.5631

8114    :3135: noSHORT  assetRet: 0.00   from previous tick discount previous AbsRet-> 98.79 - 23.23   current AbsRet: 7

8115    :3145: AbsRet: 75.56 + 84.82 = 160.38 = 75.56 + 121.03 * (16.56 - 15.86)   :3147: deltaPrice: 0.70 / 16.56 = 0.0

8116    :3148: Abs Ret: 160.38   retPortCurrent: 3.14%   current Portfolio: 5103.36   expected retPortfolio: 0.27%    overal

8117    :3857: pivot val now is: 16.56

8118    :3863: #Good Direction, this data greather than previous,  discount Bad hit counter: 0.00

8119 

8120    :2924: Tick:-> 17   row:  19      BAC(4)   -*-*->     16.66

8121    :3135: noSHORT  assetRet: 0.00   from previous tick discount previous AbsRet-> 160.38 - 84.82   current AbsRet: 

8122    :3145: AbsRet: 75.56 + 96.44 = 172.00 = 75.56 + 121.03 * (16.66 - 15.86)   :3147: deltaPrice: 0.80 / 16.66 = 0.0

8123    :3148: Abs Ret: 172.00   retPortCurrent: 3.37%   current Portfolio: 5103.36   expected retPortfolio: 0.27%    overal

8124    :3857: pivot val now is: 16.66      :3866: #No change -remains in ZERO- in badTickerCounter: 0.00

8125 

8126    :2924: Tick:-> 18   row:  19      BAC(5)   -*-*->     16.64

8127    :3135: noSHORT  assetRet: 0.00   from previous tick discount previous AbsRet-> 172.00 - 96.44   current AbsRet: 

8128    :3145: AbsRet: 75.56 + 94.12 = 169.68 = 75.56 + 121.03 * (16.64 - 15.86)   :3147: deltaPrice: 0.78 / 16.64 = 0.0

8129    :3148: Abs Ret: 169.68   retPortCurrent: 3.32%   current Portfolio: 5103.36   expected retPortfolio: 0.27%    overal

8130    :3184: opposite direction, ticker counter was: 0   :3186: becomes: 1

8131    :3187: #current 16.64 < 16.66  <--:less bad_tick_counter:="" change="" in="" nbsp="" no="" p="" pivot:="" previous="" than="">

8132    :3193: Abrupt Jump respect Pivot, assetRet: 0.00   datum: 16.64    rStockPivot = (16.64 - 16.66) / 16.66 = -0.00

8133    :3196: bad_tick_counter was: 1   :3199: becomes: 2

8134 

8135    :2924: Tick:-> 19   row:  17     BOOM(4)   -*-*->        12

8136    :2942: SHORT   assetRet: 0.00   from previous tick discount previous AbsRet-> 169.68 - 212.39   after discount p

8137    :2952***: Track AbsRet = -42.71 + 69.21 = 26.49 = -42.71 + 250.60*(12.43 + -12.70) = -42.71 + 250.60 * 0.28   :2

8138    :2955: Portfolio Abs Ret: 26.49   retPortCurrent: 0.01   current Portfolio: 5103.36   expected retPortfolio: 0.27%  

8139    :2983: opposite direction to short, ticker counter was: 0   :2985: becomes: 1    no change in pivot: -11.86

8140    :2986: greather than previous val #current: 12.43 > 11.86    increases bad_tick_counter: 1.00   :2987: NO change i

8141    :2991***: Abrupt Jump respect Pivot -  real Strock ret: 0.00

8142    :2990: datum: 12.43    rStockPivot = (12.43 - 11.86) / 11.86 = 0.05 >>> 0.00 negative return is bigger than 0.

8143    :2992: Bad Tick counter was: 1.00   becomes: 2.00

8144 

8145    :2924: Tick:-> 20   row:  19      BAC(6)   -*-*->     16.77

8146    :3135: noSHORT  assetRet: 0.00   from previous tick discount previous AbsRet-> 26.49 - 94.12   current AbsRet: -

8147    :3145: AbsRet: -67.63 + 110.39 = 42.76 = -67.63 + 121.03 * (16.77 - 15.86)   :3147: deltaPrice: 0.91 / 16.77 = 0

8148    :3148: Abs Ret: 42.76   retPortCurrent: 0.84%   current Portfolio: 5103.36   expected retPortfolio: 0.27%    overall

8149    :3857: pivot val now is: 16.77

8150    :3863: #Good Direction, this data greather than previous,  discount Bad hit counter: 1.00

8151 

8152    :2924: Tick:-> 21   row:  19      BAC(7)   -*-*->     16.58

8153    :3135: noSHORT  assetRet: 0.00   from previous tick discount previous AbsRet-> 42.76 - 110.39   current AbsRet: 

8154    :3145: AbsRet: -67.63 + 87.15 = 19.52 = -67.63 + 121.03 * (16.58 - 15.86)   :3147: deltaPrice: 0.72 / 16.58 = 0.

8155    :3148: Abs Ret: 19.52   retPortCurrent: 0.38%   current Portfolio: 5103.36   expected retPortfolio: 0.27%    overall

8156    :3184: opposite direction, ticker counter was: 1   :3186: becomes: 2

8157    :3187: #current 16.58 < 16.77  <--:less bad_tick_counter:="" change="" in="" nbsp="" no="" p="" pivot:="" previous="" than="">

8158    :3193: Abrupt Jump respect Pivot, assetRet: 0.00   datum: 16.58    rStockPivot = (16.58 - 16.77) / 16.77 = -0.01

8159    :3196: bad_tick_counter was: 2   :3199: becomes: 3

8160    :3884: Clear this stock -badTick  reached the limit: 3    1

8161 

8162    :2924: Tick:-> 22   row:  17     BOOM(5)   -*-*->        13

8163    :2942: SHORT   assetRet: 0.00   from previous tick discount previous AbsRet-> 19.52 - 69.21   after discount pre

8164    :2952***: Track AbsRet = -49.68 + -14.32 = -64.00 = -49.68 + 250.60*(12.76 + -12.70) = -49.68 + 250.60 * -0.06

8165    :2955: Portfolio Abs Ret: -64.00   retPortCurrent: -0.02   current Portfolio: 3183.49   expected retPortfolio: 0.27%

8166    :2983: opposite direction to short, ticker counter was: 2   :2985: becomes: 3    no change in pivot: -11.86

8167    :2986: greather than previous val #current: 12.76 > 12.43    increases bad_tick_counter: 3.00   :2987: NO change i

8168    :2991***: Abrupt Jump respect Pivot -  real Strock ret: 0.00

8169    :2990: datum: 12.76    rStockPivot = (12.76 - 11.86) / 11.86 = 0.08 >>> 0.00 negative return is bigger than 0.

8170    :2992: Bad Tick counter was: 3.00   becomes: 4.00

8171    :3031: #Short! -stock leaves- Portfolio expectedReturn 0.0027  meanRealReturnStock: 0.0000

8172    :3390: AT THE END       Remaining Stocks to beat: 0   geNSTOCKS: 1002   expectedReturn: 0.2700

8173 

8174    :3392: RUN 3   COL 7 Portfolio remaining after closing position pre-Final Portfolio Report ppDataIn 

8175    WORKSHEET 9  I[27, 9] FLOAT

8176                                   A       B       C       D       E       F       G       H       I 

8177                                    >---------------------------------------------------------------<

8178     3           4.00 ASCMA    1:  16.65   16.45   -0.20   -1.20  -39.30   -0.45 8692.29  196.51   -1.00 

8179     3           4.00   BHI    2: -38.16   38.93   -0.77   -2.01  -27.31   -0.27 10048.90   35.55   -1.00 

8180     6           4.00  BOOM   17: -12.70   12.76   -0.06   -0.45  -14.32   -0.45 3183.49  250.60   -1.00 

8181     8           3.00   BAC   19:  15.86   16.58    0.72    4.54   87.15    1.71 5103.36  121.03    1.00 

8182     3           4.00  ABMD   27: -11.24   13.73   -2.49  -22.15  -70.22   -1.30 5420.34   28.20   -1.00 

8183                                    <--------------------------------------------------------------->

8184                                            1      2      3      4      5      6      7      8      9

8185    nTick   badTicks                 Vo     Vf      d     %r   R=(Vf-Vo)*n       %R  Portf      nhit/miss

8186    :3394: geNSTOCKS:-> 1002  <--->1000 <-:genstockslimit p="">

8187    :3395: *****Abs Ret: -64.00 al final    SHUT DOWN Portfolio because overflow of allowed ticks?   :3397: Portfolio 

8188    :3503: NOTHING TO CLEAR --- all stocks processed 

8189    :3559: ok dbDataSumOnRowCol 5 RETURN  $: -64.00   %R = -64.00 / 10048.90 = -0.64%  compare with last AbsRet: -64

8190    :3560: Transaction costs tc * nStocks 5*0.00 = 0.00

8191    :3551: Transaction costs tshort * nStocks 2*0.00 = 0.00

8192    :3562: Net Return -64.00 - 0.00 - 0.00 = -64.00

8193    :3464: Net Return -64.00

8194    :4012: NOT GOOD PORTFOLIO, KEEP PREVIOUS INVESTMENT 9984.00

8195    :4107: next investment ok dbDataSumOnRowCol 10032.00

8196    counter: 5   Total Ticks: 1002   Mean Tick: 200

8197 

8198    :4256: Starts a New Round, run: 2      reset geNSTOCKS: 99999

8199    :3822: minDB: 1507.35 stTo    =  0.45 * myInvestment /  minDB : 4522.05 / 3   V 

8200    :3834: ??????CLOSES if (!(posSum > 7. || fabs(negSum) > 7.) && counter > 1) {

8201 

8202 

16521     hft_0724  Elapsed Time: 29  sec CHRONO START:  Sat Jun 24 10:07:24 2023

16522                       STOP:  Sat Jun 24 10:07:53 2023

16523 

16524 

16525    Boost version: 1.82.0

16526 

16527    EXIT FROM EXSAN 

Polulating ExSan with Market Data Tick by Tick
         Low Latency Systematic Trading Algorithm         
      Previous Post       Next Post 

+ + C   E x S a n   C + +
D o   N o t   A c c e p t   D e f a u l t s
T h i n k   D i f f e r e n t
Flag Counter

Comments

Popular posts from this blog

Back Testing Algorithmic Trading Modern Portfolio Simulator - Some Code

ExSan can monitor data market activity of several hundred contracts at the tick-by-tick level, 360 stocks in this run. ExSan is already plugged-in to Interactive Brokers C++ API