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

Re: [amibroker] Real-Time Heat-Map (was:Displaying HOT-> COLD RGB colors)



PureBytes Links

Trading Reference Links

Hi Herman,

I can only see a tiny piece of that chart, but it doesn't look like
either a wedge or a range to me.  It looks to me like an extremely
powerful bull flag, if the bar I can only partially see on the left
was big up, or the last component of several strong bars.

By bars 6 to 8, I'd make a pretty good bet that buying near the
bottom of this formation would be the thing to do.  Another break
higher is almost a certainty, and I would not want to wait for it,
because, like bars 9 and 10 show you, if your lines are arbitrary or
too tight, you'll get put in higher than advisable, and have to
endure bar 12's low, which may not be too comfortable in that case.

In every situation where direction is relatively discernable, you
have to buy the counter impulses, not the impulses that are aligned
with primary direction.  This is what gives you the ability to hang
on, and why I say entries are just as important, if not more
important, than exits. I know many disagree, but I win two-thirds of
my bets, so there.  ^_^

What you have to say here (again, I can't see the whole chart, so I'm
just guessing that the left-most bar is some kind of breakout) is a
situation where you say, "Okay Mr. Market, the direction is up.  Even
though you look like you threaten to change that direction
immediately, you usually can't make it stick, so show me. I'm buying
the counter impulses to the main direction until you really show me
I'm wrong."

By buying the counter impulses, you are going to be "less wrong"
(capital-wise) than the folks who buy near the top of this formation,
should it indeed fall apart.  You can buy bar 9, but you want to buy
somewhere down where the inevitable bar 12 low won't rout you. Bar 10
is mostly a sucker's play, IMHO.

This is what trading is, and you'll be right more often than wrong.
You don't want to be in a position to get knocked out just below the
lows of an important formation that looks like it's a 75 percent bet
to ultimately break higher.  You want to buy other people's weak
stop-losses.  They are *always* out there, and they are *always*
going to be gunned for.  You need patience, then guts coupled with
action.

If you look at that flag closely, you will see there is no "safe
place" to buy ... other than the moment when uncertainty is gripping
most, when it looks like the formation is threatening to fail.  Bar
12 is hell to live through unless you are in near the lower side of
the formation. (No scale, so I don't know how much hell we might be
talking about.) But note that there is almost always a "bar 12", with
its last offer to sell just in time to miss the departing train. Even
if you buy the real breakout at bar 14, bar 15 may not be too much
fun to experience, and even the early morning of bar 16 is going
offer at least some small test of resolve -- if you waited to buy bar
14.  Basically a bar 14 buy is okay, but you could, and IMHO should,
be in cheaper, so that bars 15 and higher are just plain fun.

I'd love to see the whole chart.  What I imagine is going on is that
the same players who delivered bar 1 are simply adjusting their risk
during the next three weeks.  They are buying low over and over in
that formation, and selling every rally toward the top.  When they
feel that their risk has been sufficiently dampened, they suddenly
stop selling the petty rallies, and up we go.

And no, the EOD charts still look pretty much the same to me.  Less
noisy than intraday, noisier than weekly.  ^_^

One difference I notice however, is that a formation like this one
(if it's a bull flag), used to unfold a bit faster.  Now,
institutions are so huge, and position sizes so monstrous, that it
takes longer to work a big position the way it needs to be worked.
And with so many smaller-but-computer-equipped retail players
watching every move, the big players have to stretch it out a bit,
and employ as much subterfuge as they can.

But it's really hard to hide big money.  The only way to have a real
chance to do it is to stretch out the time frame so that people lose
interest or stop paying attention.  That also encourages corrections
that dip below many risk tolerances.

It's a wonderful game, this business.  ^_-

Yuki

Monday, January 8, 2007, 9:16:30 AM, you wrote:

H> Hello,

H> I have been looking through some EOD data (first time in years) and somehow
H> it seems there are far fewer wedges and ranges than I seem to recall from
H> long ago... true?

H> Anyway it poses an interesting challenge. First thought is to draw two
H> linear regression lines, one for the High and one for the Low, or perhaps
H> and HHV/LLV to give a bit more room (see code), and use those as a trigger
H> line. As a first qualifier we could use the slope of the lines, for example
H> only triggering up if one or both slope up.  To allow the system to
H> accumulate breakout potential we might want to make the period adaptive and
H> increase it while the two lines remain nearly horizontal. Perhaps this could
H> be used to control position size?
H> Below some code to play with...just click on the  chart and use the cursors
H> to move the pair of lines across the bars. Open Param to set period/delay.
H> It should look like that below, this is NOT a system, just some trial code
H> to explore breakout detection.

H> If anyone has ideas to further develop this, let me know :-) Thanks for your
H> suggestions thus far Yuki!

H> herman



H> SetBarsRequired(1000000,1000000);

H> Pd = Param("PD",5,1,20,1);

H> D = Param("D",1,0,10,1);

H> Plot(C,"",1,128);

H> BI = BarIndex();



H> b = SelectedValue(BI);

H> x0 = BI[b];

H> x1 = x0+Pd;

H> y0 = H[b];

H> y1 = LastValue(ValueWhen(x1==bi,LinearReg(HHV(H,2),Pd-1)));

H> Line = LineArray( x0, y0, x1, y1, 0, 0 );

H> LineH = Ref(Line,-D);

H> Plot(LineH,"",5,1);



H> b = SelectedValue(BI);

H> x0 = BI[b];

H> x1 = x0+Pd;

H> y0 = L[b];

H> y1 = LastValue(ValueWhen(x1==bi,LinearReg(LLV(L,2),Pd-1)));

H> Line = LineArray( x0, y0, x1, y1, 0, 0 );

H> LineL = Ref(Line,-D);

H> Plot(LineL,"",4,1);



H> Buy=Sell=Short=Cover=0;

H> SetBarsRequired(1000000,1000000);

H> SetOption("AllowSameBarExit",True );

H> SetOption("PriceBoundChecking",False);



H> //Plot(LinearReg(Ref(H,-D),Pd),"",2,1);



H> Buy = Cross(H,LineH) AND ROC(LineH,1)>0;

H> BuyPrice = Max(O,LineH);

H> Sell=Cross(LineL,L) AND ROC(LineH,1)<0;

H> SellPrice = Min(O,LineL);



H> if( PlotRawTriangles = ParamToggle("Raw Triangles","HIDE|SHOW",1) )

H>    {

H>    PlotShapes(IIf(Buy,    shapeSmallUpTriangle, shapeNone),5,0,BuyPrice,0);

H>    PlotShapes(IIf(Sell,   shapeHollowDownTriangle,
H> shapeNone),4,0,SellPrice,0);

H>    PlotShapes(IIf(Cover, shapeHollowUpTriangle,
H> shapeNone),5,0,CoverPrice,0);

H>    PlotShapes(IIf(Short, shapeSmallDownTriangle,
H> shapeNone),4,0,ShortPrice,0);

H>    }



H> -----Original Message-----
H> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]On
H> Behalf Of Yuki Taga
H> Sent: January 7, 2007 6:00 PM
H> To: Ara Kaloustian
H> Subject: Re: [amibroker] Real-Time Heat-Map (was:Displaying HOT-> COLD
H> RGB colors)


H> Hi Ara,

H> What's with all this Blank(Name) business, anyway?  ^_^

H> To venture an answer to your question, I don't think one can predict
H> a breakout.  But one can know that breakouts overwhelmingly spring
H> from periods of consolidating volatility.  When?  We don't know.  But
H> breakouts very rarely come out of periods of relative high
H> volatility.

H> So we watch when things get quiet, and we wait.  It can really put
H> you to sleep sometimes, because it's a waiting game, that suddenly
H> and with little warning becomes an action game.  People tend to
H> prefer action to waiting.  Waiting is somewhat boring.

H> To compound the difficulties, not all breakouts go on to do great
H> things.  Some fail.  This can cause hesitation just at the time
H> action is finally required.  The way to overcome the hesitation is to
H> have the entire plan ready before the alarm bell (finally) rings. Not
H> half the plan ("I need to buy something."), but how much I'm going to
H> buy, what is my ultimate objective (not just "to make some money"),
H> and specific actions I'm going to take contingent on what price and
H> volume do. Since they can do several things, I need several plans. We
H> need a plan for being wrong, a plan for being modestly right, and a
H> plan for being spectacularly right. Impromptu doesn't keep the sushi
H> from sliding off the rice.  ^_^

H> Yuki

H> Monday, January 8, 2007, 4:40:49 AM, you wrote:

H> AK> BlankHerman,

H> AK> for market volatiity, I use Bollinger bands. Easy to determine
H> AK> volatility by looking at delta between top and botom withrespect
H> AK> to last price.... or any other statistical means ... but how
H> AK> would one relate market pressure to predict breakout ???

