[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

Hello,

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

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

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

herman



SetBarsRequired(1000000,1000000);

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

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

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

BI = BarIndex();



b = SelectedValue(BI);

x0 = BI[b];

x1 = x0+Pd;

y0 = H[b];

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

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

LineH = Ref(Line,-D);

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



b = SelectedValue(BI);

x0 = BI[b];

x1 = x0+Pd;

y0 = L[b];

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

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

LineL = Ref(Line,-D);

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



Buy=Sell=Short=Cover=0;

SetBarsRequired(1000000,1000000);

SetOption("AllowSameBarExit",True );

SetOption("PriceBoundChecking",False);



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



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

BuyPrice = Max(O,LineH);

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

SellPrice = Min(O,LineL);



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

   {

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

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

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

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

   }



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


Hi Ara,

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

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

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

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

Yuki

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

AK> BlankHerman,

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

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


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

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

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

AK>   best regards,
AK>   herman




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


AK>     Herman,

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

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

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


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

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

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

AK>       best regards,

AK>       herman

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


AK>


Best,

Yuki



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

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

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

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

Yahoo! Groups Links






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