I am wondering if someone could help with this problem which I have struggled with for a few days? I have several criteria that I am combining to then set a boolean variable which, in turn, is used in combination with other boolean variables to decide to doShort, doCover, doLong or doSell.
For example :-
// vSlowXAP Bearish colour change
if (vSlowXAP_Current < (vSlowXAP_Previous-vRangeDiff)) {
setBarFgColor(Color.red,1);
bSlowXAP_Bearish = true;
}
// vFastXAP Bearish colour change
if (vFastXAP_Current < (vFastXAP_Previous-vRangeDiff)) {
setBarFgColor(Color.red,0);
bFastXAP_Bearish = true;
}
When both booleans are set to true, I'd like the strategy to doShort or else to exit (doCover) to close the trade :-
if (bSlowXAP_Bearish == true && bFastXAP_Bearish == true) {
if (Strategy.isShort() == false) {
Strategy.doShort("XAP Short", Strategy.OPEN, Strategy.NEXTBAR);
}
} else {
if (Strategy.isShort() == true) {
Strategy.doCover("XAP Short Close", Strategy.OPEN, Strategy.NEXTBAR);
}
}
Quite simply this isn't generating any trades although the lines are set as the correct colour if I comment out the Strategy setting section.
Any help would be appreciated.
For example :-
// vSlowXAP Bearish colour change
if (vSlowXAP_Current < (vSlowXAP_Previous-vRangeDiff)) {
setBarFgColor(Color.red,1);
bSlowXAP_Bearish = true;
}
// vFastXAP Bearish colour change
if (vFastXAP_Current < (vFastXAP_Previous-vRangeDiff)) {
setBarFgColor(Color.red,0);
bFastXAP_Bearish = true;
}
When both booleans are set to true, I'd like the strategy to doShort or else to exit (doCover) to close the trade :-
if (bSlowXAP_Bearish == true && bFastXAP_Bearish == true) {
if (Strategy.isShort() == false) {
Strategy.doShort("XAP Short", Strategy.OPEN, Strategy.NEXTBAR);
}
} else {
if (Strategy.isShort() == true) {
Strategy.doCover("XAP Short Close", Strategy.OPEN, Strategy.NEXTBAR);
}
}
Quite simply this isn't generating any trades although the lines are set as the correct colour if I comment out the Strategy setting section.
Any help would be appreciated.
Comment