Financial indicators in Javascript / HTML5

TeeChart for JavaScript for the HTML5 Canvas
Post Reply
g.todorov
Newbie
Newbie
Posts: 14
Joined: Tue Nov 17, 2015 12:00 am

Financial indicators in Javascript / HTML5

Post by g.todorov » Thu Jan 07, 2016 8:55 am

Hi,

Does teechart support financial indicators in Javascript / HTML5? I couldn't find any about this. If it's possible where I can find example to integrate it?

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Financial indicators in Javascript / HTML5

Post by Yeray » Thu Jan 07, 2016 11:25 am

Hello,

I'm afraid TeeChart Javascript/HTML5 doesn't include functions like the other versions.
However, you can always do the calculations from your main series and add the according points to an extra series manually.

Don't hesitate to let us know if you find any problem with that.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

g.todorov
Newbie
Newbie
Posts: 14
Joined: Tue Nov 17, 2015 12:00 am

Re: Financial indicators in Javascript / HTML5

Post by g.todorov » Fri Jan 08, 2016 1:36 pm

Thanks for your answer. May you apply an example how to integrate some of these Trend line, Bollinger, MACD?

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Financial indicators in Javascript / HTML5

Post by Yeray » Mon Jan 11, 2016 12:00 pm

Hello,

A simple example would be this kind of mean function:

Code: Select all

var Chart1;
	  
function draw() {
  Chart1=new Tee.Chart("canvas1");
  
  candle1 = new Tee.Candle();
  Chart1.addSeries(candle1);
  candle1.addRandom(20);
  
  msecsInADay=86400000; //24*60*60*1000
  candle1.data.x=new Array(candle1.count());
  var now=new Date(), tmp;
  for (t=0; t<candle1.count(); t++) {
	  tmp=new Date(now.getTime() + t * msecsInADay);
	  candle1.data.x[t] = tmp;
  }
  
  Chart1.legend.visible = false;
  
  myLineFunc1 = new MyLineFunc();
  Chart1.addSeries(myLineFunc1);
  myLineFunc1.data.source = candle1;
  myLineFunc1.fillFromDataSource();
  
  Chart1.draw();
}

MyLineFunc=function(o,o2) {
    Tee.Line.call(this,o,o2);
    
    this.fillFromDataSource=function() {
        if (this.data.source instanceof Tee.Series) {
            s = this.data.source;
            sum = s.data.close.reduce((a, b) => a + b, 0);  //sum of close values in the candle
            mean = sum / s.count();
            this.data.values = [mean, mean];
            this.data.x = [s.data.x[0], s.data.x[s.count()-1]];
        }
    }
}

MyLineFunc.prototype=new Tee.Line();
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

g.todorov
Newbie
Newbie
Posts: 14
Joined: Tue Nov 17, 2015 12:00 am

Re: Financial indicators in Javascript / HTML5

Post by g.todorov » Thu Jan 14, 2016 9:53 am

It will help us thanks a lot!

g.todorov
Newbie
Newbie
Posts: 14
Joined: Tue Nov 17, 2015 12:00 am

Re: Financial indicators in Javascript / HTML5

Post by g.todorov » Tue Mar 01, 2016 4:08 pm

Hi again,

we need from your help about the Bollinger Bands indicator
The bands are calculating from all data as is below:
BBAllData.png
BBAllData.png (83.86 KiB) Viewed 17868 times
but the lines are very curved now. We want to make lines more smooth and straight.
When try to use only one fifth part of all data we lost the lines as is below:
BB1.5Data.png
BB1.5Data.png (65.08 KiB) Viewed 17875 times
Please advice how can achieve it.

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Financial indicators in Javascript / HTML5

Post by Yeray » Wed Mar 02, 2016 9:04 am

Hello,

It's difficult to guess what are you exactly doing. Could you please arrange a simple example we can run as-is to reproduce the situation here? (note our Bug Fixing Policy).
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

g.todorov
Newbie
Newbie
Posts: 14
Joined: Tue Nov 17, 2015 12:00 am

Re: Financial indicators in Javascript / HTML5

Post by g.todorov » Fri Mar 11, 2016 1:24 pm

When were start to prepare a simple example in the meantime we found the mistake.
Sorry for the unnecessary post.

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Financial indicators in Javascript / HTML5

Post by Yeray » Fri Mar 11, 2016 2:53 pm

Hello,

I'm glad to hear it!
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply