Adding stops, and stop movement, and sell orders

Login or Register

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

3 posts / 0 new
Last post
John Moss
Last seen: 7 years 4 days ago
Joined: 12/22/2016 - 16:37
Adding stops, and stop movement, and sell orders

I have watched the videos and will go back to them after this to further understand the nomenclature. Have got the signal creation process down and have built out indicator systems. Now moving on to back-testing settings via trading systems.

Upon reading the following I'll be able to research the videos to get it down cold; but in the moment could you please write up the code structure for the following conditions:

1) Objective - test max winning trades vs. max profitability. Variables will be set up in the signals as well as the action sequences. I understand signal variables but am not up to speed with stops & exits in trading systems, want to build the following elementary system which essentially does:

1 Minute: IF (Signal) Then BUY 3 at Last price (good to go here)

(Need Help Here:)

- Add stop at V#1 , say V#1 = - 10 ticks, hence stop tick distance is V#1.
- Add exit , or SELL, at V#2, say plus 10 ticks, hence sell tick distance is V#2.
- If in open trade, and PRICE = + 5 ticks in my favor, Then move STOP to ENTRY PRICE + 1 tick.

I assume the procedure for this movement of stop is to add the new stop and then cancel the other?
Also, when a trade is successfully completed or stopped out, is the DOM automatically cleared of stop or limit positions remaining?
I assume of course this is inconsequential in backtesting yes, am asking for future reference...

Thanx :)

0
cpayne
Last seen: 1 year 1 month ago
Joined: 03/30/2009 - 00:00
Stops, Target, Trail Stop

The rule for the stop would simply be...  (assuming V#1 is set to 10)

LO <= ENTRY - V#1 * TINC AND SET(V#10, ENTRY - V#1 * TINC)

and set rule up to get out at price V#10

Target rule, assuming V#2 is set to 10

HI >= ENTRY + V#2 * TINC AND SET(V#10, ENTRY + V#2 * TINC)

and again, setup rule to exit at V#10

To trail the stop....

You need to take a different approach there, and either manage a V#3 for the stop or you can also manage a STOP token just like V#s.

So I would have a no-action rule (1st rule) that includes this line...

IF(BARSEOPEN = 1) THEN (SET(STOP, ENTRY - V#1));
IF(BARSOPEN > 1 AND HI >= ENTRY + 5 * TINC) THEN (SET(STOP, ENTRY - 5 * TINC));

and then your stop rule changes to..

LO <= STOP AND SET(V#10, STOP)

John Moss
Last seen: 7 years 4 days ago
Joined: 12/22/2016 - 16:37
Awesome, Thank you sir :) Also...

Also, I know in general it's good practice to eliminate unnecessary code elements, but for the sake of neatness while in training I have used parentheses & such where they are not critical to the argument. At this point I am beginning to really load down one chart in particular with a lot of signals. I gather it would be a good idea to back in and eliminate non-essential characters for the sake of lightening the load on the system?