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

[amibroker] Re: Relative Performance Chart



PureBytes Links

Trading Reference Links

I apologize for all the Line wraps I will put on my web site if you
gan't get it. This code uses Beg and endvalue to display gains Etc. in
the commentary wimdow.

Hope it helps,   Jack Kinsey

/*	COMMENTARY CODE  to display both Percentage & Dollar Changes of
Selected Range
You must change "AmtPerTrade" avg value to be what you might put on
any position.
Also change "Commisions" to generly reflect the Total amt per
position. (BUY & SELL commisions)
		This part could be enhanced for % commisions...
This code is to give general Percentages AND Amounts while eyeballing
trades.
You can also change where this Code assumes 50 share Lots..
*/
AmtPerTrade = 5000;  // Put in the avg amount to trade
Commisions = 26;	// Commisions per position
ShareLots = 10;          // Share Lots
// "Amount Per Trade = $ " + WriteVal(AmtPerTrade, 1.2); // Display
Amount per trade
// "Commisions = $ " + WriteVal(Commisions, 1.2); // Display
Commisions per position


Name() + "  -  " + FullName();
" ";"On " + WriteVal( BeginValue( DateTime() ), formatDateTime ) + " 
 Closed  " + WriteVal(BeginValue(C),1.2);
"On " + WriteVal( EndValue( DateTime() ), formatDateTime )+ "   Closed
 " + WriteVal(EndValue(C),1.2);

Bclose = BeginValue(C);  			// Get Begin Close
RawShares = AmtPerTrade / Bclose; 	// How many Raw Shares
LotsOf50 = int(RawShares / ShareLots); 		// Round down to "ShareLots"
field
Bought = ((LotsOf50 * ShareLots) * BeginValue(C)) + Commisions / 2;	//
Apply half Commisions to Total Purchase
Sold = ((LotsOf50 * ShareLots) * EndValue(C)) - Commisions / 2;		//
Same for Total Sold amount

" ";
PctChg = 100 * (Sold - bought) / Bought ;			// Calc % of Trade
"Precentage change is " +  WriteVal(pctChg, 1.2) + "%";	// Write % to
Commentary

Period = EndValue( BarIndex() ) - BeginValue( BarIndex() );			//
Calculate Numer of periods selected

if (Interval() == inMonthly)
{
Annulized = (pctChg / Period) * 12; // DIBUY3; 			//  MONTHLY}
ti= "Months";
}
if (Interval() == inWeekly)
{
Annulized = (pctChg / Period) * 52; 	//  WEEKLY
ti = "Weeks";
}
if (Interval() == inDaily)
{
Annulized = (pctChg / Period) * 365 ; 	// DAILY
ti = "Days";
}
// Annulized = (pctChg / Period) * 365;		// Calc "SIMPLE" Annulized %
WriteVal(period, 1.0) + "  " + ti + "  Annualized @ " +
WriteVal(Annulized, 1.0) + "%" ; // Write to commentary
" ";
"Shares " + WriteVal(LotsOf50 * 50, 1.0); 	// Write Shares purchased
"Cost - $ " + WriteVal(Bought, 1.2);		// Write Cost $
"Sold - $ " + WriteVal(sold, 1.2) + "     Net  $ " + WriteVal(Sold -
Bought, 1.2) ;	// Write Sold and Net $

// The ClipboardSet is used "Play" audiable summary if running
"Speakonia" or other speech Synth.
ClipboardSet(WriteVal( 100 * (Sold - bought) / Bought, 1.2 ) + "%.
for" + WriteVal(period, 1.0) + 
WriteIf(period > 1,"  Days    ", "  Day    ") +
" Annualized  to "  + WriteVal(Annulized, 1.0) +  ".   Net "  + 
WriteVal(Sold - Bought, 1.0) ); 

--- In amibroker@xxxxxxxxxxxxxxx, "Rick" <rrogers@xxx> wrote:
>
> Hello:
> Can anyone show me how to apply the BeginValue and EndValue functions 
> to the Relative Performance chart included in the "Basic Charts"? 
> 
> I would like to allow user to double click chart to apply date markers 
> to vary the calculation period.
> 
> I have modified the standard code to add:
> 
> _N( TickerList = CategoryGetSymbols( categoryIndustry,IndustryID()));
> 
> to automatically load all symbols from Industry Group. This works well 
> with small groups to quickly evaluate the comparative RS visually.
> 
> thanks in advance for any help available,
> Rick
>







------------------------ Yahoo! Groups Sponsor --------------------~--> 
GFT Forex Trading Accounts As low as $250 with up to 400:1 Leverage. Free Demo.
http://us.click.yahoo.com/lpv1TA/jlQNAA/U1CZAA/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/