Custom Databank Column not working

I made a custom databank column to show CAGR/Exposure with the code below. Turns out some strategies have the right result... some gives 0%. See attached image.




package SQ.Columns.Databanks; import com.strategyquant.lib.*; import com.strategyquant.datalib.*; import com.strategyquant.tradinglib.*; public class CAGRExp extends DatabankColumn {     public CAGRExp() {     super("CAGR/Exp",           DatabankColumn.Decimal2Pct, // value display format           ValueTypes.Maximize, // whether value should be maximized / minimized / approximated to a value           0, // target value if approximation was chosen           0, // average minimum of this value           100); // average maximum of this value       setWidth(80); // defaultcolumn width in pixels     setTooltip("CAGR / Exposure");     setDependencies("CAGR", "Exposure");   }     @Override   public double compute(SQStats stats, StatsTypeCombination combination, OrdersList ordersList, SettingsMap settings, SQStats statsLong, SQStats statsShort) throws Exception {     double cagr = stats.getDouble("CAGR");     double exposure = stats.getDouble("Exposure");     double cagr_exp = SQUtils.safeDivide(cagr, exposure);       /* round and return the value. It will be saved into stats under the key "CAGRExp" */     return round2(cagr_exp * 100);   } }


Attachments
  • Votes 0
  • Project StrategyQuant X
  • Type Bug
  • Status Refused
  • Priority Normal

History

LL
#1

kim@myfamilylink.net

02.02.2024 14:10

Task created

TT
#2

Tamas

06.02.2024 15:22

Status changed from New to Refused

Attachment image-0.png added

Attachment image-1.png added

image-1.png
(115.70 KiB)
image-0.png
(85.21 KiB)
Hello,


CAGRExposure can be 0 for some strategies.


You can use DebugConsole to get more info

https://strategyquant.com/doc/programming-for-sq/logging-and-debugcolsole/


If you still need some help please attach the problematic strategies to dig deeper.


Sincerely,

Tamas



Votes: 0

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please