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

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


  • To: <amibroker@xxxxxxxxxxxxxxx>
  • Subject: RE: [amibroker] COMMENTARY CODE to display both Percentage & Dollar Changes of Selected Range
  • From: "Herman van den Bergen" <psytek@xxxxxxxx>
  • Date: Tue, 5 Apr 2005 15:57:02 -0400

PureBytes Links

Trading Reference Links

Hello Jack,
 
thank you very much for sharing this code! I especially like the way you use Speakonia to generate voice messages - this is just what I needed!
 
A very nice application :-) I am announcing this on the -at list as with Automated Trading this is far easier to use that the Alert() function.
 
best regards,
herman
-----Original Message-----
From: ckinsey2003 [mailto:ckinsey2003@xxxxxxxxx]
Sent: Tuesday, April 05, 2005 3:03 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] COMMENTARY CODE to display both Percentage & Dollar Changes of Selected Range


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) );





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





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