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

Re: tj's pyramid



PureBytes Links

Trading Reference Links

In order to avoid having all those 'chained' OR statements, I found 
it much easier to enter a VBscript with an array called Buyarray, and 
then set all the places in the array where I want to buy (much easier 
in VBscript). Also passed a Sellarray array into the VBscript to set 
where I want to sell.

After passing these parameters back to AFL, the code was easy - it 
looked very much like the tj's pyramid code, except the Buy and Sell 
commands referenced arrays rather than conditions.

I am nearly finshed working on this - will post the pseudo code when 
it is fully debugged. It gives a 'general' method of pyramiding.




--- In amibroker@xxxx, "avcinci" <avcinci@xxxx> wrote:
> Stephane,
> 
> Here's how I think it would go:
> 
> Capital = 100000;
> Risk = 0.01*capital;
> Buycond1 = entry condition; //initial buy condition
> BP1 = valuewhen(buycond1,open); //1st buyprice
> PS1 = (risk/2*ATR(10))*BP1; //1st positionsize
> Buycond2= ATR(10) + BP1;//2nd buy condition
> BP2 =valuewhen(buycond2,open);//2nd buyprice
> PS2 = (risk/2*ATR(10)*BP2;//2nd positionsize
> Buycond3=ATR(10) + BP2;//3rd buy condition
> BP3=valuewhen(buycond3,open);//3rd buyprice
> PS3=(risk/2*ATR(10)*BP3;//3rd positionsize
> etc. for buycond4 and buycond5;// continue for addition add-ons
> Buy = buycond1 OR buycond2 OR buycond3 OR buycond4 OR buycond5;
> 
> I have not had a chance to test this code yet. Is it logical? What 
> about excess buy signals? Would you have to use RemBuy.dll?
> 
> Al V.
> 
> --- In amibroker@xxxx, "nenapacwanfr" <nenapacwanfr@xxxx> wrote:
> > It seems the backtester takes one entry and one exit
> > and the profit is calculated for LONG with
> > ((ExitPr/EntryPr1)-1)*Positionsize
> > 
> > if you take adding position
> > that means 
> > you'll have multiples
> > ((ExitPr/EntryPr2)-1)*Positionsize
> > ((ExitPr/EntryPr3)-1)*Positionsize
> > 
> > if you want to be right that means you must solve an equation to 
> > know what would be the right position size at entryPr1 if all the 
> > adding position have been taken.
> > 
> > Hmmm!
> > 
> > stephane