READ-ONLY

The forum is now a read-only archive.

For bug reports & platform questions → [email protected]

Our community lives on Discord and YouTube — come join us!

Change Profitable Month conditions

3 replies

Raul Franquet

Customer, bbp_participant, sq-ultimate, community, 15 replies.

Visit profile

2 years ago #284354

Does anyone know how to change the Profitable Month column so that it indicates the months that are >0 instead of >=0?
Or how to make a new Databank column with these conditions?
Thank you so much

0

Tomas Matejka

Administrator, sq-ultimate, 2 replies.

Visit profile

2 years ago #284386

You can edit the rule using CodeEditor

Alternatively you can edit your own formula – see our tutorial here https://strategyquant.com/doc/programming-for-sq/adding-new-databank-column/

1

Raul Franquet

Customer, bbp_participant, sq-ultimate, community, 15 replies.

Visit profile

2 years ago #284399

Thank you very much, the problem was that it uses the months traded instead of the total months. I think that with this new column the problem is solved. (but only works for strategies generated after adding and compiling the column)

0

Raul Franquet

Customer, bbp_participant, sq-ultimate, community, 15 replies.

Visit profile

2 years ago #284400

package SQ.Columns.Databanks;
import com.strategyquant.lib.L;
import com.strategyquant.lib.SQUtils;
import com.strategyquant.lib.SettingsMap;
import com.strategyquant.tradinglib.DatabankColumn;
import com.strategyquant.tradinglib.OrdersList;
import com.strategyquant.tradinglib.SQStats;
import com.strategyquant.tradinglib.StatsTypeCombination;
import com.strategyquant.tradinglib.ValueTypes;
public class TotalProfitableMonthsPct extends DatabankColumn {
public TotalProfitableMonthsPct() {
super(L.tsq(“% Total Profitable Months”), DatabankColumn.Decimal2Pct, ValueTypes.Maximize, 0, 0, 100);
setDependencies(“ProfitableMonths”, “TotalDataDays”);
}
//————————————————————————
@Override
public double compute(SQStats stats, StatsTypeCombination combination, OrdersList ordersList, SettingsMap settings, SQStats statsLong, SQStats statsShort) throws Exception {
int profitMonths = stats.getInt(“ProfitableMonths”);
int totalMonths = stats.getInt(“TotalDataMonths”);
return SQUtils.round2(SQUtils.safeDivide(profitMonths, totalMonths) * 100);
}
}

0

Viewing 3 replies - 1 through 3 (of 3 total)