rlohmeyer
Active member
I have had an issue with the fact that it is not easy to track your trades real time on your charts, know when they ended, and whether they were winner/loser. I coded a simple script to give this ability which I use within a more complex script to determine my risk and convert it to shares.
Below is an image of the entry lines on my chart. The color is dynamically determined based on whether trade is long or short, but I plotted it as dots so that I can easily see how many bars the trade lasted and which bar was the exit.
Below is an image of the entry lines on my chart. The color is dynamically determined based on whether trade is long or short, but I plotted it as dots so that I can easily see how many bars the trade lasted and which bar was the exit.
Code:
declare upper;
def EP = Round(GetAveragePrice(), 2);
plot Enter = EP;
def shrs = GetQuantity();
def long = shrs > 0;
def short = shrs < 0;
Enter.AssignValueColor(if long then Color.green else Color.red);