amibroker afl

guptak03

Well-Known Member
#4
Hello johnny sir,
i have my afl but i just need to add some conditions on it so plz help me ,its on Nick Ma swing system..
the conditions are as fallows
when buy signal comes it has to buys at next candle (condition buy above previous candle high +7 points above previous candle high) same rule for sell..
 
#5
johhny sir,

i also want some modification in a a system. if we put fix rate in market to buy or sell , it will save slippages. is it possible to buy = buy signal - 5points and sell = sell signal + 5 points and exit = price cross last 3 candles low in case of buy and exit = price cross last 3 candles high in case of sell . sir i will be very thankful to u if u help me. :)

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

//SetTradeDelays(1,1,1,1);
SetPositionSize(1,spsShares);

Plot(C,"Price",IIf(O>C,colorRed,colorGreen),styleBar);

Buy=Cross(EMA(C,5),EMA(C,8));
Sell=Cross(EMA(C,8),EMA(C,5));

GraphXSpace = 5;
dist = 3.5*ATR(10);
for( i = 0; i < BarCount; i++ )
{
if( Buy ) PlotText( "Buy\n" + C[ i ], i, L[ i ]-dist, colorGreen );
if( Sell ) PlotText( "sell\n" + C[ i ], i, L[ i ]+dist, colorRed);
}

Short = Sell;
Cover = Buy;
 
#6
johhny sir,

i also want some modification in a a system. if we put fix rate in market to buy or sell , it will save slippages. is it possible to buy = buy signal - 5points and sell = sell signal + 5 points and exit = price cross last 3 candles low in case of buy and exit = price cross last 3 candles high in case of sell . sir i will be very thankful to u if u help me. :)

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

//SetTradeDelays(1,1,1,1);
SetPositionSize(1,spsShares);

Plot(C,"Price",IIf(O>C,colorRed,colorGreen),styleBar);

Buy=Cross(EMA(C,5),EMA(C,8));
Sell=Cross(EMA(C,8),EMA(C,5));

GraphXSpace = 5;
dist = 3.5*ATR(10);
for( i = 0; i < BarCount; i++ )
{
if( Buy ) PlotText( "Buy\n" + C[ i ], i, L[ i ]-dist, colorGreen );
if( Sell ) PlotText( "sell\n" + C[ i ], i, L[ i ]+dist, colorRed);
}

Short = Sell;
Cover = Buy;


can any one help :)
 

johnnypareek

Well-Known Member
#7
johhny sir,

i also want some modification in a a system. if we put fix rate in market to buy or sell , it will save slippages. is it possible to buy = buy signal - 5points and sell = sell signal + 5 points and exit = price cross last 3 candles low in case of buy and exit = price cross last 3 candles high in case of sell . sir i will be very thankful to u if u help me. :)

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

//SetTradeDelays(1,1,1,1);
SetPositionSize(1,spsShares);

Plot(C,"Price",IIf(O>C,colorRed,colorGreen),styleBar);

Buy=Cross(EMA(C,5),EMA(C,8));
Sell=Cross(EMA(C,8),EMA(C,5));

GraphXSpace = 5;
dist = 3.5*ATR(10);
for( i = 0; i < BarCount; i++ )
{
if( Buy ) PlotText( "Buy\n" + C[ i ], i, L[ i ]-dist, colorGreen );
if( Sell ) PlotText( "sell\n" + C[ i ], i, L[ i ]+dist, colorRed);
}

Short = Sell;
Cover = Buy;



Hi,

Sorry was busy. Okay 5 points filter will work for nifty what about stocks. I assume you will trade nifty so modify is on way. okay I have added parameter so that u can adjust as you want

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

//SetTradeDelays(1,1,1,1);
SetPositionSize(1,spsShares);
Buy_f = Param("Buy Filter",5,0.1,20,0.1);
Sell_f = Param( "Sell Filter",5,0.1,20,1);

Plot(C,"Price",IIf(O>C,colorRed,colorGreen),styleBar);

Buy=Cross(EMA(C,5),EMA(C,8));
Sell=Cross(EMA(C,8),EMA(C,5));

GraphXSpace = 5;
dist = 3.5*ATR(10);
for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Buy\n" + (C[ i ]-Buy_f), i, L[ i ]-dist[i], colorGreen );
if( Sell[i] ) PlotText( "sell\n" + (C[ i ]+Sell_f), i, L[ i ]+dist[i], colorRed);
}

Short = Sell;
Cover = Buy;
 
#8
Hi,

Sorry was busy. Okay 5 points filter will work for nifty what about stocks. I assume you will trade nifty so modify is on way. okay I have added parameter so that u can adjust as you want

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

//SetTradeDelays(1,1,1,1);
SetPositionSize(1,spsShares);
Buy_f = Param("Buy Filter",5,0.1,20,0.1);
Sell_f = Param( "Sell Filter",5,0.1,20,1);

Plot(C,"Price",IIf(O>C,colorRed,colorGreen),styleBar);

Buy=Cross(EMA(C,5),EMA(C,8));
Sell=Cross(EMA(C,8),EMA(C,5));

GraphXSpace = 5;
dist = 3.5*ATR(10);
for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Buy\n" + (C[ i ]-Buy_f), i, L[ i ]-dist[i], colorGreen );
if( Sell[i] ) PlotText( "sell\n" + (C[ i ]+Sell_f), i, L[ i ]+dist[i], colorRed);
}

Short = Sell;
Cover = Buy;
sir thank u so much for reply. please check the below problems.

 

johnnypareek

Well-Known Member
#9
I set it as to c on screen only have to chk for backtest. On what timeframe u scanned?

okay chk now

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

//SetTradeDelays(1,1,1,1);
SetPositionSize(1,spsShares);
Buy_f = Param("Buy Filter",5,0,20,0.1);
Sell_f = Param( "Sell Filter",5,0,20,1);

Plot(C,"Price",IIf(O>C,colorRed,colorGreen),styleBar);

Buy=Cross(EMA(C,5),EMA(C,8));
Sell=Cross(EMA(C,8),EMA(C,5));
Short = Sell;
Cover = Buy; 

BuyPrice=ValueWhen(Buy,C-Buy_f,1);
SellPrice=ValueWhen(Sell,C+Sell_f,1);
ShortPrice=ValueWhen(Sell,C+Sell_f,1);
CoverPrice=ValueWhen(Buy,C-Buy_f,1);

GraphXSpace = 5;
dist = 2.5*ATR(10);
for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Buy\n" + (C[ i ]-Buy_f), i, L[ i ]-dist[i], colorGreen );
if( Sell[i] ) PlotText( "sell\n" + (C[ i ]+Sell_f), i, L[ i ]+dist[i], colorRed);
}
 
Last edited:

Similar threads