unable to set global variables of TesterStats within OnTester()
billworld:
Trying to get gvs of testerstats and the following is not working. Have also tried placing the code within Start() within an IsTesting() condition and still no go.
How do I retrieve TesterStatistics?
Nevermind, I'm getting what I want with the following:
double OnTester() { double PL = TesterStatistics(STAT_PROFIT); PL = NormalizeDouble(PL,2); double PF = TesterStatistics(STAT_PROFIT_FACTOR); PF = NormalizeDouble(PF,2); double NumTrades = TesterStatistics(STAT_TRADES); double PT = TesterStatistics(STAT_PROFIT_TRADES); double Win = 0; if(PT > 0) Win = PT / NumTrades; Win = NormalizeDouble(Win,2); double DD = TesterStatistics(STAT_BALANCEDD_PERCENT); DD = NormalizeDouble(DD,2); GlobalVariableSet("PL",PL); GlobalVariableSet("PF",PF); GlobalVariableSet("NumTrades",NumTrades); GlobalVariableSet("Win",Win); GlobalVariableSet("DD",DD); return(1); }
Would be helpful to retrieve other stats such as TestStartDate, TestEndDate, Win%, Spread, TotalLots and CommissionCosts (which would of course require a CommissionCost input param be added).
Trying to get gvs of testerstats and the following is not working. Have also tried placing the code within Start() within an IsTesting() condition and still no go.
How do I retrieve TesterStatistics?