My strategy that I like to optimise has multiple parameters. Two of them are profit amount and stoploss amount.
For risk control I am only interested in scenarios where the value (profit amount/stoploss amount) is minimal of 2 or higher. Is it possible to use custom criteria or custom fitness value to exclude all the scenarios with a lower value of 2 out of the optimizing in advance. So I can speed up the optimizing.
Example: profitamount 2000, then only optimize the scenarios that have a stoploss amount of 1000 and less. There is no need to optimize all values above 1000 so save time.
Is this possible?
Exclude possible scenarios with optimizing
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Exclude possible scenarios with optimizing
Hello Evdl,
Unfortunately that is not currently possible.
Unfortunately that is not currently possible.
Re: Exclude possible scenarios with optimizing
I see a solution with implementation of your rule in the code only .... like this :
Then you can optimize input (pt) and (f) from your wished starting point ..... I was not testing it because I'm not sitting right infront of my MC. So would be nice to hear from you it helped ot not. May the optimization for (pt) and (f) will erase any advantage. So you have to implement your exit strategy with setprofittarget(pt) and setstoploss(sl). Just test it. From my standpoint both are not very accurate. So we may would have to re-write it for ticks or something else. It's just an idea for a direction to go.
Mike
Code: Select all
input : pt(1000); // pt = profit target
input : f(2); // divide the profit target for the stop loss by the factor (f)
input : tv(10); // tick value
var : sl(0); // sl = stop loss
var : r(0); // check var for result sl <= pt divided by f
sl = pt / f; // calculate the stop loss
r = pt / sl; // re-check pt / sl is >= f
// begin your trading rule if r is >= 2 only
if r >= 2 and sl > tv then
begin ......
// your trading rule
end;
Mike
-
- Posts: 401
- Joined: 19 Jan 2011
- Location: Netherlands
- Has thanked: 85 times
- Been thanked: 125 times
Re: Exclude possible scenarios with optimizing
I will try this the upcoming week. Have to see if the optimization of the riskreward (f) is less of an impact then the optimization of the stoploss and profit target.
thanks for the suggestion and idea and I will post the outcome here.
thanks for the suggestion and idea and I will post the outcome here.
-
- Posts: 401
- Joined: 19 Jan 2011
- Location: Netherlands
- Has thanked: 85 times
- Been thanked: 125 times
Re: Exclude possible scenarios with optimizing
Hi Mike,
Just did the optimized test with the rewrited code. With the optimizing of the riskreward with values between 2 and 3 (steps of 0.25). It will take about 27% less time to optimize.
With the old code it has 16954 simulations and now with the new code 12403. (33 hours instead of now 24 hours). This is just a test, I have to decrease parameters to get better optimizing.
For my strategy it works to have riskreward between 2 and 3. So for me it works. You can ofcourse make the steps bigger and gain extra time decrease or change the interval to 3 and 4 for example.
The stoploss in my strategy is calculated like this:
Stoploss = (profittargetAmt/RiskRewardAmt)/StockAmt;
And the stoploss is applied like this:
Stoploss_Fixed_Long = round2fraction(AvgEntryprice - Stoploss);
Sell ("StopLossLong") next bar Stoploss_Fixed_Long stop;
Stoploss_Fixed_Short = round2fraction(AvgEntryprice + Stoploss);
Buytocover ("StopLossshort") next bar Stoploss_Fixed_Short stop;
Just did the optimized test with the rewrited code. With the optimizing of the riskreward with values between 2 and 3 (steps of 0.25). It will take about 27% less time to optimize.
With the old code it has 16954 simulations and now with the new code 12403. (33 hours instead of now 24 hours). This is just a test, I have to decrease parameters to get better optimizing.
For my strategy it works to have riskreward between 2 and 3. So for me it works. You can ofcourse make the steps bigger and gain extra time decrease or change the interval to 3 and 4 for example.
The stoploss in my strategy is calculated like this:
Stoploss = (profittargetAmt/RiskRewardAmt)/StockAmt;
And the stoploss is applied like this:
Stoploss_Fixed_Long = round2fraction(AvgEntryprice - Stoploss);
Sell ("StopLossLong") next bar Stoploss_Fixed_Long stop;
Stoploss_Fixed_Short = round2fraction(AvgEntryprice + Stoploss);
Buytocover ("StopLossshort") next bar Stoploss_Fixed_Short stop;
Re: Exclude possible scenarios with optimizing
Hi ....
nice to see some progress. But with round about 12000 optimizing steps and 24hrs to take I guess you are using a long period for testing.
Mike
PS : Deleted all other comments here, because it would cause a new discussion about correct testing. And I don't want that ... Sry
nice to see some progress. But with round about 12000 optimizing steps and 24hrs to take I guess you are using a long period for testing.
Mike
PS : Deleted all other comments here, because it would cause a new discussion about correct testing. And I don't want that ... Sry