I am new to eSignal and have spent the better part of the past couple of days trying to come up with a solution for what I want to build. I have searched through this message board and have learned a lot, but can't seem to get the following problem figured out.
I am trying to modify the AccDist study with similar behavior as the "RSI ColorLine Bar" study, except rather than having the bars colored below 30 and above 70, I would like the AccDist line to be colored when the study reaches either a new high for the day (green) or a new low for the day (red). Ultimately, I would love to then tie this into price action and build my own alert. But, first things first. I typically use either 3 or 5 minute bar charts during the day.
Below is my code. When I actually deploy this, I am not getting the desired results at all. Any ideas or suggestions would be greatly appreciated (even debugging suggestions).
Thanks in advance for any assistance that is given!
I am trying to modify the AccDist study with similar behavior as the "RSI ColorLine Bar" study, except rather than having the bars colored below 30 and above 70, I would like the AccDist line to be colored when the study reaches either a new high for the day (green) or a new low for the day (red). Ultimately, I would love to then tie this into price action and build my own alert. But, first things first. I typically use either 3 or 5 minute bar charts during the day.
Below is my code. When I actually deploy this, I am not getting the desired results at all. Any ideas or suggestions would be greatly appreciated (even debugging suggestions).
Thanks in advance for any assistance that is given!
PHP Code:
// AccDistHighLow.efs
var study = new AccDistStudy();
var bInit = false;
var vHighAD = null;
var vLowAD = null;
var vAccDistValue = null;
function preMain() {
}
function main() {
if (bInit == false) {
vAccDistValue = study.getValue(AccDistStudy.ACCDIST);
vHighAD = highest(inv("D"),study);
vLowAD = lowest(inv("D"),study);
bInit == true;
}
if (vAccDistValue > vHighAD.getValue(-1)) {
setBarStyle(PS_SOLID);
setBarThickness(2);
setBarFgColor(Color.black);
setBarBgColor(Color.lime);
} else if (vAccDistValue < vLowAD.getValue(-1)) {
setBarStyle(PS_SOLID);
setBarThickness(2);
setBarFgColor(Color.black);
setBarBgColor(Color.red);
}
return (vAccDistValue);
}
Comment