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

Re: Formula



PureBytes Links

Trading Reference Links

Bernard,
a.
P = 1 + (SellPrice - BuyPrice) / BuyPrice;
is EXACTLY equivalent to
P=SellPrice/BuyPrice;
because
P=1+(S-B)/B=(B+S-B)/B=S/B
b. 
What is CP in words?
This will help perhaps to continue.
If I take verbatim the
CP = CP * P;
means
CP-CP*P=0, IE
CP*(1-P)=0, IE
either CP=0 or P=1
Better say what is CP in words.
Dimitris Tsokakis
--- In amibroker@xxxx, Bernard Bourée <bernard@xxxx> wrote:
> Hello,
> 
> I have the following code:
> 
> P = 1 + (SellPrice - BuyPrice) / BuyPrice;
> CP = CP * P;
> 
> 
> CP need to be initialised to 1.
> How can I do that. If I code 
> CP = IIF( Cum(1) == 1, 1, CP);
> I have an error since CP is unknown and should not be placed in the 
right part of the formula since is still not defined.
> 
> Someone has an idea ?
> 
> Thanks
> Bernard Bourée
> bernard@xxxx






  • References: