[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Calculation of System Quality Number (SQN)



PureBytes Links

Trading Reference Links



Try the following (based on Method 2 found here: http://www.easycalculation.com/statistics/learn-standard-deviation.php ).

Note that if you're trying to compare to Van Tharp, he uses the minimum of 100 and number of trades. Otherwise, use the number of trades as in your original post:

   for (trade = bo.getFirstTrade(); trade; trade = bo.getNextTrade()) { 
      R = ...; 

      trades++;
      sumR += R;
      sumR2 += R^
2
;
   }

   
if (trades > 0
) {
      expectancyR = sumR / trades;
      stdDevR =
sqrt((sumR2 - (sumR^2 / trades)) / (trades - 1
));
      SQN = ((expectancyR / stdDevR) *
sqrt(min
(100, trades)));
   }

Mike


--- In amibroker@xxxxxxxxxxxxxxx, "jeffarcherjr" <jeffarcherjr@xxx> wrote:
>
> Can anyone tell me how to calculate system quality number in a custom backtest proc?
>
> I understand the math and the formula
>
> SQN = (Expectancy/Standard Deviation R) - SqRoot(Number of trades)
>
> Where I'm stuck is how to calculate the Standard Deviation of R within a CustomBacktestProc?
>
> If this has been discussed before perhaps someone could point me to the post, but I've not found anything with searches of the message boards.
>
> Many Thanks
>
> Jeff
>



__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___