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

Re: [amibroker] Bullish Harami(Final ?)



PureBytes Links

Trading Reference Links

David, et all:
When there are more than 1 buy signal within a 10 trading day
time frame, some of the columns on your explore showed
"0".
I did some minor rework, and came up with the following code.
See if you like it.
Frank

==================================================================
/*BULLISH HARAMI BUY CONDITION*/
/*GAIN 10 DAYS LATER*/
/*PERCENTAGE SUCCESS*/
/* UP TO THREE BUY SIGNALS WITHIN 10 DAYS ACCEPTABLE */
/* WITH EACH BUY SIGNAL GIVEN A % GAIN FIGURE */
u=5;/*PERCANTAGE DROP THE FIRST DAY*/
d1=10;/*DAYS TO WATCH*/
cond1=close<=(1-u/100)*open;
cond2=close>open and close<ref(open,-1) and
open>ref(close,-1);
cond3=cond2 and ref(cond1,-1);
BUY=cond3;
h1=iif(barssince(buy) == 10,close,0);
filter=ref(COND3,-d1);
tempg1 = tempg2 = tempg3 = 0; //set up temporary gain holding 
arrays
sell=filter;
h2 = iif(sell,hhv(close,d1),0);
numcolumns=7;
column0=ref(close,-d1+1);// Add 1 day to the 10 days - - a -1 is
yesterday, so -10 is 11 days ago
tempg1 = iif(sell and tempg1 == 0 and tempg2 ==0 and tempg3==0,close,0);
//if first active occurance, assign tempg1
tempg2 = iif(sell and tempg1 > 0 and tempg2 == 0 and
tempg3==0,close,0); //if tempg1 active, assign tempg2
tempg3 = iif(sell and tempg1 > 0 and tempg2 > 0 and tempg3 ==0,
close,0); // if tempg1 and tempg2 active, assign tempg3
column1 = iif(sell and tempg1 > 0 and tempg2 == 0 and tempg3 ==
0,tempg1,iif(sell and tempg2 > 0 and tempg3 == 0,tempg2,iif(sell and
tempg3,tempg3,0)));
tempg1 = iif(barssince(buy) > 10,0,tempg1);
tempg2 = iif(barssince(buy) > 10,0,tempg2);
tempg3 = iif(barssince(buy) > 10,0,tempg3);
column2=100*((column1-column0)/column0);
column0name="Harami CLOSE";
column1name="10th CLOSE";
column2name=" % GAIN";

COLUMN3=LASTVALUE(CUM(BUY));
COLUMN4=(CUM(COLUMN2>0 AND SELL));
COLUMN5=100*COLUMN4/COLUMN3;
COLUMN6 = h2;

COLUMN3NAME="Signals";
COLUMN4NAME="# Profitable";
COLUMN5NAME="% Profitable";
COLUMN6NAME = "Max 10 Day High";
COLUMN3FORMAT=1.0;
COLUMN4FORMAT=1.0;
COLUMN5FORMAT=1.2;
COLUMN5FORMAT=1.2;
=====================================================================
At 08:37 PM 8/12/01 +0300, you wrote: 
Hi
David,
I think here we have what you ask.
"FROM" 4 haramis "GAINED" 3, i. e.
the
"% G" is 75%.
The most I liked is COLUMN4 syntax.
 
/*BULLISH HARAMI BUY CONDITION*/
/*GAIN 10 DAYS LATER*/
/*PERCENTAGE SUCCESS*/
u=5;/*PERCANTAGE DROP THE FIRST DAY*/
d1=10;/*DAYS TO WATCH*/
cond1=close<=(1-u/100)*open;
cond2=close>open and close<ref(open,-1) and
open>ref(close,-1);
cond3=cond2 and ref(cond1,-1);
h1=hhv(close,d1);
filter=ref(COND3,-d1);
BUY=cond3;
sell=filter;
numcolumns=7;
column0=ref(close,-d1);
column1=h1;
column2=100*(column1/column0-1);
column0name="HARAMI CLOSE";
column1name="HIGHEST CLOSE";
column2name="MAX GAIN";
COLUMN3=LASTVALUE(CUM(BUY));
COLUMN4=LASTVALUE(CUM(COLUMN2>0 AND SELL));
COLUMN5=100*COLUMN4/COLUMN3;
COLUMN3NAME="FROM";
COLUMN4NAME="GAINED";
COLUMN5NAME="% G";
COLUMN6NAME="B/S  F";
COLUMN3FORMAT=1.0;
COLUMN4FORMAT=1.0;
COLUMN5FORMAT=1.0;
 
The majority of my 400 stocks, although
in a 2 years bearish
period, were above 50%
 
Dimitris Tsokakis
 




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