AFL writing guide for new user

Hello,

I am a new Amibroker User could anybody help me with coding this idea:

I want to code this system:

1.Today the stock is above 200 day moving average.
2.Today the stock close below 5 day moving average.
3.Two days ago the high and low price is below yesterdays high and close price
4.Today`s high and low price is below yesterdays high and low price.
5.Buy at netx day open.

Thanks for your help

Enrico
 
DM ji first tons of thanks for your contribution. My question is i want a buy signal
with price displayed, once the "low price" of ema15 crosses the "close price " of ema 15 and vice-versa for sell.how to add this in afl ? pls guide tks
 
Hello Mr. Debarghya Mukherjee,
I just joined your thread today...It is really very helpful and I was looking for this type of information...Ultimately got the one of yours thread...

Thanks.. and Pls continue guiding us..
 
Dear DM sir,

I am giving my simple code here...It is working fine , I want to use it Option
Trading (INDEX Option), and only for Buying of CALL/PUT (Not selling)..

I want your help here .....

I want to draw Stop Loss Line at the bottom of the Candle where my Buy signal (Green Triangle ) appears.... Also if you can add code where it should display the price of Stop Loss at the bottom of That candle too...

I want to Draw a Stop Loss line (Horizontal Line) which should be big enough to display clearly.

Can you Please Guide me how I can do this ??


HERE IS MY CODE:

SECTION_BEGIN("Price");



SetBarFillColor( IIf( Close > Open, colorGreen, colorDarkRed ) );


SetChartOptions(0,chartShowArrows|chartShowDates);

Title = EncodeColor(colorWhite)+ Name() + " - " + EncodeColor(colorYellow)+ Interval(2) + EncodeColor(colorYellow) +
" - " + Date() +" - "+ EncodeColor(colorYellow) + "Open = "+EncodeColor(colorWhite)+WriteVal(O,8.2) + EncodeColor(colorYellow) +
", High = "+EncodeColor(colorWhite)+ WriteVal(H,8.2)+ EncodeColor(colorYellow) + ", Low= "+EncodeColor(colorWhite)+ WriteVal(L,8.2)+
EncodeColor(colorYellow) + ", Close= "+EncodeColor(colorWhite)+ WriteVal(C,8.2)+ EncodeColor(colorYellow) + ", Vol= "+EncodeColor(colorWhite)+ WriteVal(V,1)+("\n");

Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle |ParamStyle("Style") | GetPriceStyle() );

_SECTION_END();


_SECTION_BEGIN("BUY SELL");


Buy= Cross(EMA( C, 3 ), EMA( C, 30 ));

Sell= Cross(EMA( C, 30 ), EMA( C, 3 ));

//Buy= Cross(EMA( C, 3 ), EMA( C, 30 ));

//-----------------------------------------------------------------------------------------------
// I WANT TO DRAM SL LINE AT THE BOTTOM OF CANDLE WHERE BUY SIGNAL (GREEN TRIANGLE) APPEAR
//----------------------------------------------------------------------------------------------

StopLoss = Low;
//PlotText("SL @"+Low , BarCount+5,5,Null,colorBlue);


Filter = Buy OR Sell ;
PlotShapes(IIf(Buy, shapeUpTriangle, shapeNone),colorGreen, 0,L, Offset=-15);
//PlotShapes(IIf(Sell, shapeDownTriangle, shapeNone),colorRed, 0,H, Offset=-15);
AlertIf( Buy, "SOUND C:\\Windows\\Media\\tada.wav", "Audio alert", 5 );
AlertIf( Sell, "SOUND C:\\Windows\\Media\\tada.wav", "Audio alert", 5 );

Plot( EMA( Close,3), "3 EMA", colorDarkBlue,styleThick);

Plot( EMA( Close,30), "30 EMA", colorDarkRed,styleThick);


_SECTION_END();


Thanks.

Bhupesh
 
some small codes from my side which I looked for in previious page.

to round up a number completely to its nearby --------round()
to round upper side a number completely then --------ceil()
to round lower side a number completely then --------floor()
to get only interger from the whole number is --------int()
to get only the decimal part from the number --------ftr()
 
Hi,

How I can limit my no of contract for future for backtesting. Say initially I am trading with two lots, but as the profit start increasing no of contracts are also increasing. but I dont want to do that.

Thanks in advance,
Jitesh
 
Hai DM
I am using EMA(close, 7), EMA(close, 21) crossover system.when EMA7 crosses EMA21, we will get a BUY signal and viceversa.But i need to get buy signal only when the price breaks the high of the current buy candle, reverse for the sell. help pl.
 
HI,

any one tell me can i add sound alert in amibroker when my price reach to our target price.

For eg. I purchase Bank nifty @ 11500 and my target is 11550 and stoploss is 11475.

I want set sound alert if price reach to 11550 and secound sound alert if price reach to my stop loss price 11475.

I not use any indicator for decided price target or stop loss its simple use price chart only and 50 points target and 25 poits stop loss for every

call.

if any one know about these pls tell me.

Thanks
Kishor.
 

Similar threads