On the Aug 25th the CBOT exchange went down. As a result on my back test resulted in an erroneous open trade that doesnt ever get closed out. It resulted in an $2500 gain! Thats nice but, my strategy doesn't hold over night. I want to modify my script somehow to close that trade or anytrade that is open >1600. This is the code im using now. It didn't work because there were no candle prints at that time due to the exchage being down. My time template is 9-1600 and I need to leave it as that. Any ideas? What about using another candle from a different symbol or exchange to grab the time? (cpu intensive?) Thanks..
PHP Code:
// EXIT TRADES AT EOD
if(Time == 1559 && Strategy.isInTrade() && Strategy.isShort() ) {
AllowTrading = false;
Strategy.doCover( "EOD Exit Short", Strategy.CLOSE, Strategy.THISBAR, Strategy.ALL ); }
else if (Time == 1559 && Strategy.isInTrade() && Strategy.isLong() ) {
AllowTrading = false;
Strategy.doSell( "EOD Exit Long", Strategy.CLOSE, Strategy.THISBAR, Strategy.ALL); }
// END EOD EXIT CODE
Comment