Simple Coding Help - No Promise.

mastermind007

Well-Known Member
Video...over hyped...not as great as meltdown or inside job..
Jumping of the queue, I've seen it happen in NSE too.... and there definitely are more order types than B, S; For e.g. Exchanges do have a order type in which you can provide Entry, SL and Exit Target in a single order but there is a certain inertia in getting it off the ground.
 

mastermind007

Well-Known Member
Last edited:
Hi All,
is it possible to change the price candle color if it is nearing previous week high or low? Could you please someone guide me? Thanks
 

toocool

Well-Known Member


i do not exactly which pivot levels these are but can experts please make an afl just like this which shows only current pivot, r1 ,r2, s1,s2 , levels in amibroker instead of all previous .i tried finding it everywhere but i always got this ,amibroker afl of below image has all kinds of pivots, namely camarilla, fibo, and all but none are plotted like the above image , for next month, week ,day only , what do i have to change to do that i do not know ,please help


can we not get exactly like the 1st image?
 
Last edited:

Raghuveer

Well-Known Member
Hi All,
is it possible to change the price candle color if it is nearing previous week high or low? Could you please someone guide me? Thanks
Try below afl on blank chart to see if its suitable.
@others: see the 2 "Plot(C," lines (line 6 and line 30). Is there any way to use just one Plot(C, ...) line? Any other suggestions welcome.
Code:
_SECTION_BEGIN("Price");
//change the price candle color if it is nearing previous week high or low

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 ), styleNoDraw |styleNoTitle | ParamStyle("Style-NoDraw",styleNoLabel) | GetPriceStyle() ); 

WH= TimeFrameGetPrice("H", inWeekly, -1); // 0 for current week
WL= TimeFrameGetPrice("L", inWeekly, -1);
ShowWeeklyHL= ParamToggle("ShowWeeklyHL", "No|Yes", 0);
if(ShowWeeklyHL)
{
W1HColor= ParamColor("W1HColor", colorBlue);
W1LColor= ParamColor("W1LColor", colorBlue);
W1HStyle= ParamStyle("W1HStyle", styleDots|styleNoLabel|styleNoRescale);
W1LStyle= ParamStyle("W1LStyle", styleDots|styleNoLabel|styleNoRescale);
Plot(WH, "WH", W1HColor, W1HStyle);
Plot(WL, "WL", W1LColor, W1LStyle);
};
upCandleColor=ParamColor("Up Candle Color", colorGreen );
downCandleColor=ParamColor("Down Candle Color", colorBrown );
boundaryCandleColor=ParamColor("Boundary Candle Color", colorYellow );
upCandleCondition=C>O;
downCandleCondition=C<O;
//candleOutLineColor=IIf(upCandleCondition, upCandleColor, downCandleColor);
candleFillColor=IIf(upCandleCondition, upCandleColor, downCandleColor);
PointsDifference=Param("Points Difference",10);
candleFillColor=IIf(abs(WH-H)<PointsDifference OR abs(L-WL)<PointsDifference,boundaryCandleColor,candleFillColor);
//SetBarFillColor(candleFillColor);
Plot(C, "Close", candleFillColor, styleNoTitle | ParamStyle("Price Style-Draw") | GetPriceStyle());
//Plot(C, "Close", candleOutLineColor, styleNoTitle | ParamStyle("Price Style", styleNoLabel) | GetPriceStyle());
_SECTION_END();
Also see this afl that plots several S/R lines.
 
Thank you. Could you please help me to correct the issue in the below afl? thanks
Code:
_SECTION_BEGIN("Weekly and Previous Day High Low");
WeekH = TimeFrameGetPrice("H", inWeekly, -1);
WeekHL = ((.5/100)*WeekH) ;
WeekL = TimeFrameGetPrice("L", inWeekly, -1);
WeekLL = ((.5/100)*WeekL);
cWeekH = TimeFrameGetPrice("H", inWeekly);
cWeekHL = ((.5/100)*cWeekH);
cWeekL = TimeFrameGetPrice("L", inWeekly);
cWeekLL = ((.5/100)*cWeekL);
DayH = TimeFrameGetPrice("H", inDaily, -1);
DayHL = ((.5/100)*DayH);
DayL = TimeFrameGetPrice("L", inDaily, -1);
DayLL = ((.5/100)*DayL);
if(C < (WeekHL + WeekH) AND C > (WeekH-WeekHL)){ 
	GfxSetTextColor(colorBlue);
	GfxTextOut("Last Week High & Low  " + NumToStr( WeekH, format = 1.2) ,0,20);
	GfxTextOut(" - " + NumToStr( WeekL, format = 1.2),200,20);
}
GfxTextOut("Week High & Low  " + NumToStr( cWeekH, format = 1.2) ,300,20);
GfxTextOut(" - " + NumToStr( cWeekL, format = 1.2),450,20);
GfxTextOut("Previous Day High & Low  " + NumToStr( DayH, format = 1.2) ,600,20);
GfxTextOut(" - " + NumToStr( DayL, format = 1.2),800,20);
_SECTION_END();
 

