Simple Coding Help - No Promise.

vijkris

Learner and Follower
Yes dear Vijkris i got your point.You are right.Can we use it with some other indicator to avoid such situation?
Thanks a lot & regards
in my opinion most of the indicators are lagging. already this system uses ema which is lagging. adding some more indicators wil delay ur entry.
 

vijkris

Learner and Follower
hi, i have added 9ema cross as filter, it reduces false entry, but it is not perfect. i think in this system, once there is good profitable period,after exit immediate opposite signal should be skipped.
regards.
 

vijkris

Learner and Follower
hi, i have added 9ema cross as filter, it reduces false entry, but it is not perfect. i think in this system, once there is good profitable period,after exit immediate opposite signal should be skipped.
regards.
afl code:
_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();

t=Param("t", 240, 1, 5000, 1);

/*Top = Sum(High, t) / t;
Bottom = Sum(Low, t) / t;
*/
Top = EMA(High, t) ;
Bottom = EMA(Low, t);

av=(Top+Bottom)/2;
mc=IIf(av>C, ParamColor("Trigger line Up Color", colorGold), ParamColor("Trigger line Dn Color", colorBlue));
Plot(av, "\nTrigger : ", mc, ParamStyle("Trigger line Style",styleStaircase,maskAll),0,0,0,9);

Buy = EMA(C,9)>av;
Short = av>EMA(C,9);
Buy = ExRem(Buy,Short);
Short = ExRem(Short,Buy);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);



_SECTION_END();

_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
Periods = Param("Periods", 9, 2, 300, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
 

hmp

Well-Known Member
There is one idea.Pl. correct me if i am wrong.In 30 min. time frame if we get buy signal then in 5 min. we can wait till we get same signal. That will help us to reduce some whipsaws.What do you think?
Regards.
 

vijkris

Learner and Follower
There is one idea.Pl. correct me if i am wrong.In 30 min. time frame if we get buy signal then in 5 min. we can wait till we get same signal. That will help us to reduce some whipsaws.What do you think?
Regards.
ya.. i think it is good idea. there wil be fewer signals.there wont be trading signal for many days until reversal is complete and new trend is established...
 
Hello friends,

I need help on stoploss code.

i tried applystop function but not getting results.

I need stoploss to be triggered if candle close below buy price for long and above short price.

can seniors plz guide me with afl or info link for the same.

Thanks,
Sudeep:)
 

vijkris

Learner and Follower
Can you pl. backtest the results with 5,15,& 30 min.time frames to get more profitability?
Regards
hi, i backtested 2 yrs data.i m sorry but most timeframes scenarios met with huge drawdowns . accuracy not crossing 40%. main prob is sideways not identified properly. Supertrend indicator by marketcalls.in gives better results.

or
there should be another way to identify sideways, so that we can avoid using this method in sideways period.
I would appreciate if any seniors express their views.
thanks,
regards
 
i need expert advisor for the following afl

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() );
//#include_once <popup.afl>

_SECTION_BEGIN("SuperTrend Ver 2 with Sound and Popup Alert");

SetBarsRequired(100000,0);

GraphXSpace = 15;

SetChartOptions(0,chartShowArrows|chartShowDates);

SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));

GfxSetBkMode(0);

GfxSetOverlayMode(1);

SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));

Plot(C,"\nPrice",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);



//SetTradeDelays(1,1,1,1);

SetPositionSize(100,spsShares);





_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));



Factor=Param("Factor",3,1,10,0.1);

Pd=Param("ATR Periods",7,1,150,1);


Up=(H+L)/2+(Factor*ATR(Pd));

Dn=(H+L)/2-(Factor*ATR(Pd));

iATR=ATR(Pd);

TrendUp=TrendDown=Null;

trend[0]=1;

changeOfTrend=0;

flag=flagh=0;



for (i = 1; i <BarCount-1; i++) {

TrendUp = Null;

TrendDown = Null;



trend=1;





if (Close>Up[i-1]) {

trend=1;

if (trend[i-1] == -1) changeOfTrend = 1;



}

else if (Close<Dn[i-1]) {

trend=-1;

if (trend[i-1] == 1) changeOfTrend = 1;

}

else if (trend[i-1]==1) {

trend=1;

changeOfTrend = 0;

}

else if (trend[i-1]==-1) {

trend=-1;

changeOfTrend = 0;

}



if (trend<0 && trend[i-1]>0) {

flag=1;

}

else {

flag=0;

}



if (trend>0 && trend[i-1]<0) {

flagh=1;

}

else {

flagh=0;

}



if (trend>0 && Dn<Dn[i-1]){

Dn=Dn[i-1];

}



if (trend<0 && Up>Up[i-1])

{ Up=Up[i-1];

}



if (flag==1)

{ Up=(H+L)/2+(Factor*iATR);;

}

if (flagh==1)

{ Dn=(H+L)/2-(Factor*iATR);;

}

if (trend==1) {

TrendUp=Dn;

if (changeOfTrend == 1) {

TrendUp[i-1] = TrendDown[i-1];

changeOfTrend = 0;

}

}

else if (trend==-1) {

TrendDown=Up;

if (changeOfTrend == 1) {

TrendDown[i-1] = TrendUp[i-1];

changeOfTrend = 0;

}

}

}



Plot(TrendUp,"Trend",colorGreen);

Plot(TrendDown,"Down",colorRed);



Buy = trend==1;

Sell=trend==-1;



Buy=ExRem(Buy,Sell);

Sell=ExRem(Sell,Buy);

Short=Sell;

Cover=Buy;





BuyPrice=ValueWhen(Buy,C);

SellPrice=ValueWhen(Sell,C);

ShortPrice=ValueWhen(Short,C);

CoverPrice=ValueWhen(Cover,C);
 

Similar threads