I have a main EFS but I have 2 versions of it -- one for LIVE trading and one for NON-LIVE trading (Bar Replay Mode). The only difference is really the trigger conditions. In live trading close(0) is a tick value wheras in non-live trading (backtesting) close(0) is the close of the bar, which for a big bar can be a big difference in triggger points. I Bar Relay mode I rig the trigger conditions to try to simulate live trading as closely as possible, but exact match is impossible.
In implementating your suggestions of saving the data inputs for all live signals, I have added code in my EFS to do this. Of course, to keep the 2 EFS as closesly identical as possible, I also include this code for the non-live version of the EFS, which is really not needed, since in non-live trading I do not have live signals.
But I figure it would be harmless to do that, and it was better for me to main as identical a file as possible between the two verisons.
But when I added this code to the non-live version, my non-live version was not working and was totally screwed up. It took me hours to figure out what was wrong. I noticed that nothing was being written to the History file (that kept the data inputs for signals) -- it was always 0 bytes. Ans then all code from this point on just did not work properly.
Below is a portion of my code:
Notice the line which is remarked out:
//a.writeln(rawtime(0) + "|" + "SystemExclamationBlue" + "|" + vAccEntry.getValue(0));
This was the problem. To get my non-live trading EFS to work properly I had to use this instead
a.writeln(rawtime(0) + "|" + "SystemExclamationBlue" + "|" + vAccEntry);
The ".getValue(0)" was messing this up in non-live, that is, Bar Replay Mode. Yet in live trading, it is needed.
Do you understand why this is the case?
In implementating your suggestions of saving the data inputs for all live signals, I have added code in my EFS to do this. Of course, to keep the 2 EFS as closesly identical as possible, I also include this code for the non-live version of the EFS, which is really not needed, since in non-live trading I do not have live signals.
But I figure it would be harmless to do that, and it was better for me to main as identical a file as possible between the two verisons.
But when I added this code to the non-live version, my non-live version was not working and was totally screwed up. It took me hours to figure out what was wrong. I noticed that nothing was being written to the History file (that kept the data inputs for signals) -- it was always 0 bytes. Ans then all code from this point on just did not work properly.
Below is a portion of my code:
PHP Code:
// ACCELERATED BUY
if ( !bNowLongAcc && vBUYAccelerationLine != null && vLow <= vBUYAccelerationLine && vHigh >= vBUYAccelerationLine ) { // use for NONLIVE trading
// if ( !bNowLongAcc && (vBUYAccelerationLine != null) && (vClose > vMainMA) && (vClose < vBUYAccelerationLine) ) { // use for LIVE trading
if(!bIsTRLongAcc) {
bIsTRLongAcc = true;
bIsTRShortAcc = false;
if (!bLIVE) {
vAccEntry = vBUYAccelerationLine; // use for NONLIVE trading!!
}
if (bLIVE) {
vAccEntry = vClose; // use for LIVE trading!!
}
vTRADECounter = vTRADECounter + 1;
vPrevBuyLevel = vLiveBuyLevel;
vLastSF = vTRADECounter;
drawImageRelative(0, vAccEntry, "SystemExclamationBlue", null, Image.RIGHT | Image.ONTOP, "SF" + vTRADECounter);
if (bSAVEIT) {
var a = new File(vHistoryFile + ".txt"); //the file will be created in: eSignal/FormulaOutput/
a.open("at+"); // Opens and overwrites the file
if(!a.isOpen()) {
// debugPrintln("Could not open file!");
}
else {
// a.writeln(rawtime(0) + "|" + "SystemExclamationBlue" + "|" + vAccEntry.getValue(0));
a.writeln(rawtime(0) + "|" + "SystemExclamationBlue" + "|" + vAccEntry);
}
a.close();
}
Alert.playSound(vSFACCBuy);
etc,. etc. .....
//a.writeln(rawtime(0) + "|" + "SystemExclamationBlue" + "|" + vAccEntry.getValue(0));
This was the problem. To get my non-live trading EFS to work properly I had to use this instead
a.writeln(rawtime(0) + "|" + "SystemExclamationBlue" + "|" + vAccEntry);
The ".getValue(0)" was messing this up in non-live, that is, Bar Replay Mode. Yet in live trading, it is needed.
Do you understand why this is the case?
Comment