Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Custom indicator deviates between time frame views
 Post subject: Custom indicator deviates between time frame views Post rating: 0   New post Posted: Sat 17 Sep, 2011, 09:27 

User rating: 0
Joined: Sat 09 Jul, 2011, 10:50
Posts: 7
Location: DE
Hi.
im been haivng this problem that my indicator displays a straing line with a final peak (which is not what its supposed to do), when i view my chart on the current bar.

This problem is solved by moving the chart view back by at least one bar when it suddenly displays the correct information. The problem is that if this issue is not solved, i cant use my indicator properly ontop of another indicatior ('Indicator that uses the output of another indicator')

I tired playing around with start and end indexes but found no fix. To demonstrate the behavious i attached two images of what I mean.

Thank you
froid :)


Attachments:
current time frame.png [4.69 KiB]
Downloaded 437 times
past time frame.png [7.71 KiB]
Downloaded 424 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Custom indicator deviates between time frame views Post rating: 0   New post Posted: Mon 19 Sep, 2011, 08:07 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Without source it is hard to judge why the last output value is so much greater than the previous one. Please consider logging your inputs and outputs (and maybe some any other additional data), for example:
    //..
    private IConsole console;
    public void onStart(IIndicatorContext context) {
       
       console = context.getConsole();
       //..
     }

    public IndicatorResult calculate(int startIndex, int endIndex) {
        //..       
        print("inputs: " + arrayToString(outputs) + " outputs: " + arrayToString(outputs));
        //..     
    }
   
    public static String arrayToString(double [] arr){
        String str = "";
        for (int r=0; r<arr.length; r++) {
            str += "[" + r + "] "+ (new DecimalFormat("0.000000")).format(arr[r]) + "; ";
        }
        return str;
     }
       
   public static String arrayToString(double [][] arr){
      String str = "";
      for (int r=0; r<arr.length; r++) {
          for (int c=0; c<arr[r].length; c++) {
             str += "[" + r + "][" + c + "] " + (new DecimalFormat("0.000000")).format(arr[r][c]);
          }
          str += "; ";
      }
      return str;
   }
   private void print(Object o) {
      this.console.getOut().println(o);
   }


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com