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

RE: [amibroker] Understanding _Trace output; first and last visible bars



PureBytes Links

Trading Reference Links




<SPAN 
class=810180007-16112003>Gordon,
<SPAN 
class=810180007-16112003> 
<SPAN 
class=810180007-16112003>//--Indicator-End--  is notation Tomasz uses in 
his built in codes. You do not need it in your custom code. the // marks the 
rest of the line as notation and is ignored by AB.
<SPAN 
class=810180007-16112003> 
To plot a price 
chart there is probably no need to use PlotOHLC, simply just use Plot(c,"<FONT 
face="Courier New" size=3>Custom price chart", colorBlack, 
styleCandle);
<FONT 
face="Courier New" size=3> 
<FONT 
face="Courier New" size=3>Since candles use OHLC data AB "Knows" to draw that 
data... 
<FONT 
face="Courier New" size=3> 
<FONT 
face="Courier New" size=3>Sorry, I am no help with _Trace...I have never used 
it.

 
Regards, 
Jayson BTW, the 
first thing I set out to do was find the first and last visible bars. That 
code may come in handy for a few people. The gist of my question is 
understanding the debug output in the code below. First I paste the code, 
then the debug output. The calls to _Trace are just meant to show if my 
formulas for finding the first and last visible bars are 
working.Question no #1: The output below was created by clicking "Apply" 
in the indicator builder window. In the output, you'll see three 
complete sets of the calls to the _Trace() function, with {EMPTY} 
showing for the date values in the first one. I'm gussing the {EMPTY} 
has to do with the use of Ref() in the second two statements, and that 
the -1 and +1 offsets yield invalid results on the very first pass through 
this indicator. This made me a little nervous -- and only a little -- why 
are there three calls, and could I ever wind up getting unexpected results 
if I were using the return value from one of those calls in other code vs. 
just printing it to debug?Question no #2: I tried putting the 
//--Indicator-End--comment above the calls to _Trace() to 
prevent AB from having to execute the code for every bar -- which it didn't 
anyway, apparently, since there were only the three calls to it. AB seems to 
be "smart" about how often it has to execute indicator code. However, is 
there "layman" use for "//--Indicator-End--" ?THE 
CODE:PlotOHLC(Open, High, Low, Close, "Custom price chart", colorBlack, 
styleCandle); GraphXSpace=10;// -- Arbitrary code to test 
drawing of shapes in this indicatorPlotShapes(IIf(DayOfWeek()==1, 
shapeUpArrow, shapeNone), colorGreen, 0, Low, Offset=-15);// -- 
Let's calculate the first and last visible bars, and 
output//    the results using _Trace()_TRACE("The lowest 
low of the visible bars is: " +WriteVal(LastValue( Lowest( 
IIf(Status("barvisible"), L, 99999))))); _TRACE("The first visible date 
is: " + WriteVal(ValueWhen(Status("barvisible") AND NOT 
Ref(Status("barvisible"), -1), DateTime(), 1), formatDateTime 
));_TRACE("The last visible date is: " + 
WriteVal(IIf(Status("barvisible") AND 
BarIndex()==LastValue(BarIndex()),ValueWhen(BarIndex()==LastValue(BarIndex()), 
DateTime(), 1),ValueWhen(Status("barvisible") AND NOT 
Ref(Status("barvisible"), 1), DateTime(), 1)), formatDateTime )); 
Output (3 sets of calls):[2360] The lowest low of the visible 
bars is: 99,999.000[2360] The first visible date is: {EMPTY}[2360] The 
last visible date is: {EMPTY}[2360] The lowest low of the visible bars 
is:   31.370[2360] The first visible date is: 5/14/2003[2360] 
The last visible date is: 11/14/2003[2360] The lowest low of the visible 
bars is:   31.370[2360] The first visible date is: 
5/14/2003[2360] The last visible date is: 
11/14/2003GordonSend 
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
suggest@xxxxxxxxxxxxx-----------------------------------------Post 
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
group FAQ at: <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT 









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 the Yahoo! Terms of Service.