Tick History

edited April 2016 in General

Hello all,

please help me.. i want create like image :

and my code like this :
function historyohlc(m,c,t){

ws = new WebSocket('wss://www.binary.com/websockets/v3');

ws.onopen = function() {
    ws.send(JSON.stringify({
      ticks_history: m,
      end: "latest",
      count: c,
      granularity: t,
      style: "candles"
    }));
}

ws.onmessage = function(msg){
  var history = {epoch:[],open:[],high:[],low:[],close:[]}; 
  var data = JSON.parse(msg.data);
  var info = "";

    for (var i=0; i < c; i++){
      if(data.candles){
        history.epoch[i]= new Date(data.candles[i].epoch*1000).toString().slice(16,24);
            history.low[i]= data.candles[i].low;
        history.close[i]= data.candles[i].close;

    }
    }

    for (var i=1; i <= c; i++){

        info+="<tr><td>"+history.epoch[c-i]+"</td><td> "+Number(history.close[c-i]).toFixed(4)+"</td><td></td><td>"+history.low[c-i]+"</td></tr>";

    }

    $('#historyresult').html(info);

      idepoch = "#"+m+"hisepoch";
      $(idepoch).html(history.epoch);

      idclose = "#"+m+"hisclose";
      $(idclose).html(history.close);



}

}

i want to create difference betwen spot price.. and arrow up and down inicator..

thank you

Comments

Sign In or Register to comment.