H> AK> Ara
H> AK>   ----- Original Message -----
H> AK>   From: Herman
H> AK>   To: amibroker@xxxxxxxxxxxxxxx
H> AK>   Sent: Sunday, January 07, 2007 10:30 AM
H> AK>   Subject: RE: [amibroker] Real-Time Heat-Map (was:Displaying HOT-> COLD
H> RGB colors)


H> AK>   Ara, last year I tried to get High-Frequency trading to work
H> AK> but after spending quite a bit of time on it, I found that the
H> AK> data delays/flaws and the divergence of Backtesting result wrt
H> AK> Real-Trading results were insurmountable. Automated
H> AK> trade-executions were not the problem, that worked fine. It was a
H> AK> disappointment... anyway, I decided to set the limit for
H> AK> development at the 1-Minute timeframe; this is approximately
H> AK> where developmental results (for me) diverge from reality.  I
H> AK> still will be using AT but not in the 5-sec TimeFrame.

H> AK>   Right now i am exploring different options, not sure where
H> AK> I'll be heading. I tried to make a map that would display
H> AK> short-termtrends (like a continuous real-time scan). Such a map
H> AK> would give me a visual presentation of overall market activity.
H> AK> Backtesting doesn't give me a feel for how often and for which
H> AK> stocks tradable events happen in Real Time. A map can show short
H> AK> term conditions/signal/trade activity for 100 stocks at a glance!
H> AK> Like stars sparkling in the sky :-) It gives me a much better
H> AK> appreciation for market activity. The maps are also usefull for
H> AK> other purposes, like to display order/system status and/or
H> AK> portfolio/account status. I prefer everything in one window.

H> AK>   On the other list Yuki suggested looking at narrowing
H> AK> volatility and I though that was a good idea. It would be neat to
H> AK> have maps that change color as market pressure for a breakout
H> AK> builds up... but I haven't had a chance to look at this yet. To
H> AK> many ideas but not enough time...

H> AK>   best regards,
H> AK>   herman




H> AK>     -----Original Message-----
H> AK>     From: amibroker@xxxxxxxxxxxxxxx
H> AK> [mailto:amibroker@xxxxxxxxxxxxxxx]On Behalf Of Ara Kaloustian
H> AK>     Sent: January 7, 2007 11:41 AM
H> AK>     To: amibroker@xxxxxxxxxxxxxxx
H> AK>     Subject: Re: [amibroker] Real-Time Heat-Map (was:Displaying HOT->
H> COLD RGB colors)


H> AK>     Herman,

H> AK>     Heat map makes visual very easy ....

H> AK>     Are you getting away from full auto trade?  Is the heat map
H> AK> approach preferred to auto trade?

H> AK>     Ara
H> AK>       ----- Original Message -----
H> AK>       From: Herman
H> AK>       To: AmiBroker YahooGroups
H> AK>       Sent: Sunday, January 07, 2007 5:23 AM
H> AK>       Subject: [amibroker] Real-Time Heat-Map (was:Displaying HOT-> COLD
H> RGB colors)


H> AK>       Actually this is just my first try and the code is still
H> AK> evolving. We used to do this type of tabling with AA Explorations
H> AK> however for Real-Time applications I prefer the display on the
H> AK> chart. I would like to use it for portfolio trading to show me
H> AK> where the action is (in Real-Time) wrt my criteria. To reduce
H> AK> processing overhead I would map only tickers that meet my criteria.

H> AK>       I thought perhaps some others might see new applications
H> AK> for this type of display, write a standard function to display
H> AK> different types of maps that can be selected from the param window.

H> AK>       I still have some trouble automatically scaling the Hue,
H> AK> this requires normalizing and scaling the range, also I would
H> AK> like to have a sort function so that hot-cold are located at diagonally
H> opposite corners.

H> AK>       best regards,

H> AK>       herman

