Hello
I am working on developing an EFS that will identify a divergence condition, and once the condition is met, will monitor certain conditions until it changes:
In my code I am comparing the 1 minute and 2 minute Stochastics; When 1min and 2min have both been pointing UP, and the 2min turns down while the 1min is still up, this is my divergent condition; Then it will draw a purple colour on the chart;
var continueDown
var continueUP
var conditionAdv = (continueDown,continueUP);
if(((stochK(14,3,3,inv(1), -1) > stochD(14,3,3, inv(1), -1)) &&
(stochK(14,3,3,inv(2), -1) > stochD(14,3,3, inv(2), -1)) &&
(stochK(14,3,3,inv(1)) > stochD(14,3,3, inv(1))) &&
(stochK(14,3,3,inv(2)) < stochD(14,3,3, inv(2)))) &&
(conditionAdv == continueDown) ){
drawShapeRelative(0,BottomRow1,Shape.SQUARE,null,C olor.RGB(101,0,169),Shape.CENTER|Shape.PRESET,"DOW N " + getCurrentBarCount());
}
Once I have achieved my divergent condition, I want to be able to monitor only the 2min timeframe, as long as the 2min timeframe remains pointing down, I want the output color to remain purple.
If the 2min timeframe changes from down to up, at this point I want the output to change to blue.
else if((conditionAdv == continueDown) && (stochK(14,3,3,inv(2)) < stochD(14,3,3, inv(2)))) {
drawShapeRelative(0,BottomRow1,Shape.SQUARE,null,C olor.RGB(101,0,169),Shape.CENTER|Shape.PRESET,"DOW N " + getCurrentBarCount());
} else if((conditionAdv == continueDown) && (stochK(14,3,3,inv(2)) > stochD(14,3,3, inv(2)))) {
drawShapeRelative(0,BottomRow1,Shape.SQUARE,null,C olor.RGB(70,100,160),Shape.CENTER|Shape.PRESET,"DO WN " + getCurrentBarCount());
}
I have tried to setup a var to hold and remember the divergent condition, and once it has been met will remember this, but have not been able to make this work successfully.
Any tips or suggestions would be appreciate.
I am working on developing an EFS that will identify a divergence condition, and once the condition is met, will monitor certain conditions until it changes:
In my code I am comparing the 1 minute and 2 minute Stochastics; When 1min and 2min have both been pointing UP, and the 2min turns down while the 1min is still up, this is my divergent condition; Then it will draw a purple colour on the chart;
var continueDown
var continueUP
var conditionAdv = (continueDown,continueUP);
if(((stochK(14,3,3,inv(1), -1) > stochD(14,3,3, inv(1), -1)) &&
(stochK(14,3,3,inv(2), -1) > stochD(14,3,3, inv(2), -1)) &&
(stochK(14,3,3,inv(1)) > stochD(14,3,3, inv(1))) &&
(stochK(14,3,3,inv(2)) < stochD(14,3,3, inv(2)))) &&
(conditionAdv == continueDown) ){
drawShapeRelative(0,BottomRow1,Shape.SQUARE,null,C olor.RGB(101,0,169),Shape.CENTER|Shape.PRESET,"DOW N " + getCurrentBarCount());
}
Once I have achieved my divergent condition, I want to be able to monitor only the 2min timeframe, as long as the 2min timeframe remains pointing down, I want the output color to remain purple.
If the 2min timeframe changes from down to up, at this point I want the output to change to blue.
else if((conditionAdv == continueDown) && (stochK(14,3,3,inv(2)) < stochD(14,3,3, inv(2)))) {
drawShapeRelative(0,BottomRow1,Shape.SQUARE,null,C olor.RGB(101,0,169),Shape.CENTER|Shape.PRESET,"DOW N " + getCurrentBarCount());
} else if((conditionAdv == continueDown) && (stochK(14,3,3,inv(2)) > stochD(14,3,3, inv(2)))) {
drawShapeRelative(0,BottomRow1,Shape.SQUARE,null,C olor.RGB(70,100,160),Shape.CENTER|Shape.PRESET,"DO WN " + getCurrentBarCount());
}
I have tried to setup a var to hold and remember the divergent condition, and once it has been met will remember this, but have not been able to make this work successfully.
Any tips or suggestions would be appreciate.
Comment