I would like to create an EFS study to plot total number of trades per bar. I've seen the BidAskVolume study but that plots volumes. I just want an indicator that plots total # of trades for each bar. Ideas? Thanks!
Announcement
Collapse
No announcement yet.
Tick Volume (trades per bar)
Collapse
X
-
Hello TBond,
Since EFS formulas execute on each trade (except for ES and NQ) you can create a global variable and increment it's value by one with each execution. Check for the instance of each new bar and reset the variable back to 0. See the code example below. Also note that this data can only be collected in real time, so I added a check for bar index which exits main until the formula is loaded and only allows main() to complete in real time, or when the current bar index equals 0.
PHP Code:function preMain() {
setStudyTitle("Count trades ");
setPlotType(PLOTTYPE_HISTOGRAM);
setCursorLabelName("Trades", 0);
setDefaultBarThickness(3, 0);
}
var cntr = 0;
function main() {
if (getCurrentBarIndex() != 0) return;
if (getBarState() == BARSTATE_NEWBAR) {
cntr = 0;
}
cntr += 1;
debugPrintln(cntr + " " + getMostRecentTradeSize());
return cntr;
}
Jason K.
Project Manager
eSignal - an Interactive Data company
EFS KnowledgeBase
JavaScript for EFS Video Series
EFS Beginner Tutorial Series
EFS Glossary
Custom EFS Development Policy
New User Orientation
-
Hello Bob,
From my testing of this problem on ES and NQ, I'm basically seeing two conditions that cause an execution of the EFS.
1.) Current trade price is different than the previous trade price.
2.) Current trade price is at the bid and previous trade price was at the ask and vise versa. The two trade prices can be the same price in this instance.
The trades that are being skipped are subsequent trades that are at the same price and all are trades at the bid or vise versa. For example, if we have a string of 10 trades and trade 1 was 1125 at the ask and trade 2 was 1125 but at the bid (bid/ask changes between trades), the EFS will execute on trade 2. If trades 3-10 are all at 1125 and at the current bid, EFS skips these trades.
Our development team is aware of this behavior. I don't have any information as to if or when this problem can be fixed. The best place to ask would be the 7 Series Beta forum.Jason K.
Project Manager
eSignal - an Interactive Data company
EFS KnowledgeBase
JavaScript for EFS Video Series
EFS Beginner Tutorial Series
EFS Glossary
Custom EFS Development Policy
New User Orientation
Comment
-
Tick Volume (trades per bar)
Jason,
Thanks for the feedback. When we last exchanged posts on this back in mid November, you suggested I email IDEAS which I did on Nov. 17th but never heard back from them which is not to say that my concern didn't register, just that I don't know where things stand. Is the Beta Forum a better place to get some more dialog going on this?
Thanks,
Bob
Comment
-
Yes, the 7 Series Beta forum.Jason K.
Project Manager
eSignal - an Interactive Data company
EFS KnowledgeBase
JavaScript for EFS Video Series
EFS Beginner Tutorial Series
EFS Glossary
Custom EFS Development Policy
New User Orientation
Comment
Comment