READ-ONLY

Das Forum ist jetzt ein schreibgeschütztes Archiv.

Für Fehlerberichte und Fragen zur Plattform → [email protected]

Unsere Community lebt auf Discord und YouTube - komm zu uns!

Tradestation - Robustheitsindex

1 Antworten

C C

Kunde, bbp_participant, community, sq-ultimate, 13 Antworten.

Profil besuchen

vor 4 Jahren #276911

<span class="Y2IQFc" lang="en">Ich versuche, ein Snippet der fraglichen Metrik zu erstellen, aber ich erhalte einen Fehler bei TotalDataDays. Ich bitte um Hilfe bei der Fertigstellung. Dankeschön</span>

0

C C

Kunde, bbp_participant, community, sq-ultimate, 13 Antworten.

Profil besuchen

vor 4 Jahren #276912

Paket SQ.Columns.Databanks;

import com.strategyquant.lib.*;
import com.strategyquant.datalib.*;
import com.strategyquant.tradinglib.*;

public class RobustnessIndex extends DatabankColumn {

public RobustnessIndex() {
super("RobustheitIndex",
DatabankColumn.Decimal2, // Format der Wertanzeige
ValueTypes.Maximize, // ob Wert maximiert / minimiert / auf einen Wert angenähert werden soll
0, // Zielwert, wenn Annäherung gewählt wurde
0, // durchschnittliches Minimum dieses Wertes
100); // durchschnittliches Maximum dieses Wertes

setWidth(80); // Standardspaltenbreite in Pixel

setTooltip("Robusteness Index von Tradestation");

}

//————————————————————————

public String getValue(ResultsGroup results, String resultKey, byte direction, byte plType, byte sampleType) throws Exception {
SQStats statsIS = results.subResult(resultKey).stats(Directions.Both, PlTypes.Money, SampleTypes.InSample);
SQStats statsOOS = results.subResult(resultKey).stats(Directions.Both, PlTypes.Money, SampleTypes.OutOfSample);

SQStats statsdataIS = results.subResult(resultKey).stats(Directions.Both, PLtypes.Money, SampleTypes.InSample);
SQStats statsdataOOS = results.subResult(resultKey).stats(Directions.Both, PlTypes.Money, SampleTypes.OutOfSample);

double npIS = 0, npOOS = 0;
int totaldataIS = 0, totaldataOOS=0;

if(statsIS != null) npIS = statsIS.getDouble("NetProfit");
if(statsOOS != null) npOOS = statsOOS.getDouble("NetProfit");

if(statsdataIS != null) totaldataIS = statsdataIS.getInt("TotalDataDays");
if(statsdataOOS != null) totaldataOOS = statsdataOOS.getInt("TotalDataDays");

//RobustenessIndex = (OOS Profit * 365 / Anzahl der OOS-Tage) / (IS Profit * 365 / Anzahl der IS-Tage) * 100

double ratio = SQUtils.safeDivide(((npOOS*365)/totaldataOOS),((npIS*365)/totaldataIS))*100;

 

return String.format("%.2f", Verhältnis);
}
}

0

Ansicht von 1 Antwort (von insgesamt 1)