Author Topic: Help Request- for Developing AFL for Trailing SL for AMIBROKER as per N-Bar  (Read 1470 times)

pkgmtnl

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Hello Sir,

I need a help for developing a trailing stoploss codes for AFL (AMIBROKER). The trailing stoploss line shall be based on Low of preceding low of candle (for BUY ) and High of Preceding candles(in case  of SHORT). This Trailing SL Line shall come up as soon as BUY / SHORT triggers as per Strategy.
 
The conditions for Generating Trailing SL without any Profits Targets (No Profit Targets, It will move in Trending Directions till it is HIT or SELL / COVER conditions as per Strategy whichever comes first is met with)
 
The Entry Conditions are already in Strategy. So, this proposed AFL only be based on LOW/ HIGH of candles set in for  at BUY/ SHORT coming in.

 1. The Trailing SL in case of BUY would be as follows:-
·         After first BUY is implanted (let it be candle 1);
·         The First Trailing SL line shall begun from low of 5th Candle i.e. candle (-5) to candle 1(buy Candle);
·         Then,  Trailing SL line should wait for next 5 candles to complete first before commencing to draw Trailing SL line upwards in case of BUY;
·         Thereafter trailing SL shall move upwards in steps of  5 candles (i.e. low -5 candle shall be trailing SL)
·         Incase SELL or Trailing SL whichever comes first as per Strategy logic, it would Square and move ahead or wait for next SHORT/ BUY.
 
2.      The Trailing SL in case of SHORT would be as follows:-
·         After first SHORT is implanted (let it be candle 1);
·         The Fist Trailing SL line shall begun from high of 5th Candle i.e. candle (-5) to candle 1(SHORT Candle);
·         Then,  Trailing SL line should wait for next 5 candles to complete first before commencing to draw Trailing SL line downwards in case of SHORT;
·         Thereafter trailing SL shall move downwards in steps of  5 candles (i.e. low -5 candle shall be trailing SL)
·         Incase COVER or Trailing SL whichever comes first as per Strategy logic, it would Square and move ahead or wait for next SHORT/ BUY.

These codes can then be inserted at right place to have it functional for all type of strategy having codes for BUY/ SHORT/ SELL/ COVER

Any 1 helping in it would be great help.
Thanx with regards.