+1 888 340 6572

Miscellaneous > Trade Maker

Article/Author: Origin: http://www.traders2traders.com. E-mail: Gary Fritz

Download: TrdMark.ela

File Includes: Indicator - Trade Maker

Category: Indicators > Miscellaneous

Description:

Here's a handy little indicator to "mark" your trades on a chart. It draws a line from the trade entry to the trade exit, so you can easily see whether it was a win or loss. (You can get fooled if you look at the positions of the buy/sell arrows on the chart.)

Usage:

By default it draws winning trades in green, losing trades in red, but you can change that. It would be easy to modify the indicator to e.g. show longs in green and shorts in red, but I liked this style. The attached code should handle any position size. However, be aware that it assumes you keep the SAME position size throughout the trade. If you add or subtract contracts during the trade, the indicator can't handle that.

NOTE: Since TS doesn't provide much position information to indicators, the author had to calculate the exit price using I_CurrentEquity. The increase in equity includes any costs you've factored into your system, so the exit price will be off by the "cost" amount. In most cases this will be a very small offset. Also, since the author had to use I_AvgEntryPrice for the entry price, it will show the average entry price if you have multiple entries.




Inputs:

Win - colour of trade
Loss - colour of trade

EasyLanguage Code:
INPUTS:  WIN(TOOL_GREEN), LOSS(TOOL_RED);

VARS: MP(0), EPRICE(0), EDATE(0), ETIME(0), ICE(0), ICC(0);
VARS: POSPROFIT(0), EXPRICE(0), LINE(0);

MP = I_MARKETPOSITION;
ICC = I_CURRENTCONTRACTS;
ICE = I_CLOSEDEQUITY;

IF MP <> MP[1] THEN BEGIN { POSITION HAS CHANGED }
IF MP[1] <> 0 THEN BEGIN { JUST EXITED A POSITION }
POSPROFIT = (ICE-ICE[1])/BIGPOINTVALUE;
IF MP[1] = 1 THEN EXPRICE = EPRICE + POSPROFIT / ICC[1]
ELSE EXPRICE = EPRICE - POSPROFIT / ICC[1];
LINE = TL_NEW(EDATE, ETIME, EPRICE, DATE, TIME, EXPRICE);
TL_SETSIZE(LINE, 1);
IF POSPROFIT > 0 THEN TL_SETCOLOR(LINE, WIN)
ELSE TL_SETCOLOR(LINE, LOSS);
IF MP[1] = -1 THEN TL_SETSTYLE(LINE, TOOL_DASHED);
END;
IF MP <> 0 THEN BEGIN { JUST ENTERED A POSITION }
EPRICE = I_AVGENTRYPRICE;
EDATE = DATE;
ETIME = TIME;
END;
END;

IF FALSE THEN PLOT1(0,"");