Have you folks noticed if you double click an area of a price chart
you get a green vertical line? And then if you move to the right and
double click again you get a red vertical line?
I searched the help files and found nothing describing the function of
these lines. I would like to use them to calculate my P/L on entry and
exits. Double click on entry bar, double click on exit bar and then
use some AFL code to display the % P/L. It could display in the
iterpretation window or print the value directly to the chart.
Here's what I've been experimenting with:
///////////////Code///////////////
Entry = ValueWhen(Study("EN", 1473)==0, O);
printf("Entry: " + Entry + "\n");
Exit = ValueWhen(Study("EX", 1473)==0, O);
printf("Exit = " + Exit +"\n");
NetPL = (((Exit + 0.0001) - Entry)/ Entry)*100;
printf("Net P/L = " + NetPL +"\n");
//////////////Code/////////////////
The problem is you have to add a two studies (vertical lines) and name
the entry line 'EN' and the exit line 'EX'. There is a problem with
this code in that if you draw or move the 'EX' study line to the final
bar on the right it generates a zero value. Another bug in this code
is somewhat related. The active or selected bar on the chart must be
at least one bar to the right of the 'EX' study line.
Hope someone has a better way of doing this.
Thanks for any feedback.
Pete :-)