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

[amibroker] Exploration Columns, variations and control



PureBytes Links

Trading Reference Links




We may control the columns of an exploration in many 
ways.The following CODE1 calculates the final ^VIX Equity for all 
parameters k from -1 to 0 
and gives one column per parameter value, written on the 
caption.
// CODE 1function IIR2( input, f0, f1, f2 ){  
result[ 0 ] = input[ 0 ];  result[ 1 ] = input[ 1 ];   for( i 
= 2; i < BarCount; i++ )  {    result[ i ] = f0 * 
input[ i ] +     f1 * result[ i - 1 ] + 
    f2 * result[ i - 2 ];   }  return 
result;}RED=IIR2( C, 0.2, 1.4, -0.6 
);for(k=-1;k<-0.1;k=k+0.1){GREEN=IIR2(C,0.2+0.01*K,1.4-0.01*K,-0.6);Buy=Cross(GREEN,RED);Sell=Cross(RED,GREEN);E1=Equity(1,0);EquityTHRESHOLD=70000;ET=EquityTHRESHOLD;// 
if(E1[BarCount-1]>ET) AddColumn(E1,"E1("+WriteVal(K,1.1)+")",1.0);// 
AddColumn(E1,"E("+WriteVal(K,1.1)+")",1.0,colorBlack,IIf(E1>ET,colorRed,colorWhite));}Filter=1;
 
We may paint the columns above some predefined threshold 
with
 
// CODE 2
function IIR2( input, f0, f1, f2 ){  result[ 0 ] 
= input[ 0 ];  result[ 1 ] = input[ 1 ];   for( i = 2; i < 
BarCount; i++ )  {    result[ i ] = f0 * input[ i ] 
+     f1 * result[ i - 1 ] +     f2 * 
result[ i - 2 ];   }  return result;}RED=IIR2( C, 0.2, 
1.4, -0.6 
);for(k=-1;k<-0.1;k=k+0.1){GREEN=IIR2(C,0.2+0.01*K,1.4-0.01*K,-0.6);Buy=Cross(GREEN,RED);Sell=Cross(RED,GREEN);E1=Equity(1,0);EquityTHRESHOLD=70000;ET=EquityTHRESHOLD;<FONT 
color=#ff0000>// if(E1[BarCount-1]>ET)// 
AddColumn(E1,"E1("+WriteVal(K,1.1)+")",1.0); AddColumn(E1,"E("+WriteVal(K,1.1)+")",1.0,colorBlack,IIf(E1>ET,colorRed,colorWhite));}Filter=1;
 
and, finally, we may see ONLY the interesting columns 
with
 
// CODE 3
function IIR2( input, f0, f1, f2 ){  result[ 0 ] 
= input[ 0 ];  result[ 1 ] = input[ 1 ];   for( i = 2; i < 
BarCount; i++ )  {    result[ i ] = f0 * input[ i ] 
+     f1 * result[ i - 1 ] +     f2 * 
result[ i - 2 ];   }  return result;}RED=IIR2( C, 0.2, 
1.4, -0.6 
);for(k=-1;k<-0.1;k=k+0.1){GREEN=IIR2(C,0.2+0.01*K,1.4-0.01*K,-0.6);Buy=Cross(GREEN,RED);Sell=Cross(RED,GREEN);E1=Equity(1,0);EquityTHRESHOLD=70000;ET=EquityTHRESHOLD;<FONT 
color=#ff0000> if(E1[BarCount-1]>ET<FONT 
color=#ff0000>) AddColumn(E1,"E1("+WriteVal(K,1.1)+")",1.0);// 
AddColumn(E1,"E("+WriteVal(K,1.1)+")",1.0,colorBlack,IIf(E1>ET,colorRed,colorWhite));}Filter=1;
 
function IIR2( input, f0, f1, f2 ){  result[ 0 ] 
= input[ 0 ];  result[ 1 ] = input[ 1 ];   for( i = 2; i < 
BarCount; i++ )  {    result[ i ] = f0 * input[ i ] 
+     f1 * result[ i - 1 ] +     f2 * 
result[ i - 2 ];   }  return result;}RED=IIR2( C, 0.2, 
1.4, -0.6 
);for(k=-1;k<-0.1;k=k+0.1){GREEN=IIR2(C,0.2+0.01*K,1.4-0.01*K,-0.6);Buy=Cross(GREEN,RED);Sell=Cross(RED,GREEN);E1=Equity(1,0);EquityTHRESHOLD=70000;ET=EquityTHRESHOLD;<FONT 
color=#ff0000> if(E1[BarCount-1]>ET) AddColumn(E1,"E1("+WriteVal(K,1.1)+")",1.0);// 
AddColumn(E1,"E("+WriteVal(K,1.1)+")",1.0,colorBlack,IIf(E1>ET,colorRed,colorWhite));}Filter=1;
 
The changes are in the last bold red Lines 23, 24 and 25, the 
rest is exactly the same .
Here is a short description of the code and the technique 
:
A RED line is defined with the help of an IIR2.
A GREEN companion line depends on the parameter 
k.
The Buy, Sell conditions, the final Equity value and the 
column[s] are defined inside a "for" loop.
An "if" statement inside the "for" loop controls the # of 
columns.
An "IIF" function controls the color of the interesting 
results.
Enjoy the powerful properties of version 4.40 !!
Dimitris Tsokakis






Yahoo! Groups Sponsor


  ADVERTISEMENT 









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



Attachment:
COLUMNS.gif

Attachment: Description: "Description: GIF image"