Setting daily loss/gain

Login or Register

Please login or register in order to view and post in the Forum.

12 posts / 0 new
Last post
PVLFD
Last seen: 6 years 5 months ago
Joined: 08/27/2014 - 15:34
Setting daily loss/gain

So I've been told it's not yet possible to set a daily loss limit in IRT.
Since that is not possible I was thinking of tracking it with a variable but having some issues.

This is what I have now:

Rule 1:
IF (TIME = 0930) THEN (SET(V#35, 0))
*setting variable #35 to zero at the beginning of the day

Rule 2:
SET(V#41, ENTRY - V#38);
LO <= V#41 AND POS_SIZE != 0 OR TR_POS !=0 AND SET(V#40, V#41) AND SET(V#35, V#35 - 200)
*my stop rule + setting V#35 to subtract 200 once the stop is hit.

Rule 3:
This is my entry rule and at the end of this I set "AND V#35 > -400" so that it will take a trade only if I don't have a negative 400 balance.

Now few problems:
1) The V#35 variable becomes -400 at the first stop instead of -200 like I set it to in rule #2.
2) It subtracts 200 even when the target is hit instead of stop, even though I set it in my stop rule

It looks like this:

2018-04-30 10:19:15 EPM8 SHOW V#35 = 0
2018-04-30 10:22:13 EPM8 SHOW V#35 = 0
2018-04-30 10:24:19 EPM8 SHOW V#35 = 0
2018-04-30 10:24:32 EPM8 SHOW V#35 = 0
2018-04-30 10:25:06 EPM8 SHOW V#35 = 0
2018-04-30 10:26:33 EPM8 SHOW V#35 = 0
********************************************************************************
EPM8 - E-Mini S&P 500: June 2018 (4t Renko) 2018-04-30 09:30 - 2018-04-30 16:15
Date/Time Signal Action Qty Symbol Price Total Profit
--------- ------ ------ ------ ------ ------ ------ ------
2018-04-30 10:26:33 Long BUY 1 EPM8 $2674.00 $1,000.00
2018-04-30 10:32:11 Target SELL 1 EPM8 $2675.25 $1,000.00 $57.10
2018-04-30 10:32:11 EPM8 SHOW V#35 = -400.00
2018-04-30 10:32:19 EPM8 SHOW V#35 = -400.00
2018-04-30 10:38:28 EPM8 SHOW V#35 = -400.00
2018-04-30 10:39:48 EPM8 SHOW V#35 = -400.00

Any advice on how to fix this and maybe how to better track a daily loss?

0
PVLFD
Last seen: 6 years 5 months ago
Joined: 08/27/2014 - 15:34
OK so I changed the rules a

OK so I changed the rules a bit:

Rule 1:
IF (POS = 1) THEN (SET(V#35, 0)) (POS is set to bars from beginning of session)

Rule 2:
SET(V#41, ENTRY - V#38);
IF (LO <= V#41 AND POS_SIZE != 0 OR TR_POS !=0 AND SET(V#40, V#41)) THEN (SET(V#35, (V#35 - 200)))

1) This seems to be fine. Does it make sense that I changed TIME to POS and added IF THEN to stop rule?
2) Now another issue is how do I track successful trades? E.g. how to I add a winner to V#35 if my target is not a static number like my stop?

cpayne
Last seen: 1 year 7 months ago
Joined: 03/30/2009 - 00:00
BT_NET - Net Profit

There is a BT_NET that holds the net profit for the system (backtest).

So in your no action / master rule, you could do this...

IF(POS = 1) THEN (SET(V#31, BT_NET)); /* store net profit at start of session */

SET(V#32, BT_NET - V#31);

Now you have the net profit/loss for the session in V#32 to use as you wish. (get out of current position....prevent entry into new positions, etc).

_adam
Last seen: 2 days 23 hours ago
Joined: 12/10/2017 - 14:44
Exit Current Position

I have been able to set this up to prevent entry, but am struggling to find a way to exit a current position once my daily loss limit is reached. Currently I have:

IF (V#32 <= -2000 AND POSITION > 0) THEN (SET(V#35, V#35)) // Exit long position at V#35 once I have reached -$2,000 on the day.

This however is not working in my backtests. Is there a better way to set this up?

PVLFD
Last seen: 6 years 5 months ago
Joined: 08/27/2014 - 15:34
OK, few questions then:

OK, few questions then:
1) Once I set those two in a non action rule, can I use this at the end of my ENTRY rule if I wanted the daily loss to be $400?
AND V#32 > -400

2) You said it's backtest, would this work in a live trade? If not, then how would I use it in a live system?

cpayne
Last seen: 1 year 7 months ago
Joined: 03/30/2009 - 00:00
Live System

1.  Yes.

2. What broker are you trading with?

PVLFD
Last seen: 6 years 5 months ago
Joined: 08/27/2014 - 15:34
AMP using CQG

AMP using CQG

cpayne
Last seen: 1 year 7 months ago
Joined: 03/30/2009 - 00:00
$PPOWER

Add a ticker symbol $PPOWER (securtity type > Cash).   That represents purchasing power.

At session open or before trading, can run a scan...

SET(V#1, CL($PPOWER))

Then at any time during session, should be able to monitor P&L with....

CL($PPOWER) - V#1

Epicuros901
Last seen: 9 months 3 weeks ago
Joined: 08/18/2017 - 09:02
What about Gain brokerage?

Hi Chad,

I am interested in tracking P/L as well. Can I use the CL($PPOWER) - V#1 method for Gain? Thanks!

cpayne
Last seen: 1 year 7 months ago
Joined: 03/30/2009 - 00:00
Gain And Rithmic in Next Release

In next release, both Gain and Rithmic will also support $PPOWER.

Epicuros901
Last seen: 9 months 3 weeks ago
Joined: 08/18/2017 - 09:02
Thank you

Much appreciated!

Pages