Simple Coding Help - No Promise.

a=1;

_SECTION_BEGIN("HeikenAshiSmoothed");
GraphXSpace=5;
p=200; //DEFAULT 5 final50
Om=DEMA(O,p);
Hm=DEMA(H,p);
lm=DEMA(L,p);
Cm=DEMA(C,p);
HACLOSE=(Om+Hm+Lm+Cm)/4;
HaOpen = AMA( Ref( HaClose, 1), 1);
HaHigh = Max( Hm, Max( HaClose, HaOpen ) );
HaLow = Min( Lm, Min( HaClose, HaOpen ) );

slope = Param("slope",2,2,100,1);
Color20= IIf(LinRegSlope(MA(HaClose,a),slope)>10,colorRed,colorGreen);

Plot(MA(HaClose,a),"", color20,styleThick);// for buy


Color=IIf(Haclose>MA(HaClose,a),colorGreen, colorRed);
_SECTION_END();


//Buy=Color==colorGreen;
//Sell=Color==colorRed;

//Buy=ExRem(Buy,Sell);
//Sell=ExRem(Sell,Buy);

//PlotShapes(IIf(Buy , shapeUpArrow, shapeNone),colorGreen);
//PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorRed);




b=1; //DEFAULT 20//CHANGED BY MOMIN//

_SECTION_BEGIN("HeikenAshiSmoothed");
GraphXSpace=5;
p=205; //DEFAULT 5 final50 //for red line
Om=DEMA(O,p);
hm=DEMA(H,p);
lm=DEMA(L,p);
Cm=DEMA(C,p);
HACLOSE=(Om+Hm+Lm+Cm)/4;
HaOpen = AMA( Ref( HaClose, 1), 1);
HaHigh = Max( Hm, Max( HaClose, HaOpen ) );
HaLow = Min( Lm, Min( HaClose, HaOpen ) );

slope = Param("slope",2,2,100,1);
Color20= IIf(LinRegSlope(MA(HaClose,b),slope)<100,colorRed,colorGreen);

Plot(MA(HaClose,b),"", color20,styleThick);//for sale

Color=IIf(Haclose>MA(HaClose,b),colorGreen, colorRed);

_SECTION_END();


Buy=Color==colorGreen;
Sell=Color==colorRed;

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

PlotShapes(IIf(Buy , shapeUpArrow, shapeNone),colorGreen);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorRed);






//MOMIN//////////////////
_SECTION_BEGIN("Magfied Market Price");
FS=Param("Font Size",30,11,100,1);
GfxSelectFont("Times New Roman", FS, 700, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor("Color",colorYellow) );
Hor=Param("Horizontal Position",1480,1,1800,1);
Ver=Param("Vertical Position",12,1,830,1);
GfxTextOut(""+C, Hor-690 , Ver );
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont("Times New Roman", 11, 700, True );
GfxSetBkMode( colorBlack );
GfxSetTextColor(ParamColor("Color",colorYellow) );
GfxTextOut(""+DD+" ("+xx+"%)", Hor-690 , Ver+45 );



/////MOMIN///////

_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 )) ));
_SECTION_END();



Buy and Sell Signal is not generating when EMA Line is crossing each other .
Please help.
Momin

The code that you've written is syntactically correct and valid but is logically not complete as yet. What I mean is that Amibroker will be happy to execute this but it will be waste of time and you will see no signals.

In nutshell, the problem is that you've over-smoothened (flattened) the data. Average Lines will certainly intersect each other but it will not be too often...

DEMA of O H L C prices for 200 bars and then for 205 bars virtually eliminates all noise and you will get very smooth lines that will only meet if market has a very big drop or a very rapid climb.

If you zoom out chart all the way, you should see one arrow at beginning of the chart....
 

hmp

Well-Known Member
Hi sr114
How to use this full set up? I mean along with afl for upper pane that already has been given. Which time frame is ok for intraday?
Thanks & regards
 

amitrandive

Well-Known Member
Thank you. I have been trying this AFL, but I cant seem to get it to work.


You see, the lower box displays the RSI(14) on daily chart. The upper box shows the ITF-RSI code result. Doesn't seem that the lines and values matches with the DAILY RSI(14) below?

Explanation of the code on the site.This is not RSI,but an Inverse Fisher Transform of it.


This is the Inverse Fisher Transform (IFT) of the Relative Strength Index (RSI), across multiple timeframes. It only shows two timeframes at any given time -- the currrent chart time frame, and the next largest time frame (see code for details).

Hourly chart: When the IFT is oversold on the daily IFT, and lifting up above the oversold line -- and the hourly IFT is also rising -- this is a good buy signal. The reverse is true for a short signal.

This may be used with 5 min., hourly, daily, and weekly charts.

Included is Tom DeMark-style duration analysis, which includes trend strength arrows. These arrows are not buy or sell signals. Instead, they represent extreme conditions, which usually end up with a strong rebound, or a strong continuation of the trend. Use something like the Volume Flow Indicator (VFI) to help determine which way the trend will go.

