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

Re: [amibroker] Exploration logic



PureBytes Links

Trading Reference Links

Hi Chuck,

i believe there is anything wrong in the loop.
you can check that it works correct by using a simple code:

Title = "Date:  "+Date()+"      Close:"+WriteVal(Close);
Filter = 1;
AddColumn(Close,"Close");

Regards

Thomas
www.tradingbasis.com


Chuck wrote:
Hi Thomas.  OK, you asked!  The idea is to create time at price histograms 
(aka Market Profile).  Seems to work OK in the chart, and prints OK in the 
interpretation window -- However, the exploration values of POC do not match 
the chart values.  Thanks in advance.  Chuck

//////////////////////////////////////////////////////////////////////

//Time at Price Routine (uses 30 minute Timeframe)

//This code to work for ES futures

SetBarsRequired( 1000000, 1000000 );

//Find lowest and highest prices so far in day

Daystart = Cross(TimeNum(),093000);

DayLowPrice = int(LowestSince(DayStart, L));

DayHighPrice = HighestSince(DayStart, H);

Increment = .25; Numperiods = 13;



//Get data from 30 minute timeframe

TimeFrameSet(in1Minute*30);

Daystart2 = Cross(TimeNum(),093000);

Currentbar = BarsSince(Daystart2)+1;

TimeFrameRestore();

Currentbar2 = TimeFrameExpand(Currentbar, in1Minute*30);

BarLow2 = TimeFrameExpand(L, in1Minute*30);

BarHigh2 = TimeFrameExpand(H, in1Minute*30);

//Calculate and print Time at Prices and Point of Control (POC)

PeriodTime = 0; MaxPrice = 0; POC = 0;

for (i = SelectedValue(DayHighPrice) - SelectedValue(DayLowprice); i>=0; 
i=i-Increment) //Loop across prices

{printf ("\n" + WriteVal (Daylowprice+i, 5.2)+ ": ");

for (j = 1; j <= SelectedValue(Min(CurrentBar2, NumPeriods)); j++) //Loop 
across time periods

{

if (j==1) {PeriodTime[i] = 0; }

PriceInPeriod = DayLowprice+i >= ValueWhen(currentBar2 == j, Barlow2) AND 
DayLowprice+i <= ValueWhen(currentBar2 == j, BarHigh2);

PeriodTime[i] = periodtime[i]+SelectedValue(PriceinPeriod); //Sum number of 
times for the price

Char = "";

if (j==1) {Char = "A";} if (j==2) {Char = "B";} if (j==3) {Char = "C";} if 
(j==4) {Char = "D";} if (j==5) {Char = "E";}

if (j==6) {Char = "F";} if (j==7) {Char = "G";} if (j==8) {Char = "H";} if 
(j==9) {Char = "I";} if (j==10) {Char = "J";}

if (j==11) {Char = "K";} if (j==12) {Char = "L";} if (j==13) {Char = "M";}

Char = WriteIf(PriceInPeriod, Char, "");

printf (Char);

}

Tprice=Max(Periodtime[i], Maxprice);

POC = IIf(Periodtime[i] > MaxPrice, DayLowPrice+i, poc);

MaxPrice = TPrice;

}

//////////////////////////////////////////////

Filter = Cross(TimeNum(), 160000);

AddColumn(POC, "POC", format = 8.4);

AddColumn(H, "Hi gh", format = 8.4);

AddColumn(L, "Low", format = 8.4);

AddColumn(C, "Close", format = 8.4);

NumColumns= 4;

//PRINT THE TITLES AND PLOT CANDLES

SetChartOptions(0,chartShowArrows|chartShowDates);

_N(Title = _DEFAULT_NAME() + " {{DATE}} {{INTERVAL}} " +

" H = " + WriteVal(H) +

" L = " + WriteVal(L) +

" C = " + WriteVal(C) +

" POC = " + WriteVal(POC ));

Plot( C, "Close", colorYellow, styleNoTitle | ParamStyle("Style") | 
GetPriceStyle() );

PlotShapes(Cross(TimeNum(), 093000)* shapeSmallCircle, colorYellow, 0, 
Close, Offset=0);

PlotShapes(Cross(TimeNum(), 160000)* shapeSmallCircle, colorWhite, 0, Close, 
Offset = 0);

----- Original Message ----- 
From: "Thomas Z" <tzg@xxxxxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, October 29, 2005 10:18 AM
Subject: Re: [amibroker] Exploration logic


  
Hi Chuck,

yes, normally it works this way.
Send the code so we can tell you or find the reason.

Regards

Thomas
www.tradingbasis.com



Chuck wrote:
    
I figured that running exploration with filter = 1 and "all quotations"
selected was equivalent to moving the cursor bar across the entire chart.
So whatever calculated values show up when the cursor is over a given bar
should be the same as those reported on the exploration.  I'm finding 
this
is not the case.  Does anyone know why this might be happening?

Barry suggested adding the line:

SetBarsRequired( 1000000, 1000000 );

But that doesn't change anything.



Thanks in advance




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 other support material please check also:
http://www.amibroker.com/support.html


Yahoo! Groups Links








      

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 other support material please check also:
http://www.amibroker.com/support.html


Yahoo! Groups Links







    



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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 other support material please check also:
http://www.amibroker.com/support.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/
 



  


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 other support material please check also:
http://www.amibroker.com/support.html





YAHOO! GROUPS LINKS