AmiBroker formula Language

Hi friends,

Here are some simple AFL's for the three types of stoploss - Initial, Breakeven and Trailing stoploss.

1. Initial stoploss

/****************************************************
Initial Stoploss - lowest "low" of the last n bars
*****************************************************/
lookbackPeriod = Param("Lookback period", 2, 2, 30);
Plot(LLV(L,lookbackPeriod), "Testing", ParamColor( "Long", colorGrey40));


2. Breakeven stoploss

/*******************************************************
Breakeven Stoploss - Open + brokerage% of open
********************************************************/
brokeragePercentage = Param("Brokerage Percentage", 1, 0.1, 5, 0.1);
Plot(O + O*(brokeragePercentage/100) , "Testing", ParamColor( "Long", colorYellow ));

3. Trailing stoploss

/****************************************************
Trailing Stoploss - a% below nth highest high
*****************************************************/
lookbackPeriod = Param("Lookback period", 10, 2, 30);
stoplossPercentage = Param("Stoploss Percentage", 5, 0.2, 10, 0.2);

Plot(HHV(H,lookbackPeriod) - HHV(H,lookbackPeriod) * (stoplossPercentage / 100), "Bullish SL", ParamColor( "Long", colorGrey40));
Plot(LLV(L,lookbackPeriod) + LLV(L,lookbackPeriod) * (stoplossPercentage / 100), "Bearish SL", ParamColor( "Short", colorGrey40));

I will post the AFL's as and when I come up with any new ones.
Thanks,
Praveen.
it will be graet if any senior bro disscuss little bit.i search net read artical and watch stocta.org 3 video but cant digest so plzz....
 
Dear Anant,
I have applied for Intraday data which I got from Investbulls. I reverified today again. Case is same.
MINIFTY_F1,2010-06-02,00:00:00,4957.7002,5019.0000,4941.1001,5016.9502,1385400,0
MINIFTY_F1,2010-06-03,00:00:00,5060.0000,5107.3999,5049.0000,5098.0000,1207100,0
MINIFTY_F1,2010-06-04,00:00:00,5085.0000,5134.3999,5071.1499,5118.0000,891940,0
MINIFTY_F1,2010-06-07,00:00:00,5010.0000,5030.9502,4985.0000,5027.9502,1402080,0
MINIFTY_F1,2010-06-08,00:00:00,5031.8999,5054.0000,4938.2002,4964.0000,1589220,0
MINIFTY_F1,2010-06-09,00:00:00,4965.0000,5045.3501,4955.1499,5005.0000,1825860,0
MINIFTY_F1,2010-06-10,00:00:00,5010.0000,5093.0000,4996.2002,5090.0000,1519600,0
MINIFTY_F1,2010-06-11,00:00:00,5130.0000,5137.6499,5092.0000,5112.0000,1134300,0
MINIFTY_F1,2010-06-14,00:00:00,5127.9502,5209.7002,5127.9502,5206.0000,1203720,0
MINIFTY_F1,2010-06-15,00:00:00,5199.0000,5245.0000,5175.0000,5229.0000,1033480,0
MINIFTY_F1,2010-06-16,00:00:00,5253.0498,5253.0498,5210.3999,5223.2998,856000,0
MINIFTY_F1,2010-06-17,00:00:00,5217.0498,5296.0000,5205.1001,5286.0000,1037480,0
MINIFTY_F1,2010-06-18,00:00:00,5283.0000,5296.6001,5243.2002,5258.7500,854360,0
MINIFTY_F1,2010-06-21,00:00:00,5295.3501,5377.0000,5295.3501,5357.9502,769520,0
MINIFTY_F1,2010-06-22,00:00:00,5340.0000,5358.0000,5312.0498,5324.0000,682060,0
Before running the AFL, go to Settings in Automatic Analyser. In General tab > Periodicity. This selection will decide the periodicity of the data you export using AFL. If you select 5 minutes, the AFL will export 5 min data.

Thanks
 

asnavale

Well-Known Member

sub2501

Active Member
......................................................
 
Last edited:
Hi friends

Please some afl writers help me for the following:-

1) Fixed horizontal display for intraday trading from 0900 to 1530hrs.
2) pivot points from previous day candle.
3) any other indicator to overlay
4) running intraday's max and min price lines.

on another pane I want OBV(C) which I found the IndiaBulls software (image and the OBV(c) data extracted from that chart.

From my Point of view this OBV(c) is the resultant volume seen at that time and price, either resultant Buy Delivery Volume or Sold Delivery Volume.

I think this indicator may enhance profitability when used with other AFLs.

Please Help me.

Thanking You all.
 
Please help !

HC = HHV(H,252);
HD = HHV(????,252);

Trying to fill variable "HD" with the date on which HHV(H,252).

GetRTData("52WeekHighDate") does not work as working on EOD data.

Thanks.
 

Similar threads