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!

Anomaly on a snippet

3 replies

Aschab

Subscriber, bbp_participant, community, 3 replies.

Visit profile

10 years ago #114530

I created an extended Equity Control, with a series of logs for testing purposes:

 

public PF() {
      setName(“PF”);
      
      addDoubleParameter(“StartValue”, “Start Trading Value”, 2d, 0d, 200d, 0.1d);
      addDoubleParameter(“StopValue”, “Stop Trading Value”, 1.5d, 0d, 200d, 0.1d);
      addIntParameter(“Period”, “Period”, 10, 1, Integer.MAX_VALUE, 1);
 
   }
 public void computeNewTradeSizes(Trade[] trades, double[] balanceControlLine) throws Exception {
      double startv = getDoubleParameterValue(“StartValue”);
      double stopv = getIntParameterValue(“StopValue”);
      boolean totrade = false;
      logToFile(“test”, String.valueOf(startv));
      logToFile(“test”, String.valueOf(stopv));
        for(int i=0; i<trades.length; i++) {
            if(balanceControlLine[i] >= startv){
               totrade = true;
            }
            if(balanceControlLine[i] <= stopv){
               totrade = false;
            }
            logToFile(“test”, String.valueOf(“para ” + i + ” control line es: ” + balanceControlLine[i] + ” el valor de to trade es: ” + totrade));
            if(balanceControlLine[i] == VALUE_UNDEFINED || totrade == true) {         
            } else {
               trades[i].size = 0f;
            }
        }
    }
 
Testing it on my computer on the trial version it works perfectly, but on my clients computer the “StopValue” Parameters always get logged as 0. We had to turn it into a constante inside the code, but I’d like to know what happened there.

 

0

Tomas Matejka

Administrator, sq-ultimate, 2 replies.

Visit profile

10 years ago #134524

Hello, do you use same versions of QA in both cases?

0

Aschab

Subscriber, bbp_participant, community, 3 replies.

Visit profile

10 years ago #134525

I got the free trial, is that a problem?

0

Tamas

Customer, bbp_participant, community, sq-ultimate, administrator, 71 replies.

Visit profile

10 years ago #134526

Hello Aschab, 

 

I think the problem is that you define a “StopValue” as a double value

addDoubleParameter(“StopValue”, “Stop Trading Value”, 1.5d, 0d, 200d, 0.1d);

 

but in the code bellow you get it as Integer which removes the decimal part of value

double stopv = getIntParameterValue(“StopValue”);

 

Best regards,

Tomas

0

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