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

[amibroker] Pyramid trades starter



PureBytes Links

Trading Reference Links

I am not certain if this was ever solved, also probably TJ will be including
this in a future AB version.
But I have been working on a little routine to at least graphically see a
pyramid trade in action. I used a very simple routine to get this just to
see that it works. Maybe, if already solved someone can point me in the
right direction. 
As can be seen the buy/sell signals are very simple, but demonstrate the
pyramid system
 
PositionSize = 10000;
BuyPrice = O;
SetTradeDelays(1,1,1,1);
Buy = DayOfWeek()==5;
Sell = Day()<Ref(Day(),-1);

totalshares[0]=0;
numshares = IIf( Buy, PositionSize/BuyPrice, 0);

for(i=1;i<BarCount;i++)
{
if(Sell[i])
{totalshares[i]=0;}
else
{totalshares[i] = totalshares[i-1]+numshares[i];}
}

AddToComposite( totalshares,"~"+Name(),"V");
AddToComposite( Buy,"~"+Name(),"O");
AddToComposite( Sell,"~"+Name(),"C");


And plot this in IB window for the ticker used

shares = Foreign( "~"+Name(), "V");
Value = shares*C;
Plot( Value, "shares", colorGreen, styleStaircase+styleNoLabel );

entry = Foreign( "~"+Name(), "O");
exit = Foreign( "~"+Name(), "C");
PlotShapes( IIf( entry, shapeUpArrow, Null ), colorGreen );
PlotShapes( IIf( exit, shapeDownArrow, Null ), colorRed );

Cheers,
Graham
http://groups.msn.com/ASXShareTrading
http://groups.msn.com/FMSAustralia


------------------------ 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/l.m7sD/LIdGAA/qnsNAA/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/