Simple Coding Help - No Promise.

Yes shubh03 it is possible.

Here i present u the OHLC candle form RSI.
similarly u can do others too.

Code:
periods = Param( "Periods", 21, 1, 200, 1 );
//r= RSI( periods);
O=RSIa(O, periods);
H=RSIa(H, periods);
L=RSIa(L, periods);
C=RSIa(C, periods);

PlotOHLC(O,H,L,C,"RSI "+periods, ParamColor( "Color", colorBlack ), ParamStyle("Style",styleCandle)  );
_N(Title = StrFormat(" \n Op=> %g, \n Hi=> %g, \n Lo=> %g, \n Cl=> %g, \n " , O, H, L, C));
THANKS extremist

how to use it for stochi indicator
 

pratapvb

Well-Known Member
(In reply to Main help request at http://www.traderji.com/amibroker/90119-simple-coding-help-no-promise-163.html#post971592 )



Sir I am getting 1 min data, please let me know which value we can try to get near by tick avg of share khan.
check my vwap code....in that if you put NDays = 0 then it will do intraday vwap and then say periods = 30....means it will do 30 bar vwap so on 1min it wil be vwap and SDs of last 30min.....don't know how tick averging is done....how many ticks, etc

and no Sir please :)
 

Nehal_s143

Well-Known Member
check my vwap code....in that if you put NDays = 0 then it will do intraday vwap and then say periods = 30....means it will do 30 bar vwap so on 1min it wil be vwap and SDs of last 30min.....don't know how tick averging is done....how many ticks, etc

and no Sir please :)
Sir your post#35 has rapidshare link, which now required to be paid member to download the file, i found below code on net

today share khan closing tick avg is 7545.5 and afl shows 7545.6, will test/compare tomorrow in live market.


Code:
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() ); 


ND = Day() != Ref(Day(), -1);

/////  VWAP and  SDs /////

P = (H + L) / 2;
VWP = P * V;
BI = BarIndex();
BeginBI = ValueWhen(ND, BI);
BeginBI = BeginBI[BarCount -1];
if(BeginBI < BarCount - 1)
	{
	InRange = BI >= BeginBI;
	CumV = Cum(V * InRange);
	CumVWP = Cum(VWP * InRange);
	 VWAP = CumVWP / CumV;
	S = Cum(Ref(CumV, -1) * V * (P - Ref(VWAP, -1))^2 / CumV);
	Variance = S / CumV;
	 SD = sqrt(Variance);
	 VWAP = IIf(InRange,  VWAP, Null);
	Plot(VWAP, "VWAP", colorYellow, styleNoTitle + styleNoRescale);
//	Plot(VWAP +  SD, "+1SD", colorGreen, styleDashed + styleNoTitle + styleNoRescale);
//	Plot(VWAP -  SD, "-1SD", colorRed, styleDashed + styleNoTitle + styleNoRescale);
//	Plot(VWAP + 2*SD, "+2SD", colorSeaGreen, styleDashed + styleNoTitle + styleNoRescale);
//	Plot(VWAP - 2*SD, "-2SD", colorOrange, styleDashed + styleNoTitle + styleNoRescale);
//	Plot(VWAP + 3*SD, "+3SD", colorPaleGreen, styleDashed + styleNoTitle + styleNoRescale);
//	Plot(VWAP - 3*SD, "-3SD", colorLightOrange, styleDashed + styleNoTitle + styleNoRescale);
	}
 

pratapvb

Well-Known Member
Sir your post#35 has rapidshare link, which now required to be paid member to download the file, i found below code on net

today share khan closing tick avg is 7545.5 and afl shows 7545.6, will test/compare tomorrow in live market.


Code:
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() ); 


ND = Day() != Ref(Day(), -1);

/////  VWAP and  SDs /////

P = (H + L) / 2;
VWP = P * V;
BI = BarIndex();
BeginBI = ValueWhen(ND, BI);
BeginBI = BeginBI[BarCount -1];
if(BeginBI < BarCount - 1)
	{
	InRange = BI >= BeginBI;
	CumV = Cum(V * InRange);
	CumVWP = Cum(VWP * InRange);
	 VWAP = CumVWP / CumV;
	S = Cum(Ref(CumV, -1) * V * (P - Ref(VWAP, -1))^2 / CumV);
	Variance = S / CumV;
	 SD = sqrt(Variance);
	 VWAP = IIf(InRange,  VWAP, Null);
	Plot(VWAP, "VWAP", colorYellow, styleNoTitle + styleNoRescale);
//	Plot(VWAP +  SD, "+1SD", colorGreen, styleDashed + styleNoTitle + styleNoRescale);
//	Plot(VWAP -  SD, "-1SD", colorRed, styleDashed + styleNoTitle + styleNoRescale);
//	Plot(VWAP + 2*SD, "+2SD", colorSeaGreen, styleDashed + styleNoTitle + styleNoRescale);
//	Plot(VWAP - 2*SD, "-2SD", colorOrange, styleDashed + styleNoTitle + styleNoRescale);
//	Plot(VWAP + 3*SD, "+3SD", colorPaleGreen, styleDashed + styleNoTitle + styleNoRescale);
//	Plot(VWAP - 3*SD, "-3SD", colorLightOrange, styleDashed + styleNoTitle + styleNoRescale);
	}
