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

Re: [amibroker] Array processing in Loops (Tomasz) [was] Re: The use of the Powsmooth



PureBytes Links

Trading Reference Links

Dimitris,

I provided already the code that calculates the composite
without AddToComposite, but it requires version 4.32.0 or higher
(4.36.0 for example) because it uses 'for' loop.

Once you upgrade to the recent version you will enjoy
the power of native looping in AFL.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, May 14, 2003 9:43 PM
Subject: [amibroker] Array processing in Loops (Tomasz) [was] Re: The use of the Powsmooth


> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
> wrote:
> > Hello,
> > 
> > No, I meant use AddToComposite that is exactly provided for 
> creation of composites.
> 
> Tomasz,
> AddToComposite scan can create composites, if you are free to scan 
> and you have nothing else to do.
> It is not always that easy.
> Since there is a small distance from theory to application, please 
> try to understand the problem of the last hour decision. i tried to 
> give a rough example at the "No title" message. The real thing is 
> much more complicated, when one has to check more than two 
> conditions .
> TIA
> Dimitris Tsokakis 
> > But if you really want to do this hard way you may use the code I 
> provided in my
> > second response.
> > 
> > Instead of your
> >        currADX = ForeignADX( ticker, 14 );
> > 
> > //     ^ should hold ForeignADX Array
> > 
> >        for (i=1;i<BarCount;i++)
> > 
> >        {      
> > 
> >               MeanADX[i] = MeanADX[i] + currADX[i];
> > 
> >        }
> > 
> > 
> > 
> > Use:
> >   currADX = ForeignADX( ticker, 14 );
> > //     ^ should hold ForeignADX Array
> > 
> >          MeanADX = MeanADX + currADX;
> > 
> > 
> > Because it is faster and easier to just use AFL array processing 
> that allows to add arrays directly.
> > 
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> >   ----- Original Message ----- 
> >   From: bluesinvestor 
> >   To: amibroker@xxxxxxxxxxxxxxx 
> >   Sent: Tuesday, May 13, 2003 8:17 PM
> >   Subject: RE: [amibroker] Array processing in Loops (Tomasz) [was] 
> Re: The use of the Powsmooth
> > 
> > 
> >   Tomasz,
> > 
> >    
> > 
> >   So when a new ticker is loaded in an exploration MeanADX will 
> remain global and not get reset?
> > 
> >    
> > 
> >   Regards,
> > 
> >   Peter
> > 
> >    
> > 
> >   -----Original Message-----
> >   From: Tomasz Janeczko [mailto:amibroker@x...] 
> >   Sent: Tuesday, May 13, 2003 2:04 PM
> >   To: amibroker@xxxxxxxxxxxxxxx
> >   Subject: Re: [amibroker] Array processing in Loops (Tomasz) [was] 
> Re: The use of the Powsmooth
> > 
> >    
> > 
> >   Hello,
> > 
> >    
> > 
> >   Why do things so much complicated when they are easy.
> > 
> >    
> > 
> >   You CAN iterate through watch list.
> > 
> >   Simply click on  FILTER button and set it to watch list of your 
> choice.
> > 
> >   Then AA will automatically go through your watch list.
> > 
> >    
> > 
> >   Best regards,
> >   Tomasz Janeczko
> >   amibroker.com
> > 
> >     ----- Original Message ----- 
> > 
> >     From: bluesinvestor 
> > 
> >     To: amibroker@xxxxxxxxxxxxxxx 
> > 
> >     Sent: Tuesday, May 13, 2003 5:11 PM
> > 
> >     Subject: [amibroker] Array processing in Loops (Tomasz) [was] 
> Re: The use of the Powsmooth
> > 
> >      
> > 
> >     Tomasz,
> > 
> >      
> > 
> >     I am trying to find an easy way to code Dimitris' Powsmooth 
> using UM's ABTool DLL (I would like to use a pure AFL method but 
> cannot seem to find a way to iterate through tickers in a watchlist 
> via AFL).
> > 
> >      
> > 
> >     How does AB handle arrays when enclosed in a loop?  This does 
> not seem to work:
> > 
> >      
> > 
> >     /* WRITE ONCE */
> > 
> >     function ForeignADX( symbol, period )
> > 
> >     {
> > 
> >          /* save original price arrays */
> > 
> >          SC = C;
> > 
> >          SO = O;
> > 
> >          SH = H;
> > 
> >          SL = L;
> > 
> >      
> > 
> >          C = Foreign( symbol, "C" );
> > 
> >          H = Foreign( symbol, "H" );
> > 
> >          L = Foreign( symbol, "L" );
> > 
> >          O = Foreign( symbol, "O" );
> > 
> >      
> > 
> >          Result = ADX( period ); // REPLACE THIS BY ANY AFL FUNCTION
> > 
> >      
> > 
> >          /* restore original arrays */
> > 
> >          C = SC;
> > 
> >          O = SO;
> > 
> >          H = SH;
> > 
> >          L = SL;
> > 
> >      
> > 
> >     return Result;
> > 
> >     }
> > 
> >      
> > 
> >     wl = 0;  // put your watchlist number (0..63) here; it should 
> contain some tickers
> > 
> >              // (my WL 1 contains the 100 Nasdaq100 tickers)
> > 
> >      
> > 
> >     xxABtoolInit();
> > 
> >     Filter = 1;
> > 
> >     xtickercount = xxTickerCount(wl);
> > 
> >      
> > 
> >     ticker = xxTickerFirst(wl);
> > 
> >     MeanADX = 0;
> > 
> >     while(ticker != "")
> > 
> >     {
> > 
> >          currADX = ForeignADX( ticker, 14 );
> > 
> >     //   ^ should hold ForeignADX Array
> > 
> >          for (i=1;i<BarCount;i++)
> > 
> >          {      
> > 
> >                 MeanADX[i] = MeanADX[i] + currADX[i];
> > 
> >          }
> > 
> >      
> > 
> >          ticker = xxTickerNext(wl);
> > 
> >     }
> > 
> >      
> > 
> >     xxABtoolInit();  //cleanup
> > 
> >      
> > 
> >     AddColumn(MeanADX,"MeanADX");
> > 
> >      
> > 
> >      
> > 
> >     Thanks in advance,
> > 
> >     Peter
> > 
> >      
> > 
> >     -----Original Message-----
> >     From: DIMITRIS TSOKAKIS [mailto:TSOKAKIS@x...] 
> >     Sent: Monday, May 12, 2003 2:39 AM
> >     To: amibroker@xxxxxxxxxxxxxxx
> >     Subject: [amibroker] Re: The use of the Powsmooth
> > 
> >      
> > 
> >     Peter,
> > 
> >     thank you for the unexpected [because of time] reply.
> > 
> >     Sleep with the idea and talk again "tomorrow".
> > 
> >     It is 09.30 in Athens now, 32 Celsius and the summer is already 
> at 
> > 
> >     the corner.
> > 
> >     Dimitris Tsokakis
> > 
> >     --- In amibroker@xxxxxxxxxxxxxxx, "bluesinvestor" 
> <investor@xxxx> 
> > 
> >     wrote:
> > 
> >     > Dimitris,
> > 
> >     > 
> > 
> >     > Unfortunately it is late here and I cannot come with a simple 
> > 
> >     solution
> > 
> >     > to 'step' through foreign tickers to get the ADX variable.  
> We would
> > 
> >     > have to list all the tickers involved.
> > 
> >     > 
> > 
> >     > If there is a way (which I do not know or cannot think of at 
> the 
> > 
> >     moment)
> > 
> >     > then the situation would be easy to solve.
> > 
> >     > 
> > 
> >     > Maybe someone will have a suggestion or solution by morning.
> > 
> >     > 
> > 
> >     > Regards,
> > 
> >     > Peter
> > 
> >     > 
> > 
> >     > -----Original Message-----
> > 
> >     > From: DIMITRIS TSOKAKIS [mailto:TSOKAKIS@x...] 
> > 
> >     > Sent: Monday, May 12, 2003 1:59 AM
> > 
> >     > To: amibroker@xxxxxxxxxxxxxxx
> > 
> >     > Subject: [amibroker] Re: The use of the Powsmooth
> > 
> >     > 
> > 
> >     > Peter,
> > 
> >     > to materialize this idea 
> > 
> >     > http://groups.yahoo.com/group/amibroker/message/40198
> > 
> >     > in N100 database we need to write 100 lines with
> > 
> >     > ADX0=
> > 
> >     > ADX1=
> > 
> >     > ADX2=
> > 
> >     > ...
> > 
> >     > ADX99=
> > 
> >     > MeanADX=(ADX0+ADX1+ADX2+...+ADX99)/100;
> > 
> >     > Since you swim better in the iterations world, is there a 
> more 
> > 
> >     > elegant way to do it [through stocknum perhaps...]
> > 
> >     > Of course, even if we take it as is, the advantage is great, 
> > 
> >     > especially for intraday use.
> > 
> >     > I suppose we make a STEP here.
> > 
> >     > Dimitris Tsokakis
> > 
> >     > --- In amibroker@xxxxxxxxxxxxxxx, "bluesinvestor" 
> <investor@xxxx> 
> > 
> >     > wrote:
> > 
> >     > > Dimitris,
> > 
> >     > >  
> > 
> >     > > Without the JavaScript:
> > 
> >     > >  
> > 
> >     > > /*PowSmooth and an application to Dratio*/
> > 
> >     > > dratio=DEMA(1000*(H-L)/(H+L),20);
> > 
> >     > >  
> > 
> >     > > for(i=2;i<BarCount;i++)
> > 
> >     > > {
> > 
> >     > >        t0[i]=(dratio[i]*dratio[i-1]*dratio[i-2])^(1/3);
> > 
> >     > >        s0[i]=(dratio[i]*dratio[i-1])^(1/2);
> > 
> >     > > }
> > 
> >     > > PowSmooth=(s0+t0)/2;
> > 
> >     > >  
> > 
> >     > > Filter=1;
> > 
> >     > > AddColumn(dratio,"DRATIO");
> > 
> >     > > AddColumn(s0,"SQRT");
> > 
> >     > > AddColumn(t0,"THIRD");
> > 
> >     > > AddColumn(Powsmooth,"PowSmooth");
> > 
> >     > > Plot(dratio,"dratio",1,8);
> > 
> >     > > Plot(PowSmooth,"PowSmooth",7,1);
> > 
> >     > >  
> > 
> >     > > RRR=Powsmooth;// Replace this line with RRR=dratio; to see 
> the 
> > 
> >     usual
> > 
> >     > > Dratioresults
> > 
> >     > > D1=35;
> > 
> >     > > F1=RRR>=D1;F2=RRR<=D1;
> > 
> >     > > Sell=F2;Buy=F1;Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);
> > 
> >     > > Short=Sell;Cover=Buy;Short=ExRem(Short,Cover);Cover=ExRem
> > 
> >     > (Cover,Short);
> > 
> >     > >  
> > 
> >     > > Regards,
> > 
> >     > > Peter
> > 
> >     > >  
> > 
> >     > > -----Original Message-----
> > 
> >     > > From: Dimitris Tsokakis [mailto:TSOKAKIS@x...] 
> > 
> >     > > Sent: Saturday, May 10, 2003 7:19 AM
> > 
> >     > > To: amibroker@xxxxxxxxxxxxxxx
> > 
> >     > > Subject: [amibroker] The use of the Powsmooth
> > 
> >     > >  
> > 
> >     > > The basic property of the Powsmooth 
> > 
> >     > > http://groups.yahoo.com/group/amibroker/message/40077
> > 
> >     > > is to filter out fast zigzags, passing through them, 
> without 
> > 
> >     > introducing
> > 
> >     > > important lags.
> > 
> >     > > When we use a cross level trading system, many times we 
> loose 
> > 
> >     money
> > 
> >     > > because of oscillation of our indicator around the
> > 
> >     > > critical cross level. 
> > 
> >     > > If our cross level is "good", then we should expect [and we 
> shall
> > 
> >     > > see...] strong ask and bid when we are close to this level. 
> > 
> >     > > The result is the well known repeated whipsaws, which 
> usually 
> > 
> >     > annihilate
> > 
> >     > > our profits.
> > 
> >     > > Unfortunately, the solution is not to smooth our nervous 
> > 
> >     indicator, 
> > 
> >     > it
> > 
> >     > > will usually loose its charm to catch quickly the market 
> changes.
> > 
> >     > > In this case [traders who use fast indicators will 
> understand 
> > 
> >     very 
> > 
> >     > well
> > 
> >     > > this syndrom...] the PowSmooth may offer great assistance.
> > 
> >     > > Its smart curve will gently pass between the accumulated 
> ziggy 
> > 
> >     > points,
> > 
> >     > > avoid cascade entries/exits and substantially increase our 
> > 
> >     profits.
> > 
> >     > > See a characteristic example in the att. gif.
> > 
> >     > > In the first case, the dratio gives 8 trades in two months, 
> with 
> > 
> >     a 
> > 
> >     > final
> > 
> >     > > +13%, oscillating around the critical level D=35.
> > 
> >     > > The PowSmooth, for the same ^NDX period, gives two clear 
> trades 
> > 
> >     and
> > 
> >     > > maximizes the profits to +20%.
> > 
> >     > > [settings buy/sell/short/cover at +1open, commission 0.5%, 
> stops
> > 
> >     > > disabled]
> > 
> >     > > The level D=35 is critical for the market, the D_ratio 
> frequntly
> > 
> >     > > oscillates up and down, until the market takes the decision 
> to go 
> > 
> >     > higher
> > 
> >     > > or lower. 
> > 
> >     > > The usual D_ratio system gives for the whole market nice 
> profits, 
> > 
> >     > +340%
> > 
> >     > > since Jan2000.
> > 
> >     > > The PowSmooth D_datio makes the difference : +940% for the 
> same 
> > 
> >     > period
> > 
> >     > > and settings.
> > 
> >     > > For ^NDX we could nearly double the profits:
> > 
> >     > > Usual D_ratio : +550%, 37trades/28winners/9losers
> > 
> >     > > PowSmooth : +1165%, 27trades/23winners/4losers.
> > 
> >     > > A +550% is not that bad, a +1165% is much better.
> > 
> >     > > For CSCO, the signal generator of this transcendental 
> system 
> > 
> >     [since 
> > 
> >     > we
> > 
> >     > > "borrow" CSCO data for the basic curve] the situation needs
> > 
> >     > > no further comments : the comparison is +370% vs +2000%.
> > 
> >     > > If you use fast and ziggy indicators and Cross level 
> systems, 
> > 
> >     take a
> > 
> >     > > look at the PowSmooth, it may make you smile.
> > 
> >     > > Dimitris Tsokakis
> > 
> >     > > I use the trancendental CSCO D_ratio code
> > 
> >     > > /*Powsmooth CSCO D_ratio, written and used by D.Tsokakis, 
> Sept 
> > 
> >     > 2002*/
> > 
> >     > > H=Foreign("CSCO","H");L=Foreign("CSCO","L");
> > 
> >     > > dratio=DEMA(1000*(H-L)/(H+L),20);
> > 
> >     > > EnableScript("jscript");
> > 
> >     > > <%
> > 
> >     > > dratio = VBArray( AFL( "dratio" ) ).toArray();
> > 
> >     > > s=new Array();t=new Array();
> > 
> >     > > s[0]=0;t[0]=0;
> > 
> >     > > for(i=1;i<dratio.length;i++)
> > 
> >     > > {
> > 
> >     > > {t[i]=Math.pow((dratio[i]*dratio[i-1]*dratio[i-2]),1/3);}
> > 
> >     > > {s[i]=Math.pow((dratio[i]*dratio[i-1]),1/2);}
> > 
> >     > > }
> > 
> >     > > AFL.Var("s0") =s ;
> > 
> >     > > AFL.Var("t0")=t;
> > 
> >     > > %>
> > 
> >     > > Powsmooth=(s0+t0)/2;
> > 
> >     > > RRR=Powsmooth;// Replace this line with RRR=dratio; to see 
> the 
> > 
> >     usual
> > 
> >     > > Dratioresults
> > 
> >     > > D1=35;
> > 
> >     > > F1=RRR>=D1;F2=RRR<=D1;
> > 
> >     > > Sell=F2;Buy=F1;Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);
> > 
> >     > > Short=Sell;Cover=Buy;Short=ExRem(Short,Cover);Cover=ExRem
> > 
> >     > (Cover,Short);
> > 
> >     > > 
> > 
> >     > > 
> > 
> >     > > 
> > 
> >     > > 
> > 
> >     > > Yahoo! Groups Sponsor
> > 
> >     > > 
> > 
> >     > >  
> > 
> >     > > 
> > 
> >     > 
> > 
> >     
> <http://rd.yahoo.com/M=251812.3170658.4537139.1261774/D=egroupweb/S=17
> > 
> >     > 05
> > 
> >     > > 632198:HM/A=1564415/R=0/*http:/www.netflix.com/Default?
> > 
> >     > mqso=60164784&par
> > 
> >     > > tid=3170658> 
> > 
> >     > > 
> > 
> >     > >  
> > 
> >     > > <http://us.adserver.yahoo.com/l?
> > 
> >     > M=251812.3170658.4537139.1261774/D=egrou
> > 
> >     > > pmail/S=:HM/A=1564415/rand=998789952> 
> > 
> >     > > 
> > 
> >     > > Send BUG REPORTS to bugs@xxxx
> > 
> >     > > Send SUGGESTIONS to suggest@xxxx
> > 
> >     > > -----------------------------------------
> > 
> >     > > 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!
> > 
> >     > > <http://docs.yahoo.com/info/terms/>  Terms of Service.
> > 
> >     > 
> > 
> >     > 
> > 
> >     > 
> > 
> >     > Send BUG REPORTS to bugs@xxxx
> > 
> >     > Send SUGGESTIONS to suggest@xxxx
> > 
> >     > -----------------------------------------
> > 
> >     > 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
> > 
> >     > http://docs.yahoo.com/info/terms/
> > 
> >      
> > 
> >      
> > 
> >     ------------------------ Yahoo! Groups Sponsor -----------------
> ----~-->
> > 
> >     Rent DVDs from home.
> > 
> >     Over 14,500 titles. Free Shipping
> > 
> >     & No Late Fees. Try Netflix for FREE!
> > 
> >     http://us.click.yahoo.com/BVVfoB/hP.FAA/uetFAA/GHeqlB/TM
> > 
> >     ----------------------------------------------------------------
> -----~->
> > 
> >      
> > 
> >     Send BUG REPORTS to bugs@xxxx
> > 
> >     Send SUGGESTIONS to suggest@xxxx
> > 
> >     -----------------------------------------
> > 
> >     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 
> http://docs.yahoo.com/info/terms/ 
> > 
> >      
> > 
> > 
> > 
> >     Send BUG REPORTS to bugs@xxxx
> >     Send SUGGESTIONS to suggest@xxxx
> >     -----------------------------------------
> >     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. 
> > 
> > 
> > 
> > 
> > 
> >   Send BUG REPORTS to bugs@xxxx
> >   Send SUGGESTIONS to suggest@xxxx
> >   -----------------------------------------
> >   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. 
> > 
> > 
> > 
> > 
> >         Yahoo! Groups Sponsor 
> >        
> >        
> > 
> >   Send BUG REPORTS to bugs@xxxx
> >   Send SUGGESTIONS to suggest@xxxx
> >   -----------------------------------------
> >   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.
> 
> 
> 
> 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 http://docs.yahoo.com/info/terms/ 
> 
> 
> 

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs Online - Over 14,500 titles.
No Late Fees & Free Shipping.
Try Netflix for FREE!
http://us.click.yahoo.com/YoVfrB/XP.FAA/uetFAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/