
Alexis C. Montenegro

Registered: Oct 2002
Location:
Posts: 18052
Status: OFFLINE
|
|

shaeffer
Add a boolean FunctionParameter called for example "Test", set it to true by default and add the parameter to the arguments of main. Then enclose the entire section of code
if(getBarState()==BARSTATE_ALLBARS){
...
if (bCurrentDay==false){
return;
}
in a conditional statement that checks if Test is true.
When the Test parameter is set to false that entire section of code will not be executed thereby returning the plots also on previous days
Alex
| quote: | Originally posted by shaeffer
Hello,
I've been using the script below to view just todays efs data while the chart above it displays multi-days of price data. Sometimes however I want to view multi-days of efs data also. I've been trying to use Formula Parameters so I can easily 'bypass' the script below via Edit Studies, but am having no luck. I am hoping someone knows of an efs where this has been done. Or maybe there is an easier way?
Any help would be appreciated
Thanks
shaeffer
function preMain() {
var bCurrentDay = false;
function main() {
if(getBarState()==BARSTATE_ALLBARS){
bCurrentDay=false;
}
if (bCurrentDay == false && getDay(0) != getDay(-1)){
var xTime = getValue("time");
var xDate = new Date();
var sTime = (xTime.getMonth()+1+"/"+xTime.getDate()+"/"+xTime.getFullYear());
var sToday = (xDate.getMonth()+1+"/"+xDate.getDate()+"/"+xDate.getFullYear());
if ( sTime == sToday ) {
bCurrentDay = true;
}
}
if (bCurrentDay==false){
return;
} |
|