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

Re: [amibroker] Re: Three Day Modification to CandleStochastics



PureBytes Links

Trading Reference Links


Hi,
 
Just a few "coding-style" comment:
 
Things like this:
> PL = iif(PL== 
1,1,iif(ref(PL,-1)== 1,1,iif(ref(PL,-2)== 1,1,0))); are not needed 
because all comparison operations (<,>, <=, >=, == and !=) 
return
1 (true) when condition is met and 0 (false) 
otherwise.
 
So you can omit IIFs at all:
PL = PL == 1 OR Ref( PL == 1, -1 ) OR Ref( PL == 1, -2 
);
 
Second comment: Ralf pointed out 
that it is much better to use BarsSince
function instead of joining multiple Ref()s 
: 
>tolDays = 3;>kupBuy 
= iif(barsSince(CROSS(C,KDOWN) ) < tolDays, 1, 0);>kupSell = 
iif(barsSince(CROSS(KUP,C) ) < tolDays, 1, 0);<FONT 
size=2>
 
But you can simplify the formula even 
further using Hold function:
 
tolDays = 3; 
kupBuy = Hold(  Cross( C, KDown 
),   tolDays );
kupSell = Hold( Cross( KUp, C 
),       tolDays );
 
Best regards,
Tomasz Janeczko
<BLOCKQUOTE 
>
 
----- Original Message ----- 
<DIV 
>From: 
ralf@xxxxxxxx 