this should be same as what we use with Nday = 1...... only thing is tick data based vwap wll be more precise in the beginning of day and our vwap on 1min will be slightly approximate....but as the day progresses it will become more or less same
 

manojborle

Well-Known Member
I have some queries:
I have already set up email settings so that if any alert is triggered I will get an email. So my query is whether I have to write afl having alertif functions for each and every scrip if I want the trigger to be at particular price.

Is the chart for that scrip should be open in Amibroker for the alert to be triggered ?

If I want the alert to be triggered when the price touches trendlines or it is near the trendlines, How can I write afl for that ?

I have tried a test mail and it was successful.
Now If I am able to write this afl life will be much easy for me and it will be very easy for me to find out setups.

Please help me in this.

Thanks
 
I request all traderji experts
Pls help me simple system

Iam using ema based buy sell. My system is below

Buy=buy abv 30ema high
Sell=sell below 30ema low

I need add exploration

Highest high value for every buy signal
 

Nehal_s143

Well-Known Member
this should be same as what we use with Nday = 1...... only thing is tick data based vwap wll be more precise in the beginning of day and our vwap on 1min will be slightly approximate....but as the day progresses it will become more or less same
Sir, afl and trade tiger levels where similar, as you said at beginning it was slightly approximate and as day was in progress it become bit different after 2.25pm rally, till 2.25pm it was very much similar
 
Dear seniors,

i want to find peak & trough & plot on macd any one suggest me how can it is possible i m trying below formula but it is not working after lots of try i reliaze peak & trough funtion not work which indicator go below 0 (zero) .

please help me on it

_SECTION_BEGIN("MACD");
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );

r1 = Optimize( "Fast avg", r1 , 2, 200, 1 );
r2 = Optimize( "Slow avg", r2 , 2, 200, 1 );
r3 = Optimize( "Signal avg", r3 , 2, 200, 1 );

Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2), ParamColor("MACD color", colorRed ), ParamStyle("MACD style") );
Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(), ParamColor("Signal color", colorBlue ), ParamStyle("Signal style") );
Plot( ml-sl, "MACD Histogram", ParamColor("Histogram color", colorBlack ),
styleNoTitle | ParamStyle("Histogram style", styleHistogram | styleNoLabel, maskHistogram ) );


Buy= Cross(ml , sl);
Sell= Cross( sl, ml);

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

a=Peak(Buy,1);
Plot(a,"peak",colorGreen,styleDashed,1);


AlertIf( Buy , "SOUND C:\\Windows\\Media\\chimes.wav", "Audio alert", 2 );
AlertIf( Sell , "SOUND C:\\Windows\\Media\\alert.wav", "Audio alert", 2 );

_SECTION_END();
 

pratapvb

Well-Known Member
Dear seniors,

i want to find peak & trough & plot on macd any one suggest me how can it is possible i m trying below formula but it is not working after lots of try i reliaze peak & trough funtion not work which indicator go below 0 (zero) .

please help me on it

_SECTION_BEGIN("MACD");
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );

r1 = Optimize( "Fast avg", r1 , 2, 200, 1 );
r2 = Optimize( "Slow avg", r2 , 2, 200, 1 );
r3 = Optimize( "Signal avg", r3 , 2, 200, 1 );

Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2), ParamColor("MACD color", colorRed ), ParamStyle("MACD style") );
Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(), ParamColor("Signal color", colorBlue ), ParamStyle("Signal style") );
Plot( ml-sl, "MACD Histogram", ParamColor("Histogram color", colorBlack ),
styleNoTitle | ParamStyle("Histogram style", styleHistogram | styleNoLabel, maskHistogram ) );


Buy= Cross(ml , sl);
Sell= Cross( sl, ml);

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

a=Peak(Buy,1);
Plot(a,"peak",colorGreen,styleDashed,1);


AlertIf( Buy , "SOUND C:\\Windows\\Media\\chimes.wav", "Audio alert", 2 );
AlertIf( Sell , "SOUND C:\\Windows\\Media\\alert.wav", "Audio alert", 2 );

_SECTION_END();
Can you explain what exacting you are looking for when you do

a = peak(buy , 1)
 

Similar threads