Black Friday great discounts start today Learn more
+1 888 340 6572

Sharpe Demo

Article/Author: Origin: http://www.traders2traders.com. E-mail: Bob Fulks

Download: Sharpdmo.ela

File Includes:
Function - LastBarOnChart
Function - LastCalcDate
Function - LastCalcTime
Function - Sharpe Demo
Signal - Sharpe Demo
Strategy - Sharpe Demo

Category: Strategy > Sharpe Demo

Description:

Sample usage of the SharpeRatio function for futures trading. The InitValue variable should be equal to the total equity controlled, not the margin balance in the account.

Inputs:

NoOfCont - Number of contracts to trade
PrMode - Print mode

EasyLanguage Code:
INPUTS: 	NOOFCONT(2), 		{NUMBER OF CONTRACTS TO TRADE}

PRMODE(0); {PRINT MODE}

VARS: INITVALUE(0), {INITIAL VALUE OF TRADING ACCOUNT}
NETVALUE(0), {VALUE OF TRADING ACCOUNT OVER TIME}
SHARPE(0); {SHARPE RATIO}

{ESTABLISH VALUE FOR INITIAL ACCOUNT VALUE}
IF CURRENTBAR = 1 THEN
INITVALUE = CLOSE * BIGPOINTVALUE * NOOFCONT;

{SIMPLE TRADING SYSTEM}
IF CLOSE > CLOSE[1] THEN BUY NOOFCONT CONTRACTS NEXT BAR AT MARKET;
IF CLOSE < CLOSE[1] THEN EXITLONG NEXT BAR AT MARKET;

{CALCULATE SHARPE RATIO - USING MONTHLY SAMPLES}
NETVALUE = INITVALUE + NETPROFIT;
SHARPE = SHARPERATIO(4, NETVALUE, 0, PRMODE, TRUE);