To: <A title=amibroker@xxxxxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx 
Sent: Friday, June 22, 2001 2:27 
AM
Subject: [amibroker] Re: Three Day 
Modification to CandleStochastics
<FONT 
size=2><FONT 
size=2>Hi,I had the same thought - just made it a 
little easieron the typing and you can play with the period: 
tolDays = 3;.../* KUP 
*/KUP=EMA((H+L+C)/3,10)+EMA(H-L,10);KDOWN=EMA((H+L+C)/3,10)-EMA(H-L,10);kupBuy 
= iif(barsSince(CROSS(C,KDOWN) ) < tolDays, 1, 0);kupSell = 
iif(barsSince(CROSS(KUP,C) ) < tolDays, 1, 0);...Thanks to 
Thierry for sharing.Cheers Ralf--- In amibroker@xxxx, 
fesnay@xxxx wrote:> Modification to "Against All Odds" - Written by 
Thierry HUITEL> Based on Jim Varney's work - - CANDLESTOCHASTICS - 
> > Concept - The modification follows the reasoning that some 
signals > occur earlier than others.  The current program finds 
all occurances> for any ONE day.  My modification looks over a 
three day span - > today, yesterday, and the day before that.  It 
uses nested > conditional "iif" statements, and if any one of the three 
days comes > up with a signal, this returns a "true" and is 
recorded in the > results.> > Cut and paste the following 
two sections that are the modifications > into the corresponding 
segments of the CANDLESTOCHASTICS explore > coding.  Take care to 
completely overwrite everything from "/*number > of buy signals - - 
- " thru "somme2 = "> > Comments, changes, or further ideas 
welcome !> /*number of buy signals --- give weight to your favorite 
ones with a > coefficient. */> PL = iif(PL== 
1,1,iif(ref(PL,-1)== 1,1,iif(ref(PL,-2)== 1,1,0))); > MDS = iif(MDS== 
1,1,iif(ref(MDS,-1)== 1,1,iif(ref(MDS,-2)== 1,1,0))); > HAM = 
iif(HAM== 1,1,iif(ref(HAM,-1)== 1,1,iif(ref(HAM,-2)== 1,1,0))); > 
BLE = iif(BLE== 1,1,iif(ref(BLE,-1)== 1,1,iif(ref(BLE,-2)==1,1,0))); 
> tdreiBuy = iif(tdreiBuy== 1,1,iif(ref(tdreiBuy,-1)== 
1,1,iif(ref> (tdreiBuy,-2)== 1,1,0))); > kupBuy = iif(kupBuy== 
1,1,iif(ref(kupBuy,-1)== 1,1,iif(ref(kupBuy,-2)> == 1,1,0))); 
> rsiBuy = iif(rsiBuy== 1,1,iif(ref(rsiBuy,-1)== 
1,1,iif(ref(rsiBuy,-2)> == 1,1,0))); > mfibuy = 
iif(mfibuy==1,1,iif(ref(mfibuy,-1)== 1,1,iif(ref(mfibuy,-2)> == 
1,1,0))); > sto2BuyL = iif(sto2Buy== 1,1,iif(ref(sto2Buy,-1)== 
1,1,iif(ref> (sto2Buy,-2)== 1,1,0))); > divBuy = iif(divBuy== 
1,1,iif(ref(divBuy,-1)== 1,1,iif(ref(divBuy,-2)> == 1,1,0))); 
> kstBuy = iif(kstBuy== 1,1,iif(ref(kstBuy,-1)== 
1,1,iif(ref(kstBuy,-2)> == 1,1,0))); > copBuy = iif(copBuy== 
1,1,iif(ref(copBuy,-1)== 1,1,iif(ref(copBuy,-2)> == 1,1,0))); 
> smashBuy = iif(smashBuy== 1,1,iif(ref(smashBuy,-1)== 
1,1,iif(ref> (smashBuy,-2)== 1,1,0))); > chkBuy = iif(chkBuy== 
1,1,iif(ref(chkBuy,-1)== 1,1,iif(ref(chkBuy,-2)> == 1,1,0))); 
> > somme= PL + MDS + HAM + BLE + tdreiBuy + kupBuy + rsiBuy + 
(2*mfibuy) > + sto2Buy + (2*divBuy) + kstBuy + copBuy + 
(2*smashBuy) + chkBuy; > > > /*number of sell signals. 
*/> BRE = iif(BRE== 1,1,iif(ref(BRE,-1)== 1,1,iif(ref(BRE,-2)== 
1,1,0))); > DCC = iif(DCC== 1,1,iif(ref(DCC,-1)== 
1,1,iif(ref(DCC,-2)== 1,1,0))); > EDS = iif(EDS== 
1,1,iif(ref(EDS,-1)== 1,1,iif(ref(EDS,-2)== 1,1,0))); > tdreiSell = 
iif(tdreiSell== 1,1,iif(ref(tdreiSell,-1)== 1,1,iif(ref> 
(tdreiSell,-2)== 1,1,0))); > kupSell = iif(kupSell== 
1,1,iif(ref(kupSell,-1)== 1,1,iif(ref> (kupSell,-2)== 1,1,0))); 
> rsiSell = iif(rsiSell== 1,1,iif(ref(rsiSell,-1)== 1,1,iif(ref> 
(rsiSell,-2)== 1,1,0))); > mfiSell = iif(mfiSell== 
1,1,iif(ref(mfiSell,-1)== 1,1,iif(ref> (mfiSell,-2)== 1,1,0))); 
> sto2Sell = iif(sto2Sell== 1,1,iif(ref(sto2Sell,-1)== 
1,1,iif(ref> (sto2Sell,-2)== 1,1,0))); > divSell = iif(divSell== 
1,1,iif(ref(divSell,-1)== 1,1,iif(ref> (divSell,-2)== 1,1,0))); 
> kstSell = iif(kstSell== 1,1,iif(ref(kstSell,-1)== 1,1,iif(ref> 
(kstSell,-2)== 1,1,0))); > smashSell  = iif(smashSell == 
1,1,iif(ref(smashSell ,-1)== 1,1,iif(ref> (smashSell ,-2)== 
1,1,0))); > chkSell = iif(chkSell== 1,1,iif(ref(chkSell,-1)== 
1,1,iif(ref> (chkSell,-2)== 1,1,0))); > > somme2= BRE + 
DCC + EDS + tdreiSell + kupSell + rsiSell + mfiSell + > sto2Sell + 
divSell + divSell + kstSell + smashSell + chkSell;> > 
FrankYour 
use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service.