Raghuveer

Well-Known Member
Need a good way to combine the 3 "IIf(Condition1,...)" lines into 1 line.
Code:
_SECTION_BEGIN("Weekly and Previous Day High Low");
WeekH = TimeFrameGetPrice("H", inWeekly, -1);
WeekHL = ((.5/100)*WeekH) ;
WeekL = TimeFrameGetPrice("L", inWeekly, -1);
WeekLL = ((.5/100)*WeekL);
cWeekH = TimeFrameGetPrice("H", inWeekly);
cWeekHL = ((.5/100)*cWeekH);
cWeekL = TimeFrameGetPrice("L", inWeekly);
cWeekLL = ((.5/100)*cWeekL);
DayH = TimeFrameGetPrice("H", inDaily, -1);
DayHL = ((.5/100)*DayH);
DayL = TimeFrameGetPrice("L", inDaily, -1);
DayLL = ((.5/100)*DayL);
Condition1=(C<(WeekHL + WeekH)) AND (C>(WeekH-WeekHL));
IIf(Condition1,GfxSetTextColor(colorBlue),0);
IIf(Condition1,GfxTextOut("Last Week High & Low  " + NumToStr( WeekH, format = 1.2) ,0,20),0);
IIf(Condition1,GfxTextOut(" - " + NumToStr( WeekL, format = 1.2),200,20),0);

GfxTextOut("Week High & Low  " + NumToStr( cWeekH, format = 1.2) ,300,20);
GfxTextOut(" - " + NumToStr( cWeekL, format = 1.2),450,20);
GfxTextOut("Previous Day High & Low  " + NumToStr( DayH, format = 1.2) ,600,20);
GfxTextOut(" - " + NumToStr( DayL, format = 1.2),800,20);
_SECTION_END();
Thank you. Could you please help me to correct the issue in the below afl? thanks
Code:
_SECTION_BEGIN("Weekly and Previous Day High Low");
WeekH = TimeFrameGetPrice("H", inWeekly, -1);
WeekHL = ((.5/100)*WeekH) ;
WeekL = TimeFrameGetPrice("L", inWeekly, -1);
WeekLL = ((.5/100)*WeekL);
cWeekH = TimeFrameGetPrice("H", inWeekly);
cWeekHL = ((.5/100)*cWeekH);
cWeekL = TimeFrameGetPrice("L", inWeekly);
cWeekLL = ((.5/100)*cWeekL);
DayH = TimeFrameGetPrice("H", inDaily, -1);
DayHL = ((.5/100)*DayH);
DayL = TimeFrameGetPrice("L", inDaily, -1);
DayLL = ((.5/100)*DayL);
if(C < (WeekHL + WeekH) AND C > (WeekH-WeekHL)){ 
	GfxSetTextColor(colorBlue);
	GfxTextOut("Last Week High & Low  " + NumToStr( WeekH, format = 1.2) ,0,20);
	GfxTextOut(" - " + NumToStr( WeekL, format = 1.2),200,20);
}
GfxTextOut("Week High & Low  " + NumToStr( cWeekH, format = 1.2) ,300,20);
GfxTextOut(" - " + NumToStr( cWeekL, format = 1.2),450,20);
GfxTextOut("Previous Day High & Low  " + NumToStr( DayH, format = 1.2) ,600,20);
GfxTextOut(" - " + NumToStr( DayL, format = 1.2),800,20);
_SECTION_END();
 

pratapvb

Well-Known Member
hmm
can we plot the Standard deviation bands to the moving averages as the VWAP shown by Pratap??
you mean that if you use say 21ema then std dev of price around that is to be found?

if so will the ema be of same TF or higher TF?

and what is the use of it? how will you use it?
 

Gandhar.

Well-Known Member
you mean that if you use say 21ema then std dev of price around that is to be found?yes

if so will the ema be of same TF or higher TF?ema of same TF

and what is the use of it? how will you use it?
generally took 20D ema and plotted 2 SD bands with it....
used formula = StDev(C,20);
found out that it behaved same way as the Vwap would
wanted to have vwap like something in daily or other TF charts

 
Last edited:

Similar threads