Posted By: Mithrandir77
BUG when using msgs in EXITRUN, giving more AR and Sharpe Ratio? - 07/12/15 03:27
I think I found an strange bug, if I run this code:
Zorro runs but apparently it hangs in Cycles 1 to 4, then I see the progress of Cycle 5 and I get this result:
but if I comment out these lines:
I see Zorro progressing through the 5 cycles and I get this result:
Code:
function MAMA1_Strat(var fastLimit,var slowLimit) { BarPeriod = 480; vars Price = series(price()); Stop = 2*ATR(100); MAMA(Price,fastLimit,slowLimit); vars MAMAs = series(rMAMA); vars FAMAs = series(rFAMA); if( crossUnder(FAMAs,MAMAs) ){ reverseShort(1); } else if( crossOver(FAMAs,MAMAs) ) { reverseLong(1); } plot("price",Price[0],MAIN|LINE,BLACK); plot("Mama",MAMAs,LINE,RED); plot("Fama",FAMAs,LINE,BLUE); } function run() { StartDate = 2009;//2003 EndDate = 2014;//2008 NumSampleCycles = 5; MAMA1_Strat(0.05,0.5); //MAMA2_Strat(0.05,0.5); //Shannon1_Strat(); //Shannon2_Strat(); static var maeLosingTrades = 0; static var maeWinningTrades = 0; for(all_trades){ if (TradeIsClosed) if (TradeProfit < 0 and TradeMAE > maeLosingTrades) maeLosingTrades = TradeMAE / PIP; else if (TradeProfit >= 0 and TradeMAE > maeWinningTrades) maeWinningTrades = TradeMAE / PIP; } set(LOGFILE); // log all trades if (is(EXITRUN) and SampleCycle = 5){ msg("maeLosingTrades: %f",maeLosingTrades); msg("maeWinningTrades: %f",maeWinningTrades); } }
Zorro runs but apparently it hangs in Cycles 1 to 4, then I see the progress of Cycle 5 and I get this result:
but if I comment out these lines:
Code:
if (is(EXITRUN) and SampleCycle = 5){ msg("maeLosingTrades: %f",maeLosingTrades); msg("maeWinningTrades: %f",maeWinningTrades); }
I see Zorro progressing through the 5 cycles and I get this result: