Not logged in
Viewing 4 posts - 1 through 4 (of 4 total)
  • #114530|
    Participant
    3 Posts

    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.

     

    #134524
    Moderator
    2222 Posts

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

    #134525
    Participant
    3 Posts

    I got the free trial, is that a problem?

    #134526
    Customer
    70 Posts

    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

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.