1 registered members (AndrewAMD),
946
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Z5
[Re: jcl]
#437793
02/26/14 09:06
02/26/14 09:06
|
Joined: Sep 2013
Posts: 73
Mangal
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2013
Posts: 73
|
I get it. So it should be ExitTime = 2
Last edited by Mangal; 02/26/14 09:08.
|
|
|
Re: Z5
[Re: Mangal]
#437978
03/04/14 04:14
03/04/14 04:14
|
Joined: Sep 2013
Posts: 73
Mangal
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2013
Posts: 73
|
I am trying a multitimeframe strategy and it doesn't work. Anyone can tell me where is the mistake in the following script?
function trenta() { TimeFrame = 1;
vars A1 = series(priceHigh(2)); vars A2 = series(priceHigh(1)); vars A3 = series(price(0)); var percentage = 0.001; var VlrH; VlrH = A1[0] * percentage;
if (A1[0] < A2[0] and A3[0] < A1[0]-VlrH) enterLong(); if (A1[0] > A2[0] and A3[0] > A1[0]+VlrH) enterShort();
vars B1 = series(priceLow(2)); vars B2 = series(priceLow(1)); vars B3 = series(price(0)); var percentage = 0.001; var VlrL; VlrL = B1[0] * percentage;
if (B1[0] < B2[0] and B3[0] < B1[0]-VlrL) enterLong(); if (A1[0] > A2[0] and A3[0] > A1[0]+VlrL) enterShort();
Stop = optimize(30,20,200)*PIP; TakeProfit = optimize(500,150,700)*PIP; ExitTime = 25;
} function doscents() { TimeFrame = 8;
vars A1 = series(priceHigh(2)); vars A2 = series(priceHigh(1)); vars A3 = series(price(0)); var percentage = 0.001; var VlrH; VlrH = A1[0] * percentage;
if (A1[0] < A2[0] and A3[0] < A1[0]-VlrH) enterLong(); if (A1[0] > A2[0] and A3[0] > A1[0]+VlrH) enterShort();
vars B1 = series(priceLow(2)); vars B2 = series(priceLow(1)); vars B3 = series(price(0)); var percentage = 0.001; var VlrL; VlrL = B1[0] * percentage;
if (B1[0] < B2[0] and B3[0] < B1[0]-VlrL) enterLong(); if (A1[0] > A2[0] and A3[0] > A1[0]+VlrL) enterShort();
Stop = optimize(30,20,200)*PIP; TakeProfit = optimize(500,150,700)*PIP; ExitTime = 10;
} function run() { set (PARAMETERS); BarPeriod = 30; StartDate = 2011; EndDate = 2013; function trenta(); function doscents(); NumWFOCycles = 3; }
The two functions used, individually they run fine but when trying to run them together, don't work.
|
|
|
Re: Z5
[Re: jcl]
#438072
03/06/14 10:58
03/06/14 10:58
|
Joined: Sep 2013
Posts: 73
Mangal
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2013
Posts: 73
|
Sorry, jcl, I don't pick it up. Even if I cancel all B functions keeps without compiling. I put now the stop loss and target in front and paréntesis to separate. Is it now that the A functions for one Time Frame interfer with the A functions of the other TimeFrame?
function trenta() { Stop = optimize(30,20,200)*PIP; TakeProfit = optimize(500,150,700)*PIP; ExitTime = 25; TimeFrame = 1; { vars A1 = series(priceHigh(2)); vars A2 = series(priceHigh(1)); vars A3 = series(price(0)); var percentage = 0.001; var VlrH; VlrH = A1[0] * percentage;
if (A1[0] < A2[0] and A3[0] < A1[0]-VlrH) enterLong(); if (A1[0] > A2[0] and A3[0] > A1[0]+VlrH) enterShort(); } { //vars B1 = series(priceLow(2)); //vars B2 = series(priceLow(1)); //vars B3 = series(price(0)); //var percentage = 0.001; //var VlrL; //VlrL = B1[0] * percentage;
//if (B1[0] < B2[0] and B3[0] < B1[0]-VlrL) enterLong(); //if (B1[0] > B2[0] and B3[0] > B1[0]+VlrL) enterShort();
}
} function doscents() { Stop = optimize(30,20,200)*PIP; TakeProfit = optimize(500,150,700)*PIP; ExitTime = 10; TimeFrame = 8; {
vars A1 = series(priceHigh(2)); vars A2 = series(priceHigh(1)); vars A3 = series(price(0)); var percentage = 0.001; var VlrH; VlrH = A1[0] * percentage;
if (A1[0] < A2[0] and A3[0] < A1[0]-VlrH) enterLong(); if (A1[0] > A2[0] and A3[0] > A1[0]+VlrH) enterShort(); }
{ //vars B1 = series(priceLow(2)); //vars B2 = series(priceLow(1)); //vars B3 = series(price(0)); //var percentage = 0.001; //var VlrL; //VlrL = B1[0] * percentage;
//if (B1[0] < B2[0] and B3[0] < B1[0]-VlrL) enterLong(); //if (B1[0] > B2[0] and B3[0] > B1[0]+VlrL) enterShort(); }
} function run() { set(PARAMETERS); BarPeriod = 30; StartDate = 2011; EndDate = 2013; function trenta(); function doscents(); NumWFOCycles = 3; }
When training it gives:
A1,A2,A3 Multitime trialF compiling................ WFO: A1,A2,A3 Multitime trialF 2011..2013
|
|
|
Re: Z5
[Re: Mangal]
#438073
03/06/14 11:09
03/06/14 11:09
|
Joined: Jul 2013
Posts: 522
dusktrader
User
|
User
Joined: Jul 2013
Posts: 522
|
Inside your run() function, I believe it's a syntax error to use the word "function" ... just get rid of that and then it will complete the Test. Like this:
function run()
{
set(PARAMETERS);
BarPeriod = 30;
StartDate = 2011;
EndDate = 2013;
trenta();
doscents();
NumWFOCycles = 3;
}
|
|
|
Re: Z5
[Re: Mangal]
#442618
06/26/14 21:24
06/26/14 21:24
|
Joined: Sep 2013
Posts: 73
Mangal
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2013
Posts: 73
|
I wouldn't put money on the following script because it gives negative results in different periods of time than 2011-2013. However for the sake to know if there is some mistake since it gives CAGR 3174%, can anyone have a look and see if there is mistake?
#include <profile.c> function run()
{
BarPeriod = 60; Stop = optimize(30,20,200)*PIP; TakeProfit = optimize(500,150,700)*PIP; ExitTime = 25; NumWFOCycles = 4; set(PARAMETERS+FACTORS); Capital = 500; StartDate = 2011; EndDate = 2013; set(LOGFILE); plotTradeProfile(-100);
vars A1 = series(priceHigh(2)); vars A2 = series(priceHigh(1)); vars A3 = series(price(0)); var percentage = 0.001; var Vlr; Vlr = A1[0] * percentage;
Margin = OptimalF * Capital * sqrt(1 + ProfitClosed/Capital); if (A1[0] < A2[0] and A3[0] < A1[0]-Vlr) enterLong(); if (A1[0] > A2[0] and A3[0] > A1[0]+Vlr) enterShort();
vars B1 = series(priceLow(2)); vars B2 = series(priceLow(1)); vars B3 = series(price(0)); var percentage = 0.001; var Vlr; Vlr = B1[0] * percentage;
//if (B1[0] < B2[0] and B3[0] < B1[0]-Vlr) enterLong(); //if (A1[0] > A2[0] and A3[0] > A1[0]+Vlr) enterShort();
}
------------------------------------------------------ It gives the following result with two degres of freedom:
Read A1,2,3 60'_EURUSD_1.par A1,2,3 60'_EURUSD_2.par A1,2,3 60'_EURUSD_3.par Factors stored in A1,2,3 60'_EURUSD.fac
A1,2,3 60' run.. Walk-Forward Test: A1,2,3 60' EUR/USD 2011..2013 Read A1,2,3 60'_EURUSD.fac A1,2,3 60'_EURUSD_1.par A1,2,3 60'_EURUSD_2.par A1,2,3 60'_EURUSD_3.par Monte Carlo Analysis... Median AR 168% Profit 18772$ MI 1494$ DD 5127$ Capital 2719$ Trades 326 Win 60% Avg +801.8p Bars 21 CAGR 3174% PF 1.53 SR 2.10 UI 11% R2 0.69 ok Generate Chart - please wait... ok
|
|
|
|