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

[amibroker] COMMENTARY CODE to display both Percentage & Dollar Changes of Selected Range



PureBytes Links

Trading Reference Links


I spend alot of time gazing at charts doing the "Woulda Coulda
Shoulda" so I wrote the following commentary code. Hope not too out of
line posting it like this. Thought someone else might like to try it..
Watch for wrapped lines when pasting..

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
"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 / 50); 		// Round down to 50 Share Lots
Bought = ((LotsOf50 * 50) * BeginValue(C)) + Commisions / 2;	// Apply
half Commisions to Total Purchase
Sold = ((LotsOf50 * 50) * 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

Annulized = (pctChg / Period) * 365;		// Calc "SIMPLE" Annulized %
WriteVal(period, 1.0) + "  Periods " +  " 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 ) + "% . @" +
 WriteVal(Annulized, 1.0) + " Annualized..  "  + " Net "  + 
WriteVal(Sold - Bought, 1.0) ); 





------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/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/