I am running a simple script to pump out the current time (mm:ss) and last trade price of ES #F in a 3-minute advanced chart. However, the "main" function appears to only execute when the last traded price is DIFFERENT from the previous last traded price (or when a new time bar starts to paint). This seems inconsistent with my understanding that "main" is supposed to be executed at every tick.
I need the have the script run at EVERY trade, even if it is at the same price at which it previously traded. And I need it to be done in minute charts (eg, 5-min chart), not in a Tick chart. Can anyone help me with this?
Thanks,
Mikey
Here's the EFS I'm running:
I need the have the script run at EVERY trade, even if it is at the same price at which it previously traded. And I need it to be done in minute charts (eg, 5-min chart), not in a Tick chart. Can anyone help me with this?
Thanks,
Mikey
Here's the EFS I'm running:
PHP Code:
function preMain() {
debugPrintln("Tic Test...");
}
function main() {
if( getCurrentBarIndex() == 0 ) {
debugPrintln("CurrTime=" + getCurrTime() + ", P="+close());
}
}
function getCurrTime() {
var m = getMinute();
var s = getSecond();
var objDate = new Date();
var dm = objDate.getMinutes();
var ds = objDate.getSeconds();
return ((dm < 10) ? "0" : "") + dm + ":" + ((ds < 10) ? "0" : "") + ds;
}
Comment