H> AK>       --- In amibroker@xxxxxxxxxxxxxxx, "cstrader" <cstrader232@xxx>
H> wrote:
H> AK>       >
H> AK>       > Herman:  You and Amibroker make a great combination!
H> AK> Very cool (and hot, I suppose) work.
H> AK>       >
H> AK>       > Do you use the heat map as an index of the market
H> AK> internals for trading indices, or do you use it for trading individual
H> stocks?
H> AK>       >
H> AK>       > chuck
H> AK>       >
H> AK>       >
H> AK>       >   ----- Original Message -----
H> AK>       >   From: Herman
H> AK>       >   To: AmiBroker YahooGroups
H> AK>       >   Sent: Saturday, January 06, 2007 10:50 AM
H> AK>       >   Subject: [amibroker] Real-Time Heat-Map
H> AK> (was:Displaying HOT-> COLD RGB colors)
H> AK>       >
H> AK>       >
H> AK>       >   Thanks for the help, TJ and others!
H> AK>       >
H> AK>       >   I needed a Heat-Map that refreshes during real-time
H> AK> trading. Below is what I have thus far. It uses dummy data: you
H> AK> must define VarToMap. To save time I set it to refresh each 5 seconds.
H> AK>       >   The Ticker order is important for me, hence I plotted both
H> upper and lower sections.
H> AK>       >
H> AK>       >   Any tips on how to make this work under Quick-AFL or
H> AK> make it faster in other ways would be appreciated.
H> AK>       >
H> AK>       >   best regards,
H> AK>       >   herman
H> AK>       >
H> AK>       >
H> AK>       >
H> AK>       >   // Heat-Map by Herman - 06DEC2007 - TEST/DEMO ONLY!
H> AK>       >
H> AK>       >   // Set Param -> Axis & Grid: NO Middle Lines
H> AK>       >
H> AK>       >   // Convert Variable-To-Map to 0-99 range
H> AK>       >
H> AK>       >   // Zoom Chart to get nice display
H> AK>       >
H> AK>       >
H> AK>       >
H> AK>       >   SetBarsRequired(1000000,1000000);
H> AK>       >
H> AK>       >   GraphXSpace = 0;
H> AK>       >
H> AK>       >   GraphZOrder = False;
H> AK>       >
H> AK>       >   SetChartOptions( 3, chartShowDates);
H> AK>       >
H> AK>       >   RequestTimedRefresh( MApRefreshInterval = 5 );
H> AK>       >
H> AK>       >   RefreshMap     = Status("redrawaction");
H> AK>       >
H> AK>       >   WLNum          = Param("WatchList Number",0,0,64,1);
H> AK>       >
H> AK>       >   TickersToMap   = Param("Num. Tickers to Map",10,1,64,1);
H> AK>       >
H> AK>       >   MaxTickers     = Param("Max. Tickers",50,2,100,1);
H> AK>       >
H> AK>       >   MaxHue         = Param("Max. Hue",255,0,255,1);
H> AK>       >
H> AK>       >   MinHue         = Param("Min. Hue",97,0,255,1);
H> AK>       >
H> AK>       >
H> AK>       >
H> AK>       >   if( RefreshMap )
H> AK>       >
H> AK>       >      {
H> AK>       >
H> AK>       >      TickersToMap   = Min(TickersToMap, MaxTickers);
H> AK>       >
H> AK>       >      List           = CategoryGetSymbols( categoryWatchlist,
H> WLNum );
H> AK>       >
H> AK>       >      MaxList = "";
H> AK>       >
H> AK>       >      for( T=0; (Ticker=StrExtract( List, T))!= "" AND T <
H> TickersToMap; T++)
H> AK>       >
H> AK>       >         {
H> AK>       >
H> AK>       >         MaxList = MaxList + Ticker +",";
H> AK>       >
H> AK>       >         StaticVarSetText("Ticker"+T, Ticker);
H> AK>       >
H> AK>       >         }
H> AK>       >
H> AK>       >      StaticVarSetText("MaxList",MaxList);
H> AK>       >
H> AK>       >      BI                = BarIndex();
H> AK>       >
H> AK>       >      MaxYCoordinate    = TickersToMap;
H> AK>       >
H> AK>       >      MinYCoordinate    = 1;
H> AK>       >
H> AK>       >      MinXBarindex      = BarCount-TickersToMap;
H> AK>       >
H> AK>       >      MaxXBarindex      = BarCount-1;
H> AK>       >
H> AK>       >      CellCount = 0;
H> AK>       >
H> AK>       >      XCoordinate = YCoordinate = 0;
H> AK>       >
H> AK>       >      MaxList = StaticVarGetText("MaxList");
H> AK>       >
H> AK>       >      for( Y=MinYCoordinate; Y <= TickersToMap; Y++ )
H> AK>       >
H> AK>       >         {
H> AK>       >
H> AK>       >         for( X=MinXBarindex; X <= MaxXBarindex; X++ )
H> AK>       >
H> AK>       >            {
H> AK>       >
H> AK>       >            XTicker =
H> StaticVarGetText("Ticker"+XCoordinate);
H> AK>       >
H> AK>       >            YTicker =
H> StaticVarGetText("Ticker"+YCoordinate);
H> AK>       >
H> AK>       >            VarToMap = CellCount; // must be in range 0-99
H> AK>       >
H> AK>       >            StaticVarSet(XTicker+"-"+YTicker, VarToMap);
H> AK>       >
H> AK>       >            XCoordinate++;
H> AK>       >
H> AK>       >            CellCount++;
H> AK>       >
H> AK>       >            }
H> AK>       >
H> AK>       >         XCoordinate=0;
H> AK>       >
H> AK>       >         YCoordinate++;
H> AK>       >
H> AK>       >         }
H> AK>       >
H> AK>       >      }
H> AK>       >
H> AK>       >
H> AK>       >
H> AK>       >   Plot(-1,"",1,styleNoLine|styleNoLabel);
H> AK>       >
H> AK>       >   Plot(TickersToMap,"",1,styleNoLine|styleNoLabel);
H> AK>       >
H> AK>       >   BI                = BarIndex();
H> AK>       >
H> AK>       >   MaxYCoordinate    = TickersToMap;
H> AK>       >
H> AK>       >   MinYCoordinate    = 1;
H> AK>       >
H> AK>       >   MinXBarindex      = BarCount-TickersToMap;
H> AK>       >
H> AK>       >   MaxXBarindex      = BarCount-1;
H> AK>       >
H> AK>       >   YStep             = int(MaxYCoordinate/TickersToMap);
H> AK>       >
H> AK>       >   XCoordinate = YCoordinate = 0;
H> AK>       >
H> AK>       >   for( Y=MinYCoordinate; Y<=MaxYCoordinate; Y++ )
H> AK>       >
H> AK>       >      {
H> AK>       >
H> AK>       >      for( X = MinXBarindex; X <= MaxXBarindex; X++ )
H> AK>       >
H> AK>       >         {
H> AK>       >
H> AK>       >         XTicker   =
H> StaticVarGetText("Ticker"+XCoordinate);
H> AK>       >
H> AK>       >         YTicker   =
H> StaticVarGetText("Ticker"+YCoordinate);
H> AK>       >
H> AK>       >         VarToMap  = StaticVarGet(XTicker+"-"+YTicker);
H> AK>       >
H> AK>       >         HueStep   = (MaxHue - MinHue)/100;
H> AK>       >
H> AK>       >         Co =
H> AK> ColorHSB(Min(255,int((100-VarToMap)*HueStep)),255,255);
H> AK>       >
H> AK>       >         PlotText(NumToStr(VarToMap,1.0),X,Y-0.5,1);
H> AK>       >
H> AK>       >         if( XTicker == YTicker ) Co = colorBlack;
H> AK>       >
H> AK>       >
H> AK>
H> Plot(IIf(X==BI,Y,Null),"",Co,styleArea|styleOwnScale|styleNoLabel,-1,MaxYCoo
H> rdinate*1.03);
H> AK>       >
H> AK>       >         XCoordinate++;
H> AK>       >
H> AK>       >         }
H> AK>       >
H> AK>       >      XCoordinate = 0;
H> AK>       >
H> AK>       >      YCoordinate++;
H> AK>       >
H> AK>       >      }
H> AK>       >
H> AK>       >
H> AK>       >
H> AK>       >   for(T=0; T<=TickersToMap; T++)
H> AK>       >
H> AK>       >      {
H> AK>       >
H> AK>       >      Ticker = StaticVarGetText("Ticker"+T);
H> AK>       >
H> AK>       >      PlotText(Ticker,BarCount,T+0.5,1);
H> AK>       >
H> AK>       >     
H> PlotText("\n"+Ticker,BarCount-TickersToMap+T,-0.5,1);
H> AK>       >
H> AK>       >      }
H> AK>       >
H> AK>       >
H> AK>       >
H> AK>       >   MaxList = StaticVarGetText("MaxList");
H> AK>       >
H> AK>       >   Title = "Heat Map for Watchlist
H> AK> #"+NumToStr(WLNum,1.0,False)+": "+MaxList;
H> AK>       >


H> AK>


H> Best,

H> Yuki



H> Please note that this group is for discussion between users only.

H> To get support from AmiBroker please send an e-mail directly to
H> SUPPORT {at} amibroker.com

H> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
H> http://www.amibroker.com/devlog/

H> For other support material please check also:
H> http://www.amibroker.com/support.html

H> Yahoo! Groups Links




 
Best,

Yuki


Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.7/618 - Release Date: 1/6/2007 7:47 PM