The white IFT line always represents the smaller time frame (i.e, the default time frame for the chart).

You may want to build a version of this that uses Tom DeMark's Range Expansion Index, instead of the IFT or RSI. This works well to help determine what this IFT indicator will likely do next.
 
Last edited:

amitrandive

Well-Known Member
Thank you. I have been trying this AFL, but I cant seem to get it to work.


You see, the lower box displays the RSI(14) on daily chart. The upper box shows the ITF-RSI code result. Doesn't seem that the lines and values matches with the DAILY RSI(14) below?

Try this , it should work


Code:
_SECTION_BEGIN("RSI1");
SetChartOptions(0,0,chartGrid30|chartGrid70);
periods = Param( "Periods", 15, 1, 200, 1 );
Plot( RSI( periods), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style")  );
_SECTION_END();
StartBar=SelectedValue(BarIndex());
FinishBar = EndValue( BarIndex() );
i = Startbar;
 TimeFrameSet(inWeekly);
f=RSI(14);
H=TimeFrameExpand(f,inWeekly);
Plot(H,"my",colorBrown,styleLine);
 

sr114

Well-Known Member
Perfect! :thumb:

Thanks, amitrandive. :clap:
weekly rsi on daily rsi

_SECTION_BEGIN("RSI");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkGradientFill( ParamColor("Inner panel upper",colorBlack),ParamColor("Inner panel lower",colorBlack));
SetChartOptions(0,0,chartGrid30|chartGrid70);

periods = Param( "Periods", 15, 1, 200, 1 );
Plot( RSI( periods), "\nDly RSI", ParamColor( "Color", colorCycle ), ParamStyle("Style") );
Plot(70,"",colorDarkGrey,1);
Plot(30,"",colorDarkGrey,1);

TimeFrameSet( inWeekly ); // switch to 5 minute frame
r2=RSI(periods);
TimeFrameRestore(); // restore time frame to original
Plot(TimeFrameExpand( r2, inWeekly ,expandFirst ), "\nweekly rsi" ,colorBrightGreen, ParamStyle("Style", styleDashed|styleThick) | styleNoRescale );GraphXSpace=15;


_SECTION_END();
told u to read the manual - its explained there
 
Last edited:
Momin

The code that you've written is syntactically correct and valid but is logically not complete as yet. What I mean is that Amibroker will be happy to execute this but it will be waste of time and you will see no signals.

In nutshell, the problem is that you've over-smoothened (flattened) the data. Average Lines will certainly intersect each other but it will not be too often...

DEMA of O H L C prices for 200 bars and then for 205 bars virtually eliminates all noise and you will get very smooth lines that will only meet if market has a very big drop or a very rapid climb.

If you zoom out chart all the way, you should see one arrow at beginning of the chart....

Dear sir I have made this afl for NIFTY long term trading not for short term trading. When the market volatile it does not effect to the buy/sell so you can be feel relaxed. This afl ignore market volatility and avoid frequent buy/sell signal. I have manual tested it will give you return in nifty.

Idea is only for backtesting and clarity of signal.

So please help me to generate Buy Sell Signal in that afl.

for current example in nifty Sell signal came at 19/02/2015 at [email protected] after that nifty slipped down and the price was on 24/02/2015 at 02:44pm @Rs8727 now you can book profit of Rs.103 but next day i.e. 25/02/2015 market recovered and nifty goes upside till Rs.8847.50 High but the buy siganal not came and again after noon market slipped to Rs.8768 at 3.30pm. so totally ignored market volatility.

So you are totally safe in volatile market. I have made this AFL for use only me if anybody likes he can also use it at own risk.
 

Nehal_s143

Well-Known Member
Dear sir I have made this afl for NIFTY long term trading not for short term trading. When the market volatile it does not effect to the buy/sell so you can be feel relaxed. This afl ignore market volatility and avoid frequent buy/sell signal. I have manual tested it will give you return in nifty.

Idea is only for backtesting and clarity of signal.

So please help me to generate Buy Sell Signal in that afl.

for current example in nifty Sell signal came at 19/02/2015 at [email protected] after that nifty slipped down and the price was on 24/02/2015 at 02:44pm @Rs8727 now you can book profit of Rs.103 but next day i.e. 25/02/2015 market recovered and nifty goes upside till Rs.8847.50 High but the buy siganal not came and again after noon market slipped to Rs.8768 at 3.30pm. so totally ignored market volatility.

So you are totally safe in volatile market. I have made this AFL for use only me if anybody likes he can also use it at own risk.
for paper trade its ok, in practical can you hold long position, if Nifty come down by 200-400 pts ???
 
for paper trade its ok, in practical can you hold long position, if Nifty come down by 200-400 pts ???
Dear sir you are truly right nobody even me also can not bear/hold the loss of 200-400 points in nifty so this purpose I have checked the nifty data from 01/03/2014 to till date i.e. 25.02.2015. You can also check this afl on nifty.

If you generate the buy/sell signal on chart it will be more easy for trade, backtesting and for your question's reply.
 

Similar threads