/*********************************Provided By : eSignal. (c) Copyright 2003*********************************/function preMain() { setStudyTitle("Bid, Ask and Trade Size"); setShowCursorLabel(false);}var nBidSize = 0;var nBid = null;var nTradeSize = 0;var nTrade = null;var nAskSize = 0;var nAsk = null;function main() { if (getCurrentBarIndex() < 0 || getBuildNumber() < 606) return; nAsk = getMostRecentAsk(); nAskSize = getMostRecentAskSize(); nTrade = close(); nTradeSize = getMostRecentTradeSize(); nBid = getMostRecentBid(); nBidSize = getMostRecentBidSize(); if (nAsk == null || nAskSize == null || nTrade == null || nTradeSize == null || nBid == null || nBidSize == null) return; var barA = " "; // 20; var barT = " "; // 20; var barB = " "; // 20; var vColor = Color.white; var Total = 100; if (nTrade >= nAsk) vColor = Color.green; if (nTrade <= nBid) vColor = Color.red; var vSpacer = " "; var vTotal = nAskSize + nTradeSize + nBidSize; var vbarApercent = Math.round((nAskSize/vTotal)*100); var vbarTpercent = Math.round((nTradeSize/vTotal)*100); var vbarBpercent = Math.round((nBidSize/vTotal)*100); for (i = 0; i < 100; ++i) { if (vbarApercent >= i) barA += vSpacer; if (vbarTpercent >= i) barT += vSpacer; if (vbarBpercent >= i) barB += vSpacer; } // Relative Size Bars drawTextAbsolute(1, 16, barA, Color.green, Color.green, Text.BOLD|Text.BOTTOM|Text.RIGHT|Text.RELATIVETOBOTTOM, null, 10, "Ask bar"); drawTextAbsolute(1, 10, barT, Color.black, Color.black, Text.BOLD|Text.VCENTER|Text.RIGHT|Text.RELATIVETOBOTTOM, null, 10, "Trade bar"); drawTextAbsolute(1, 4, barB, Color.red, Color.red, Text.BOLD|Text.TOP|Text.RIGHT|Text.RELATIVETOBOTTOM, null, 10, "Bid bar"); // Size Labels drawTextAbsolute(0, 16, " A SIZE: " + nAskSize + " ", Color.white, Color.green, Text.ONTOP|Text.BOLD|Text.BOTTOM|Text.LEFT|Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT, null, 10, "Ask size"); drawTextAbsolute(0, 10, " T SIZE: " + nTradeSize + " ", vColor, Color.black, Text.ONTOP|Text.BOLD|Text.VCENTER|Text.LEFT|Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT, null, 10, "Trade size"); drawTextAbsolute(0, 4, " B SIZE: " + nBidSize + " ", Color.white, Color.red, Text.ONTOP|Text.BOLD|Text.TOP|Text.LEFT|Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT, null, 10, "Bid size"); // Price Labels drawTextAbsolute(1, 16, " A: " + nAsk.toFixed(4) + " ", Color.white, Color.green, Text.ONTOP|Text.BOLD|Text.BOTTOM|Text.RIGHT|Text.RELATIVETOBOTTOM, null, 10, "Ask"); drawTextAbsolute(1, 10, " T: " + nTrade.toFixed(4) + " ", vColor, Color.black, Text.ONTOP|Text.BOLD|Text.VCENTER|Text.RIGHT|Text.RELATIVETOBOTTOM, null, 10, "Trade"); drawTextAbsolute(1, 4, " B: " + nBid.toFixed(4) + " ", Color.white, Color.red, Text.ONTOP|Text.BOLD|Text.TOP|Text.RIGHT|Text.RELATIVETOBOTTOM, null, 10, "Bid"); return;} |