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

[amibroker] How do I reference the last purchase price?



PureBytes Links

Trading Reference Links

I am a newbie. I am stuck. Once I buy I want to set a sales price 
equal to 
"purchase price + some formula()".

My problem is that I can't figure out how to reference my purchase 
price once 'buy' is activated. I've found the reserved 
array "BuyPrice". So if I want to buy at yesterday's high plus a 
"fudge-factor" alpha, I say:

  BuyPrice = Ref(High,-1)+ Alpha ;
  Buy = Cross(High, BuyPrice) ;

Now, if I say:

  Target = BuyPrice + Profit ;

This is not going to work, as BuyPrice will be an array changing 
every day. I need it to freeze on the day I buy and until I sell. 
Isn't there a logical parameter called LONG or somthing?

I tried typing

  if (Buy ==1) {BoughtPrice = BuyPrice} ;

but now I am told that Buy is not a Boolean expression.

How do I get stuff done only AFTER a Buy is executed and before a 
SELL??







------------------------ Yahoo! Groups Sponsor --------------------~--> 
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/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/