Image description

 SawtoothTrade

Counting consecutive losing trades in an autotrading  system

If you are using the Spreadsheet System for Trading study and would like to disable autotrading after n losing trades, this example will increment a consecutive losing trade count until there is a winning trade, or until the date changes:


-Add the Trading: Losing Trades study.

-Add the Trading: Winning Trades study.


 -Put this in cell O3 (or any spare column O-BR):

=IF(AA3>AA4,TRUE,IF(OR(AC3>AC4,INT(A3)>INT(A4)),FALSE,O4))

This will repeat TRUE until there is a winning trade, or until the date changes.


 -Put this in cell P3:

=IF(AND(O3,O4=FALSE),1,IF(AND(O3,AA3>AA4),P4+1,IF(AND(O3,O4),P4,0)))

This will increment the consecutive losing trade count, and reset to zero if there is a winning trade, or the date changes.


 The formulas assume the Trading: Losing Trades study is in column AA and the Trading: Winning Trades study is in column AC; edit as needed.


 You can now reference cell P3 in cell J28 to disable autotrading.