Simple Coding Help - No Promise.

chintan786

Well-Known Member
@Happy_Singh Sir Ji,

Seeking your help regarding AFL for scanning/exploring scrips trading below/abv. Prev. Day Value Area with good Volume.

In case any member have, then kindly post the same here.

Thanks for your support.

Chintan
 
Respected seniors , Pls Make AFL on this strategy

simple moving average (SMA)
SMA 5 CROSS SMA 21 = Buy
SMA 21 Cross SMA 5. = Sell
SMA 2 cross SMA 5 = exit buy
SMA 2 cross SMA 5 =exit sell
Trailing stop loss SMA 21
 
SMA 2,5,21 Plotting AFL W/O Buy Sell

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} \nOpen %g, Hi %g, Lo %g, Close %g (%.1f%%)\n {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );

Plot( MA( C, 5 ), "5SMA", colorRed, 1, Null, Null, 20 );
Plot( MA( C, 21 ), "21SMA", colorGreen, 4, Null, Null, 20 );
Plot( MA( C, 2 ), "2SMA", colorGold, 8, Null, Null, 200 );
 
Last edited:
Dear AFL Experts/Seniors

plz help me in this afl code.plot buy sell signal on this Vwap afl.when new Candle close above on Vwap line & new candle open is buy signal & Candle close below on Vwap line then new candle open is sell signal.


_SECTION_BEGIN("VWAP");
/*
The VWAP for a stock is calculated by adding the dollars traded for every
transaction in that stock ("price" x "number of
shares traded") and dividing the total shares traded. A VWAP is computed
from the Open of the market to the market Close, AND is
calculated by Volume weighting all transactions during this time period
*/

Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));
StartBar = ValueWhen(TimeNum() == 093000, BarIndex());
TodayVolume = Sum(V,Bars_so_far_today);
IIf (BarIndex() >= StartBar, VWAP = Sum (C * V, Bars_so_far_today ) /
TodayVolume,0);
Plot (VWAP,"VWAP",colorWhite, styleThick);

_SECTION_END();

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
 
Need help in Amibroker
I have an AFL which have defined Buy Sell Short Cover variable and displaying arrows on the chart. But while using same AFL in Backtesting it is showing only one script...... I think I am missing something
Please advice

Edit: For current script it is working ok but for all it shows only 1 or 2 scripts
 
Last edited:
Dear AFL Experts/Seniors

plz help me in this afl code.plot buy sell signal on this Vwap afl.when new Candle close above on Vwap line & new candle open is buy signal & Candle close below on Vwap line then new candle open is sell signal.
Buy/Sell Plotted.



_SECTION_BEGIN("VWAP");
/*
The VWAP for a stock is calculated by adding the dollars traded for every
transaction in that stock ("price" x "number of
shares traded") and dividing the total shares traded. A VWAP is computed
from the Open of the market to the market Close, AND is
calculated by Volume weighting all transactions during this time period
*/

Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));
StartBar = ValueWhen(TimeNum() == 093000, BarIndex());
TodayVolume = Sum(V,Bars_so_far_today);
IIf (BarIndex() >= StartBar, VWAP = Sum (C * V, Bars_so_far_today ) /
TodayVolume,0);
Plot (VWAP,"VWAP",colorWhite, styleThick);
Buy = Cross(C,VWAP) ;
Sell = Cross(VWAP,C) ;
Short = 0;
Cover = 0;
PlotShapes( Buy * shapeUpArrow + Sell * shapeDownArrow, IIf( Buy, colorGreen, colorRed ) );

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
 

jallanankit

Well-Known Member
Anyone able to code AFL for options..
Looking for something like this..

BUY Condition= conditionA
SELL Condition= conditionB
Short Condition = conditionC
Cover Condition = conditionD

When BNF futures triggers conditionA, it should signal a BUY in CE.
CE to be above 100 points of BNF level (rounded off to near 100)

When BNF futures triggers conditionB, it should signal a BUY in PE.
PE to be 100 points lower of BNF level (rounded off to near 100)

Any help would be appreciated
Dear happy Singh ji. If you can pls help
 

Similar threads