I've been troubleshooting this peice of codes for a couple days and I still don't understand whether this is a bug from eSignal EFS or not.
Basically I have variable gsYourPosition = "NEUTRAL".
In main(), I use Alert.eMail(..,gsYourPosition,..) and I get all the time gsYourPosition = "SHORT"
Can somebody see what is wrong?
Have you encountered this type of problem?
Thanks.
Here is the code:
// This variable can take following values: LONG, SHORT, NEUTRAL
var gcLONG = "LONG";
var gcSHORT = "SHORT";
var gcNEUTRAL = "NEUTRAL";
var gsYourPosition = gcNEUTRAL;
//Declarations
function preMain() {
//main() will be executed only after the bar complete or close
setComputeOnClose();
setPriceStudy(true);
setStudyTitle("TEST 1.0");
}
function main() {
var sTrend = gcSHORT;
Alert.email("Before if... "+ gsYourPosition+ "Trend " +sTrend, close());
//Why gsYourPosition is equal to "SHORT" at this step??????
//If you haven't taken any position yet and the trend is DOWN (SHORT)
if (sTrend == gcSHORT) {
if (gsYourPosition == gcNEUTRAL) {
Alert.email("TEST 1.0 - Get in SHORT position now (SELL).", close());
gsYourPosition = gcSHORT;
}
}
}
Basically I have variable gsYourPosition = "NEUTRAL".
In main(), I use Alert.eMail(..,gsYourPosition,..) and I get all the time gsYourPosition = "SHORT"
Can somebody see what is wrong?
Have you encountered this type of problem?
Thanks.
Here is the code:
// This variable can take following values: LONG, SHORT, NEUTRAL
var gcLONG = "LONG";
var gcSHORT = "SHORT";
var gcNEUTRAL = "NEUTRAL";
var gsYourPosition = gcNEUTRAL;
//Declarations
function preMain() {
//main() will be executed only after the bar complete or close
setComputeOnClose();
setPriceStudy(true);
setStudyTitle("TEST 1.0");
}
function main() {
var sTrend = gcSHORT;
Alert.email("Before if... "+ gsYourPosition+ "Trend " +sTrend, close());
//Why gsYourPosition is equal to "SHORT" at this step??????
//If you haven't taken any position yet and the trend is DOWN (SHORT)
if (sTrend == gcSHORT) {
if (gsYourPosition == gcNEUTRAL) {
Alert.email("TEST 1.0 - Get in SHORT position now (SELL).", close());
gsYourPosition = gcSHORT;
}
}
}
Comment