Stops and automatic trading.

All posts which do not fit into any other sections of the forum.

Moderator: admin

Stops and automatic trading.

Postby Jakeman123 » Wed Oct 20, 2010 9:01 pm

Has anyone used the "stops" feature in automatic trading?

For example, is the the tag "Distance in pips for the stop order" the same as a trailing stop? Or is it fixed from the point of entry?

If this is the case, can a trailing stop be added to a lua script?

Any insights are appreciated.
Jakeman123
 
Posts: 11
Joined: Mon Aug 30, 2010 5:45 pm

Re: Stops and automatic trading.

Postby Nikolay.Gekht » Thu Oct 21, 2010 7:38 am

1) The distance in pips in the most strategies are specified against the entry price.

2) The strategies can use trailing stop orders and the most of them use it.

Yes, lua scripts can set, remove or modify stop orders.

Please read the following articles about stop orders for details:
http://www.fxcodebase.com/documents/Ind ... der_S.html
http://www.fxcodebase.com/documents/Ind ... der_A.html
Nikolay.Gekht
FXCodeBase: Site Admin
 
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: Stops and automatic trading.

Postby Jakeman123 » Thu Oct 21, 2010 9:24 am

I see from the articles that trailing stops can indeed be added. Would someone be able to add this feature to the ADX Aroon strategy that is posted elsewhere here?

Many thanks in advance for your time and effort.
Jakeman123
 
Posts: 11
Joined: Mon Aug 30, 2010 5:45 pm

Re: Stops and automatic trading.

Postby olgasgs » Fri Oct 22, 2010 4:47 am

The version of the ADX Aroon strategy with the ability to add a trailing stop is attached. In the strategy there's a new parameter - "TrailStepStop". It can have one of the following values:
0 (default) - not use a trailing stop;
1 - use a dynamic trailing stop;
greater than 1 - use a fixed trailing stop with this step.

Please note that in some systems, only dynamic or only fixed trailing mode is supported. In this case if you try to create a strategy with a not available trailing mode, an error message will be displayed.
Attachments
ADX AROON Strategy Trailing.lua
ADX Aroon strategy with the ability to add a trailing stop
(15.85 KiB) Downloaded 766 times
olgasgs
 
Posts: 6
Joined: Mon Jul 19, 2010 8:44 am

Re: Stops and automatic trading.

Postby Jakeman123 » Fri Oct 22, 2010 7:56 am

Thanks, Olgasgs. I look forward to testing it out.
Jakeman123
 
Posts: 11
Joined: Mon Aug 30, 2010 5:45 pm

Re: Stops and automatic trading.

Postby Jakeman123 » Wed Oct 27, 2010 9:25 pm

Ok, I am currently testing out the trailing .lua script generously posted.. I have a few questions. Let's say I want a trailing stop of 15 pips:

First, under the trail set stop, I understand that entering "1" activates it. To get a trailing stop of 15 pips, do I enter "15" in this space?

What do I do with the parameter under "Trading" that says "Distance in pips for the stop." Do I leave this at 0? Or is this where I enter my trailing stop size?

Thanks for any help in figuring this out.

Jake
Jakeman123
 
Posts: 11
Joined: Mon Aug 30, 2010 5:45 pm

Re: Stops and automatic trading.

Postby sunshine » Fri Oct 29, 2010 7:08 am

Hello,

Jakeman123 wrote:First, under the trail set stop, I understand that entering "1" activates it.

Not exactly. The value "1" of the parameter "Trailing step in pips"
means that a dynamic trailing stop will be used, i.e. the rate of
your stop order will be changed with each change of the market price.
Jakeman123 wrote:To get a trailing stop of 15 pips, do I enter "15" in this space?

Yes. You should type "15" in the parameter "Trailing step in pips".
Jakeman123 wrote:What do I do with the parameter under "Trading" that says "Distance in pips for the stop." Do I leave this at 0? Or is this where I enter my trailing stop size?

This parameter defines the price of a stop order as a distance in pips
from the market price (ask for short, bid for long). If you want the
strategy to create stop orders, you should specify a non-zero value in
this parameter. If you don't want the strategy to create stop orders,
you should leave "0". Note that if you specify "0", the value of the
parameter "Trailing step in pips" is ignored.
Last edited by sunshine on Fri Oct 29, 2010 11:39 pm, edited 1 time in total.
sunshine
 

Re: Stops and automatic trading.

Postby Jakeman123 » Fri Oct 29, 2010 10:24 am

Thanks for your response. So just to confirm:

For a trailing stop of 15 pips, I would need to:

1. Enter the number 15 in the parameter "Trailing Step in Pips."

And:

2. In the parameter "Distance in pips for the stop" I need to enter a number other than 0. Should I enter any number? Or should I enter "15"?

Thanks in advance for clarifying.
Jakeman123
 
Posts: 11
Joined: Mon Aug 30, 2010 5:45 pm

Re: Stops and automatic trading.

Postby sunshine » Fri Oct 29, 2010 1:37 pm

Please let me give you an example.
Suppose I need to set stop at 20 pips away from the current market price. And I want my stop to move automatically with the market price by 15 pips.
In this case I should set the parameters:
Distance in pips for the stop = 20 (this value is used to define initial stop price)
Trailing step in pips = 15 (this value is trailing step, i.e. once the market price moves by 15 pips in my favor, the stop price automatically moves by 15 pips as well).
sunshine
 


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 3 guests