Below is my efs made with the wizard:
The problem is that the condition I'm looking for can NEVER be met as long as the values are provided in a decimal form.
All I want to compare in the condition is the value LEFT of the decimal point. (just the whole number)
Example:
Navy = 93.55
Goat = 93.64
Navy2 = 93.71
I want the the efs to give me a yellow background when all 3 whole numbers (93) are equal and disregard the fractional part to the right of the decimal point.
The ideal condition would be if all 3 were within a half point of each other (highest value minus lowest value <= 0.50 and remaining value between the high and low value) but all 3 whole numbers equal is OK for my purpose.
I hope someone can advise me on how to do this.
Thanks,
OpaBert
[email protected]
//{{EFSWizard_Description
//
// This formula was generated by the Alert Wizard
//
//}}EFSWizard_Description 7532
//{{EFSWizard_Declarations
var vSMA5 = new MAStudy(5, 0, "Close", MAStudy.SIMPLE);
var vSMA30 = new MAStudy(30, 0, "Close", MAStudy.SIMPLE);
var vSMA10_of_vSMA30 = new MAStudy(10, 0, vSMA30, MAStudy.MA, MAStudy.SIMPLE);
var vSMA5_of_vSMA5 = new MAStudy(5, 0, vSMA5, MAStudy.MA, MAStudy.SIMPLE);
var vEMA30 = new MAStudy(30, 0, "Close", MAStudy.EXPONENTIAL);
var vSMA10_of_High = new MAStudy(10, 0, "High", MAStudy.SIMPLE);
var vSMA10_of_Low = new MAStudy(10, 0, "Low", MAStudy.SIMPLE);
var vLastAlert = -1;
//}}EFSWizard_Declarations 59283
function preMain() {
setComputeOnClose(true);
/**
* This function is called only once, before any of the bars are loaded.
* Place any study or EFS configuration commands here.
*/
//{{EFSWizard_PreMain
setComputeOnClose(true);
setPriceStudy(true);
setStudyTitle("NavyBG3");
setCursorLabelName("Navy", 0);
setCursorLabelName("Goat", 1);
setCursorLabelName("Navy2", 2);
setDefaultBarStyle(PS_SOLID, 0);
setDefaultBarStyle(PS_SOLID, 1);
setDefaultBarStyle(PS_SOLID, 2);
setDefaultBarFgColor(Color.navy, 0);
setDefaultBarFgColor(Color.magenta, 1);
setDefaultBarFgColor(Color.red, 2);
setDefaultBarThickness(3, 0);
setDefaultBarThickness(3, 1);
setDefaultBarThickness(2, 2);
setPlotType(PLOTTYPE_LINE, 0);
setPlotType(PLOTTYPE_LINE, 1);
setPlotType(PLOTTYPE_LINE, 2);
//}}EFSWizard_PreMain 74754
}
function main() {
/**
* 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 (
vSMA10_of_vSMA30.getValue(MAStudy.MA) == vSMA5_of_vSMA5.getValue(MAStudy.MA) &&
vSMA10_of_vSMA30.getValue(MAStudy.MA) == vEMA30.getValue(MAStudy.MA)
) onAction1();
//}}EFSWizard_Expression_1 22898
//}}EFSWizard_Expressions 34020
//{{EFSWizard_Return
return new Array(
vSMA10_of_vSMA30.getValue(MAStudy.MA),
vSMA5_of_vSMA5.getValue(MAStudy.MA),
vEMA30.getValue(MAStudy.MA)
);
//}}EFSWizard_Return 17893
}
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() {
setBarBgColor(Color.RGB(255,255,0));
vLastAlert = 1;
}
//}}EFSWizard_Action_1 10615
//}}EFSWizard_Actions 19508
The problem is that the condition I'm looking for can NEVER be met as long as the values are provided in a decimal form.
All I want to compare in the condition is the value LEFT of the decimal point. (just the whole number)
Example:
Navy = 93.55
Goat = 93.64
Navy2 = 93.71
I want the the efs to give me a yellow background when all 3 whole numbers (93) are equal and disregard the fractional part to the right of the decimal point.
The ideal condition would be if all 3 were within a half point of each other (highest value minus lowest value <= 0.50 and remaining value between the high and low value) but all 3 whole numbers equal is OK for my purpose.
I hope someone can advise me on how to do this.
Thanks,
OpaBert
[email protected]
//{{EFSWizard_Description
//
// This formula was generated by the Alert Wizard
//
//}}EFSWizard_Description 7532
//{{EFSWizard_Declarations
var vSMA5 = new MAStudy(5, 0, "Close", MAStudy.SIMPLE);
var vSMA30 = new MAStudy(30, 0, "Close", MAStudy.SIMPLE);
var vSMA10_of_vSMA30 = new MAStudy(10, 0, vSMA30, MAStudy.MA, MAStudy.SIMPLE);
var vSMA5_of_vSMA5 = new MAStudy(5, 0, vSMA5, MAStudy.MA, MAStudy.SIMPLE);
var vEMA30 = new MAStudy(30, 0, "Close", MAStudy.EXPONENTIAL);
var vSMA10_of_High = new MAStudy(10, 0, "High", MAStudy.SIMPLE);
var vSMA10_of_Low = new MAStudy(10, 0, "Low", MAStudy.SIMPLE);
var vLastAlert = -1;
//}}EFSWizard_Declarations 59283
function preMain() {
setComputeOnClose(true);
/**
* This function is called only once, before any of the bars are loaded.
* Place any study or EFS configuration commands here.
*/
//{{EFSWizard_PreMain
setComputeOnClose(true);
setPriceStudy(true);
setStudyTitle("NavyBG3");
setCursorLabelName("Navy", 0);
setCursorLabelName("Goat", 1);
setCursorLabelName("Navy2", 2);
setDefaultBarStyle(PS_SOLID, 0);
setDefaultBarStyle(PS_SOLID, 1);
setDefaultBarStyle(PS_SOLID, 2);
setDefaultBarFgColor(Color.navy, 0);
setDefaultBarFgColor(Color.magenta, 1);
setDefaultBarFgColor(Color.red, 2);
setDefaultBarThickness(3, 0);
setDefaultBarThickness(3, 1);
setDefaultBarThickness(2, 2);
setPlotType(PLOTTYPE_LINE, 0);
setPlotType(PLOTTYPE_LINE, 1);
setPlotType(PLOTTYPE_LINE, 2);
//}}EFSWizard_PreMain 74754
}
function main() {
/**
* 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 (
vSMA10_of_vSMA30.getValue(MAStudy.MA) == vSMA5_of_vSMA5.getValue(MAStudy.MA) &&
vSMA10_of_vSMA30.getValue(MAStudy.MA) == vEMA30.getValue(MAStudy.MA)
) onAction1();
//}}EFSWizard_Expression_1 22898
//}}EFSWizard_Expressions 34020
//{{EFSWizard_Return
return new Array(
vSMA10_of_vSMA30.getValue(MAStudy.MA),
vSMA5_of_vSMA5.getValue(MAStudy.MA),
vEMA30.getValue(MAStudy.MA)
);
//}}EFSWizard_Return 17893
}
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() {
setBarBgColor(Color.RGB(255,255,0));
vLastAlert = 1;
}
//}}EFSWizard_Action_1 10615
//}}EFSWizard_Actions 19508
Comment