PureBytes Links
Trading Reference Links
|
Thanks to Gary and Dennis and Jimmy,
Gary first and then Dennis show me another way that the one i imagined
to have all the combinations tested with the optimization feature and
setups as inputs.
I understand that Gary and Dennis suggestion writing setup 1 to 8 as
inputs and optimizing them from 0 to 1 will *do* test all the 255
combinations.
That is Ok.! but then i cannot find out how i must write the code to use
that way of setups optimization with my true/false setups conditions for
long and short entries. I am in the fog with how to code the True/False
buy and sell entry conditions as i did with my originally code (see my
code below) .
I am not so familiar with all this and unfortunately may not be creative
enough or smart enough to see how i can use your way and adapt my
originally code to it.
I would greatly appreciate your next suggestion to do it with your way .
Thanks and regards
Philippe
Simplified code below as an example of what i have originally imagined
to do:
====================================================
Inputs: BolLength(20), StdDevn(2),
** choixSetup(0) {to be optimised from 0 to nb of combinations
(256)};**
Vars: BBTop(0), BBBot(0), Mbol(0),
{Setups for long entry}
setup1(false),setup2(false),setup3(false),setup4(false),setup5(false),setup6(false),setup7(false),setup8(false),
{Setups for short entry entry}
setup10(false), setup20(false),
setup30(false),setup40(false),setup50(false),setup60(false),setup70(false),setup80(false);
BTop = BollingerBand(Close, BolLength, +StdDevn);
BBBot = BollingerBand(Close, BolLength, -StdDevn);
mbol = average(close, BolLength);
1/ True False setups for long entry
{========================================================================}
If x <= y then setup1 = true ;
If setup1 = true then begin
If close >= close[1] then setup2 = true
else
Setup2=false;
If high >= High[1] or high >= High[2] then setup3 =true
else
setup3=false;
If close >= Open then setup4 = true
else
setup4=false;
If Close < Mbol then setup5 =True
else
setup5=false;
etc .... up to setup8
end ;
2/ Buy conditions
========================
If choixSetup = 0 then condition1 = True;
If choixSetup = 1 then condition1 = setup1;
If choixSetup = 2 then condition1 = setup1 and setup2;
If choixSetup = 3 then condition1 = setup1 and setup3;
If choixSetup = 4 then condition1 = setup1 and setup4;
If choixSetup = 5 then condition1 = setup1 and setup5;
If choixSetup = 6 then condition1 = setup1 and setup6;
If choixSetup = 7 then condition1 = setup1 and setup7;
If choixSetup = 8 then condition1 = setup1 and setup8;
If choixSetup = 9 then condition1 = setup1 and setup2 and setup3;
If choixSetup = 10 then condition1 = setup1 and setup2 and setup4;
If choixSetup = 11 then condition1 = setup1 and setup2 and setup5;
If choixSetup = 12 then condition1 = setup1 and setup2 and setup6;
If choixSetup = 13 then condition1 = setup1 and setup2 and setup7;
If choixSetup = 14 then condition1 = setup1 and setup2 and setup8;
If choixSetup = 15 then condition1 = setup1 and setup2 and setup3 and
setup4;
If choixSetup = 16 then condition1 = setup1 and setup2 and setup3 and
setup5;
If choixSetup = 17 then condition1 = setup1 and setup2 and setup3 and
setup6;
If choixSetup = 18 then condition1 = setup1 and setup2 and setup3 and
setup7;
If choixSetup = 19 then condition1 = setup1 and setup2 and setup3 and
setup8;
If choixSetup = 20 then condition1 = setup1 and setup2 and setup3 and
setup4 and setup5 ;
If choixSetup = 21 then condition1 = setup1 and setup2 and setup3 and
setup4 and setup6 ;
If choixSetup = 22 then condition1 = setup1 and setup2 and setup3 and
setup4 and setup7 ;
If choixSetup = 23 then condition1 = setup1 and setup2 and setup3 and
setup4 and setup8 ;
If choixSetup = 24 then condition1 = setup1 and setup2 and setup3 and
setup4 and setup5 and setup6 ;
If choixSetup = 25 then condition1 = setup1 and setup2 and setup3 and
setup4 and setup5 and setup7 ;
If choixSetup = 26 then condition1 = setup1 and setup2 and setup3 and
setup4 and setup5 and setup8 ;
If choixSetup = 27 then condition1 = setup1 and setup2 and setup3 and
setup4 and setup5 and setup6 and setup7 ;
If choixSetup = 28 then condition1 = setup1 and setup2 and setup3 and
setup4 and setup5 and setup6 and setup8 ;
If choixSetup = 29 then condition1 = setup1 and setup2 and setup3 and
setup4 and setup5 and setup6 and setup7 and setup8 ;
If choixSetup = 30 then condition1 = setup1 and setup3 and setup4;
If choixSetup = 31 then condition1 = setup1 and setup3 and setup5;
If choixSetup = 32 then condition1 = setup1 and setup3 and setup6;
If choixSetup = 33 then condition1 = setup1 and setup3 and setup7;
If choixSetup = 34 then condition1 = setup1 and setup3 and setup8;
If choixSetup = 35 then condition1 = setup1 and setup3 and setup4 and
setup5;
If choixSetup = 36 then condition1 = setup1 and setup3 and setup4 and
setup6;
If choixSetup = 37 then condition1 = setup1 and setup3 and setup4 and
setup7;
If choixSetup = 38 then condition1 = setup1 and setup3 and setup4 and
setup8;
If choixSetup = 39 then condition1 = setup1 and setup3 and setup4 and
setup5 and setup6;
If choixSetup = 40 then condition1 = setup1 and setup3 and setup4 and
setup5 and setup7;
If choixSetup = 41 then condition1 = setup1 and setup3 and setup4 and
setup5 and setup8;
If choixSetup = 42 then condition1 = setup1 and setup3 and setup4 and
setup5 and setup6 and setup7;
If choixSetup = 43 then condition1 = setup1 and setup3 and setup4 and
setup5 and setup6 and setup8;
If choixSetup = 44 then condition1 = setup1 and setup3 and setup4 and
setup5 and setup6 and setup7 and setup8;
If choixSetup = 45 then condition1 = setup1 and setup4 and setup5;
If choixSetup = 46 then condition1 = setup1 and setup4 and setup6;
If choixSetup = 47 then condition1 = setup1 and setup4 and setup7;
If choixSetup = 48 then condition1 = setup1 and setup4 and setup8;
If choixSetup = 49 then condition1 = setup1 and setup4 and setup5 and
setup5;
If choixSetup = 50 then condition1 = setup1 and setup4 and setup5 and
setup6;
If choixSetup = 51 then condition1 = setup1 and setup4 and setup5 and
setup7;
If choixSetup = 52 then condition1 = setup1 and setup4 and setup5 and
setup8;
If choixSetup = 53 then condition1 = setup1 and setup4 and setup5 and
setup6 and setup7;
If choixSetup = 54 then condition1 = setup1 and setup4 and setup5 and
setup6 and setup8;
If choixSetup = 55 then condition1 = setup1 and setup4 and setup5 and
setup6 and setup7 and setup8;
If choixSetup = 56 then condition1 = setup1 and setup5 and setup6;
If choixSetup = 57 then condition1 = setup1 and setup5 and setup7;
If choixSetup = 58 then condition1 = setup1 and setup5 and setup8;
If choixSetup = 59 then condition1 = setup1 and setup5 and setup6 and
setup7;
If choixSetup = 60 then condition1 = setup1 and setup5 and setup6 and
setup8;
If choixSetup = 61 then condition1 = setup1 and setup5 and setup6 and
setup7 and setup8;
If choixSetup = 62 then condition1 = setup1 and setup6 and setup7;
If choixSetup = 63 then condition1 = setup1 and setup6 and setup8;
If choixSetup = 64 then condition1 = setup1 and setup6 and setup7 and
setup8;
If choixSetup = 65 then condition1 = setup1 and setup7 and setup8;
If choixSetup = 36 then condition1 = setup2;
If choixSetup = 67 then condition1 = setup2 and setup3;
If choixSetup = 68 then condition1 = setup2 and setup4;
If choixSetup = 69 then condition1 = setup2 and setup5;
If choixSetup = 70 then condition1 = setup2 and setup6;
If choixSetup = 71 then condition1 = setup2 and setup7;
If choixSetup = 72 then condition1 = setup2 and setup8;
If choixSetup = 73 then condition1 = setup2 and setup3 and setup4;
If choixSetup = 74 then condition1 = setup2 and setup3 and setup5;
If choixSetup = 75 then condition1 = setup2 and setup3 and setup6;
If choixSetup = 76 then condition1 = setup2 and setup3 and setup7;
If choixSetup = 77 then condition1 = setup2 and setup3 and setup8;
If choixSetup = 78 then condition1 = setup2 and setup3 and setup4 and
setup5;
If choixSetup = 79 then condition1 = setup2 and setup3 and setup4 and
setup6;
If choixSetup = 80 then condition1 = setup2 and setup3 and setup4 and
setup7;
If choixSetup = 81 then condition1 = setup2 and setup3 and setup4 and
setup8;
If choixSetup = 82 then condition1 = setup2 and setup3 and setup4 and
setup5 and setup6;
If choixSetup = 83 then condition1 = setup2 and setup3 and setup4 and
setup5 and setup7;
If choixSetup = 84 then condition1 = setup2 and setup3 and setup4 and
setup5 and setup8;
If choixSetup = 85 then condition1 = setup2 and setup3 and setup4 and
setup5 and setup6 and setup7;
If choixSetup = 86 then condition1 = setup2 and setup3 and setup4 and
setup5 and setup6 and setup7 and setup8;
If choixSetup = 87 then condition1 = setup2 and setup4 and setup5;
...... and so on up to 256 combinations for True/false long entries.
3/ True/False setups for short entry
========================
Then the same sequence for condition10 (sell setups) with 8 inverse
setups ( setup20= inverse of setup2 for long entry)
this is another 256 combinations for seel entry setups
If x >= y then setup10 = True;
If setup10 = true then begin
If close <= close[1] then setup20 = true
else
Setup20=false;
If high <= High[1] or high <= High[2] then setup30 =true
else
setup30=false;
If close <= Open then setup40 = true
else
setup40=false;
If Close > Mbol then setup50 =True
else
setup50=false;
... up to setup 80
end ;
4/ Sell conditions
========================
If choixSetup = 0 then condition10 = True;
If choixSetup = 1 then condition10 = setup10;
If choixSetup = 2 then condition10 = setup10 and setup20;
If choixSetup = 3 then condition10 = setup10 and setup30;
If choixSetup = 4 then condition10 = setup10 and setup40;
If choixSetup = 5 then condition10 = setup10 and setup50;
If choixSetup = 6 then condition10 = setup10 and setup60;
If choixSetup = 7 then condition10 = setup10 and setup0;
If choixSetup = 8 then condition10 = setup10 and setup80;
If choixSetup = 9 then condition10 = setup10 and setup20 and setup30;
If choixSetup = 10 then condition10 = setup10 and setup20 and setup40;
If choixSetup = 11 then condition10 = setup10 and setup20 and setup50;
............etc..up to 256 combinations for true/false short entries
5/ Entries
============
If condition 1 then buy at market
If condition10 then sell at market
6/ analysis
=============
And system performance results for each combination will be exported to
a file during optimisation process for further analysis in excel
|