Pls create this afl

#1
My strategy is which i wants amibroker afl code can any one creat this
prev high - prev low = difference1
difference*25% = difference2
prev close + difference2 = buy price
prev close - difference2 = sell price
condition if current market price is above buy price then buy target is 1% and stoploss is .5%
if current market price is less then sell price then sell target 1% and stoploss is .5%

example
prev high 4750
prev low 4600
prev close 4650
current market price is 4665
4750-4600= 50
50*25% = 12.5
buy price is 4650 + 12.5 = 4662.5
sell price is 4650-12.5= 4637.5
 

johnnypareek

Well-Known Member
#2
My strategy is which i wants amibroker afl code can any one creat this
prev high - prev low = difference1
difference*25% = difference2
prev close + difference2 = buy price
prev close - difference2 = sell price
condition if current market price is above buy price then buy target is 1% and stoploss is .5%
if current market price is less then sell price then sell target 1% and stoploss is .5%

example
prev high 4750
prev low 4600
prev close 4650
current market price is 4665
4750-4600= 50
50*25% = 12.5
buy price is 4650 + 12.5 = 4662.5
sell price is 4650-12.5= 4637.5
hmm guess u did wrong calculation.

prev high 4750
prev low 4600
prev close 4650
current market price is 4665
4750-4600= 150 50*25% = 37.5
buy price is 4650 + 37.5 = 4687.5
sell price is 4650-37.5= 4612.5
 
#4
_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", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
diff = (Ref(High,-1)-Ref(Low,-1));
diff1 = diff*0.25;
Buy = Ref(Close,-1)+diff1;
Sell= Ref(Close,-1)-diff1;
Filter = Buy OR Sell;
AddColumn(Close,"Close");
AddColumn(Buy,"buy");
AddColumn(Sell,"sell");


_SECTION_END();


run explorer to find the values


for eod run this

_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", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
diff = High-Low;
diff1 = diff*0.25;
Buy = Close+diff1;
Sell= Close-diff1;
Filter = Buy OR Sell;
AddColumn(Close,"Close");
AddColumn(Buy,"buy");
AddColumn(Sell,"sell");


_SECTION_END();

run explorer to get the buy and sell values..
 
#5
This thread can help you
http://www.traderji.com/amibroker/60292-afl-writing-guide-new-user.html

Try this post, then you never need to ask others for AFL. Be a self sufficient trader.

My strategy is which i wants amibroker afl code can any one creat this
prev high - prev low = difference1
difference*25% = difference2
prev close + difference2 = buy price
prev close - difference2 = sell price
condition if current market price is above buy price then buy target is 1% and stoploss is .5%
if current market price is less then sell price then sell target 1% and stoploss is .5%

example
prev high 4750
prev low 4600
prev close 4650
current market price is 4665
4750-4600= 50
50*25% = 12.5
buy price is 4650 + 12.5 = 4662.5
sell price is 4650-12.5= 4637.5
 
#6
hai guys,

pls convert this mq4 file as afl file

extern int FastEMA = 8;
extern int SlowEMA = 17;
extern int SignalSMA = 9;
extern bool Show_MAJOR_TREND = TRUE;
extern bool Show_TREND_ANALYSIS = TRUE;

by
satheesh