Good morning,
I have tried to modify an efs already built on the forum international and I have jammed when I wanted that the parameters "lenght" and "offset" they were modifiable in edit studies.
Here under the script: who succeeds me in correcting the error or to explain how to do?
//{{EFSWizard_Description
//
// This formula was generated by the Alert Wizard
//
//}}EFSWizard_Description 7532
//{{EFSWizard_Declarations
var fp1 = new FunctionParameter("Length", FunctionParameter.NUMBER);
fp1.setLowerLimit(1);
fp1.setDefault(32); //Edit this value to set a new default
var fp2 = new FunctionParameter("Offset", FunctionParameter.NUMBER);
fp2.setDefault(-16); //Edit this value to set a new default
var vSMAhs = new MAStudy("Length", "Offset", "Close", MAStudy.SIMPLE);
var vSMA1 = new MAStudy(1, 0, "Close", MAStudy.SIMPLE);
var vLastAlert = -1;
//}}EFSWizard_Declarations 15636
function preMain() {
/**
* This function is called only once, before any of the bars are loaded.
* Place any study or EFS configuration commands here.
*/
//{{EFSWizard_PreMain
setPriceStudy(false);
setStudyTitle("Hurst Inverse");
setCursorLabelName("Hurst Inverse", 0);
setDefaultBarStyle(PS_SOLID, 0);
setDefaultBarFgColor(Color.red, 0);
setDefaultBarThickness(1, 0);
setPlotType(PLOTTYPE_HISTOGRAM, 0);
//}}EFSWizard_PreMain 28595
}
function main(Length,Offset) {
/**
* The main() function is called once per bar on all previous bars, once per
* each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
* in your preMain(), it is also called on every tick.
*/
//{{EFSWizard_Expressions
//{{EFSWizard_Expression_1
if (
vSMA27.getValue(MAStudy.MA) > 0
) onAction1();
//}}EFSWizard_Expression_1 8204
//}}EFSWizard_Expressions 18787
if(getBarState()==BARSTATE_NEWBAR){
var vDiff = vSMA1.getValue(MAStudy.MA,offset) -vSMAhs.getValue(MAStudy.MA,offset);
setBar(Bar.Value,offset,vDiff);
setBar(Bar.FgColor,offset,Color.RGB(155,0,0));
}
if (vSMA1.getValue(MAStudy.MA)==null||vSMAhs.getValue (MAStudy.MA)==null)
return;
//{{EFSWizard_Return
return vSMA1.getValue(MAStudy.MA) -vSMAhs.getValue(MAStudy.MA);
//}}EFSWizard_Return 5458
}
function postMain() {
/**
* The postMain() function is called only once, when the EFS is no longer used for
* the current symbol (ie, symbol change, chart closing, or application shutdown).
*/
}
//{{EFSWizard_Actions
//{{EFSWizard_Action_1
function onAction1() {
setBarFgColor(Color.RGB(155,0,0));
vLastAlert = 1;
}
//}}EFSWizard_Action_1 10981
//}}EFSWizard_Actions 20204
**************************************************
**
thx.
gigi
I have tried to modify an efs already built on the forum international and I have jammed when I wanted that the parameters "lenght" and "offset" they were modifiable in edit studies.
Here under the script: who succeeds me in correcting the error or to explain how to do?
//{{EFSWizard_Description
//
// This formula was generated by the Alert Wizard
//
//}}EFSWizard_Description 7532
//{{EFSWizard_Declarations
var fp1 = new FunctionParameter("Length", FunctionParameter.NUMBER);
fp1.setLowerLimit(1);
fp1.setDefault(32); //Edit this value to set a new default
var fp2 = new FunctionParameter("Offset", FunctionParameter.NUMBER);
fp2.setDefault(-16); //Edit this value to set a new default
var vSMAhs = new MAStudy("Length", "Offset", "Close", MAStudy.SIMPLE);
var vSMA1 = new MAStudy(1, 0, "Close", MAStudy.SIMPLE);
var vLastAlert = -1;
//}}EFSWizard_Declarations 15636
function preMain() {
/**
* This function is called only once, before any of the bars are loaded.
* Place any study or EFS configuration commands here.
*/
//{{EFSWizard_PreMain
setPriceStudy(false);
setStudyTitle("Hurst Inverse");
setCursorLabelName("Hurst Inverse", 0);
setDefaultBarStyle(PS_SOLID, 0);
setDefaultBarFgColor(Color.red, 0);
setDefaultBarThickness(1, 0);
setPlotType(PLOTTYPE_HISTOGRAM, 0);
//}}EFSWizard_PreMain 28595
}
function main(Length,Offset) {
/**
* The main() function is called once per bar on all previous bars, once per
* each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
* in your preMain(), it is also called on every tick.
*/
//{{EFSWizard_Expressions
//{{EFSWizard_Expression_1
if (
vSMA27.getValue(MAStudy.MA) > 0
) onAction1();
//}}EFSWizard_Expression_1 8204
//}}EFSWizard_Expressions 18787
if(getBarState()==BARSTATE_NEWBAR){
var vDiff = vSMA1.getValue(MAStudy.MA,offset) -vSMAhs.getValue(MAStudy.MA,offset);
setBar(Bar.Value,offset,vDiff);
setBar(Bar.FgColor,offset,Color.RGB(155,0,0));
}
if (vSMA1.getValue(MAStudy.MA)==null||vSMAhs.getValue (MAStudy.MA)==null)
return;
//{{EFSWizard_Return
return vSMA1.getValue(MAStudy.MA) -vSMAhs.getValue(MAStudy.MA);
//}}EFSWizard_Return 5458
}
function postMain() {
/**
* The postMain() function is called only once, when the EFS is no longer used for
* the current symbol (ie, symbol change, chart closing, or application shutdown).
*/
}
//{{EFSWizard_Actions
//{{EFSWizard_Action_1
function onAction1() {
setBarFgColor(Color.RGB(155,0,0));
vLastAlert = 1;
}
//}}EFSWizard_Action_1 10981
//}}EFSWizard_Actions 20204
**************************************************
**
thx.
gigi