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

Re: [amibroker] Re: Scalping Using RT Tick Data



PureBytes Links

Trading Reference Links

Dave,
I saw your code, the concept has some problems indeed.
The Hide(var,d) does not have these problems, no strange zeros/peaks 
etc, it just does what promisses, hiding the last d bars of a n y 
variable var. Try both codes and you will see the difference.
The rest is a matter of taste.
Dimitris Tsokakis

--- In amibroker@xxxxxxxxxxxxxxx, "Dave Merrill" <dmerrill@xxxx> 
wrote:
> Thanks for chiming in Dimitris, but with all due respect, this is 
the same
> idea that I originally said has problems when I asked the question, 
and the
> same as what Graham suggested. Did you look at the code I posted? 
The
> function Blank() in there does this too. Yes, it's workable if you 
modify
> every indicator on every pane where you want to do this, but that's 
not
> ideal.
> 
> Dave
>   --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" 
<TSOKAKIS@xxxx>
>   wrote:
>   > Dave,
>   > There is no problem to hide any last d bars of OHLC or any other
>   > indicator.
>   > [d should be the same for OHLC  but, it may be different for 
each
>   > indicator ]
>   >
>   > // Definition of Hide() function
>   > function Hide(Var,d)
>   > {
>   > newvar=0;
>   > newvar=IIf(Cum(1)<=LastValue(Cum(1))-d,Var,Null);
>   > return newvar;
>   > }
>   > //Applications
>   > p=5;
>   > O1=Hide(O,p);
>   > H1=Hide(H,p);
>   > L1=Hide(L,p);
>   > C1=Hide(C,p);
> 
>   PlotOHLC(O1,H1,L1,C1,"c",1,styleCandle);
> 
>   > Plot(Hide(MACD(),2*p),"MACD",colorRed,styleLeftAxisScale);
>   > Plot(Hide(Signal(),2*p-
1),"SIGNAL",colorBlue,styleLeftAxisScale);
>   >
>   > Dimitris Tsokakis
>   > --- In amibroker@xxxxxxxxxxxxxxx, "Dave Merrill" <dmerrill@xxxx>
>   > wrote:
>   > > Thanks for your reply Graham, but as I mentioned, I've tried
>   that,
>   > and it
>   > > has problems.
>   > >
>   > > Try the more complete setup below, with a couple of random
>   > indicators added.
>   > > Everything's fine with nothing blanked. Blank out one bar, and
>   the
>   > price
>   > > plot still looks fine, but MACD and RSI spike to zero on the 
null
>   > price
>   > > bars, causing them to rescale, the MACD illegibly. Blank a few
>   more
>   > bars,
>   > > past a SAR cross, and SAR does the same thing.
>   > >
>   > > For another approach, comment out the BlankAll() line, and re-
>   enable
>   > > BlankAll2(), on the next line. This shifts everything to the
>   > right, "off the
>   > > page", and then back. I tried this because that seemed very
>   > analgous to
>   > > those bars really not existing. Turns out that AB seems to 
treat
>   > them as
>   > > missing data (makes sense), and uses the existing last value 
for
>   > the missing
>   > > bars.
>   > >
>   > > Is there a way to work around all this? Of course, blank the
>   > indicators too.
>   > > But that means you have to recode every indicator on any pane 
you
>   > want to do
>   > > this with.
>   > >
>   > > I'd much rather just drop in a single function to adjust the
>   price
>   > bars, and
>   > > have everything just work. But setting things to null doesn't
>   > really do it.
>   > > Any other ideas on a good blanking mechanism?
>   > >
>   > > What I'd really like is a built in feature that handled this
>   > automatically,
>   > > including blanking BuyPrice, ShortPrice etc, and any new 
built in
>   > variables
>   > > as they get added.
>   > >
>   > > Clearer?
>   > >
>   > > Dave
>   > >
>   > > ---------------
>   > > global gBI, gBarsBlanked;
>   > >
>   > > gBarsBlanked = Param( "bars", 0, 100, 0, -1);
>   > > gBI = BarIndex();
>   > >
>   > > function IsBlanked() {
>   > >  return gBI >= (BarCount - gBarsBlanked);
>   > > }
>   > > function Blank(array) {
>   > >  x = IIf(IsBlanked(), Null, array);
>   > >  return x;
>   > > }
>   > > function Blank2(array) {
>   > >  x = Ref(Ref(array, -gBarsBlanked), gBarsBlanked);
>   > >  return x;
>   > > }
>   > > function BlankAll() {
>   > >  O = Blank(O); H = Blank(H); L = Blank(L); C = Blank(C);
>   > >  Avg = Blank(Avg); V = Blank(V);
>   > > }
>   > > function BlankAll2() {
>   > >  O = Blank2(O); H = Blank2(H); L = Blank2(L); C = Blank2(C);
>   > >  Avg = Blank2(Avg); V = Blank2(V);
>   > > }
>   > > function OHLCTitle() {
>   > >  return
>   > >   Interval(2) + " " + Date()
>   > >   + " Open = " + O
>   > >   + ", High = " + H
>   > >   + ", Low = " + L
>   > >   + ", Close";
>   > > }
>   > >
>   > > BlankAll();
>   > > //BlankAll2();
>   > >
>   > > GraphXSpace = 5;
>   > > Plot(C, OHLCTitle(), colorDefault, styleCandle);
>   > > Plot(V, "Volume", colorBlue, styleHistogram+styleOwnScale, 0,
>   > > LastValue(Highest(V)) * 2);
>   > > //Plot(IIf(IsBlanked(), 1, 0), "", colorLightGrey,
>   > > styleArea+styleOwnScale+styleNoLabel, 0, .5);
>   > >
>   > > m = MACD(); r = RSI(); s = SAR();
>   > >
>   > > Plot(m, "MACD", colorBlue, styleOwnScale);
>   > > Plot(r, "RSI", colorRed, styleOwnScale);
>   > > Plot(s, "SAR", colorYellow, styleDots+styleNoLine);
>   > > /*
>   > > Plot(Blank(m), "MACD", colorBlue, styleOwnScale);
>   > > Plot(Blank(r), "RSI", colorRed, styleOwnScale);
>   > > Plot(Blank(s), "SAR", colorYellow, styleDots+styleNoLine);
>   > > */
>   > >
>   > > ---------------
>   > >   Try this as an example
>   > >
>   > >   x = Param( "bars", 1, 1, 10, 1);
>   > >
>   > >   Plot( IIf( BarIndex()<=BarCount-x, C, Null), "", colorBlack,
>   > styleCandle);
>   > >
>   > >   Cheers,
>   > >   Graham
>   > >   http://e-wire.net.au/~eb_kavan/



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
     amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/