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

[amibroker] Re: Clarification - ValueWhen and Ref



PureBytes Links

Trading Reference Links

Gordon,
Unfortunately, there is no single answer to your question.
Most of the time X and Y have the same value and this fact makes me 
say they are exactly the same thing !!
They are different only
a. the "buy" day
b. the next to "buy" day
It would be better to see both in Ind. builder.
Try, for your example

Buy=Cross(StochD(),40);
Y=Ref(ValueWhen(Buy, H, 1), -1);
X=ValueWhen(Buy, H, 1);
Plot(C,"Close",1,128);
PlotShapes(shapeUpArrow*Buy,colorSeaGreen);
Plot(X,"X",colorTan,1);Plot(Y,"Y",colorBlue,8);

As you see, X and Y are the same, except the "Buy" and the next 
to "Buy" bar.
In general, Ref(X,-1) is one bar ahead X graph.
Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "gordonwrose" <amibroker@xxxx> 
wrote:
> Hi,
> 
> I want to double check something before I use it -- if I were to 
use 
> the following:
> 
> valuewhen(buy, h, 1)
> 
> that would tell me the high on the day of the most recent buy in a 
> backtest. If I then did:
> 
> ref(valuewhen(buy, h, 1), -1)
> 
> is that the high on the day before the buy, or the high on the day 
of 
> the previous buy? Thanks,
> 
> Gordon


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/sO0ANB/LIdGAA/ySSFAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/