not all islands are shown in the info-window

Only 7 islands are displayed in the info bar, instead of 14 islands.
Attachments
only 7 inslands instead of 14.png
(7.52 KiB)
  • Votes 0
  • Project StrategyQuant X
  • Type Bug
  • Status Refused
  • Priority Normal

History

r
#1

Marcel

06.09.2018 06:49

Task created

h
#2

hankeys

06.09.2018 07:24
you are pushing it to the limits :) 14 islands and 200 generations...its too much by my opinion and you are wasting a computer time
MF
#3

Mark Fric

06.09.2018 08:10

Status changed from New to Refused

there are only 7 islands, because there is no space for morw. But you can easily copy this snippet in CodeEditor and create one that will display islands from 8-14
r
#4

Marcel

06.09.2018 08:55

 Mark:


Please explain what you mean? What do I have to copy where?

MF
#5

Mark Fric

06.09.2018 09:35
it is extending SQ with your own snippets, it is not yet fully documented.


You should go to Code editor, Snippets -> SQ -> Engine Charts, create a new file "GeneticEvoInfo814" and put the code below there.


Then compile it, restart SQ and you'll see new engine chart that shows info for islands from 8-14.


Full snippet code:


package SQ.EngineCharts;

import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONObject;

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

public class GeneticEvoInfo814 extends EngineChart {
    
    public GeneticEvoInfo814() {
        super(L.t("Genetic Evolution info (8-14 islands)"), TYPE_PROJECT_BASED);
    }

    //------------------------------------------------------------------------
    
    @Override
    public JSONObject print() {
        JSONObject data = new JSONObject();

        GeneticInfo geneticInfo = project.getGeneticInfo();

        JSONArray items = new JSONArray();

        if(!geneticInfo.isGeneticBuild()) {
            items.put(new JSONObject().put("name", L.t("No data")).put("value", "No genetic evolution running"));

} else {
ArrayList<GeneticInfo.GeneticInfoIsland> islands = geneticInfo.getIslands();

if(islands.size() < 8) {
items.put(new JSONObject().put("name", L.t("No data")).put("value", "Less than 8 islands used"));
    } else {
            for(int i=8; i<Math.min(14, islands.size()); i++) {
                 items.put(new JSONObject()
                         .put("name", String.format("Island #%d", i+1))
                         .put("value", String.format("Generation: %d, Population: %d", islands.get(i).generation, islands.get(i).populationSize)));
             }
}
        }

        data.put("items", items);
        data.put("type", DATA_TYPE_ROWS);
        
        return data;
    }

    //------------------------------------------------------------------------

    @Override
    public void addNextValue() {
    }   
}


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