Home
    Product
    Support
    Purchase
    Company

Advanced trading software: technical analysis and neural networks

Empowering wise traders

Support Center
Publications
Tradecision FAQs
Improvian Consulting
Contact Support Team
Knowledgebase
Collection of Indicators
Custom Indicators
Custom Studies
TASC Traders' Tips
Active Trader Strategies
Golden Trading Rules
Traderís Quiz

Traders' Tips from TASC Magazine
Average True Range Trailing Stops

In his series of three articles, Sylvain Vervoort demonstrates the importance of considering a warning signal and setting the stops at the right time to avoid getting stopped out by the normal noise of the market. The second part of the series describes the trailing-stop method based on the average true range (ATR) trailing stop use.

Using the Function Builder, you create the Stop_Trail_ATR_Mod function for a modified ATR trailing stop value:

function 
(Period:numeric=5,atrfact:Numeric=3.5):Numeric;
var
 HiLo:=0;
 Href:=0;
 Lref:=0;
 diff1:=0;
 diff2:=0;
 atrmod:=0;
 loss:=0;
 result:=0;
end_var

   HiLo:=iff(H - L < 1.5 * Mov(H - L, period, S), 
   H - L, 1.5 * Mov(H - L,  period, S));

   Href:=iff(L <= Ref(H, -1), H - Ref(C, -1), 
   (h - ref(C, -1)) - (L -  Ref(H, -1)) / 2);

   Lref:=iff(H >= Ref(L, -1), Ref(C, -1) - L, 
   (Ref(C, -1) - L) - (Ref(L, -1) - H) / 2);

   diff1:=Max(HiLo, Href);
   diff2:=Max(diff1, Lref);
 
   atrmod:=EMA(diff2,period);
   loss:=atrfact*atrmod;

if HISTORYSIZE <= period then result := C;
else
  begin
    if C > this\1\ AND C\1\ > this\1\  
    then result := Max(this\1\,C-loss);
    else
    begin
       if C < this\1\ then result := 
       Min(this\1\,C+loss);
       else
       begin
          if C > this\1\ then result := C-loss;
          else result := C+loss;
       end;
    end;
  end;
return result;

Then you specify the strategy rules in Tradecision's Strategy Builder:

Entry Long:
if Date() = 080102 then return true;
return false;
 
Exit Long:
return CrossBelow(Stop_Trail_ATR_Mod(5,3.5),C);

Entry Short:
if Date() = 081201 then return true;
return false;

Exit Short:
return CrossAbove(Stop_Trail_ATR_Mod(5,3.5),C);


Download to import into Tradecision.

How to use this indicator in Tradecision:
  1. Click Download.
  2. Save this indicator in a safe location on your hard drive.
  3. Open Tradecision and in the Tools menu click Indicator Builder.
  4. In the Indicator Builder dialog, click Import, locate the saved file and then click OK.
The indicator will be added to the Custom Indicators list.
 
Average True Range Trailing Stops
Tradecision Reviews
Video Tours
Ask a question

Site Map   |   Terms of Use   |   Privacy Policy   |   Risk Warning
Forex, equities or futures trading involves substantial risk of loss and is not suitable for all investors.
Copyright © 2001-2017 Alyuda Research, LLC.  All rights reserved