Simple Coding Help - No Promise.

And where is your exploration code? I only see two conditions but no exploration code. And what signals? Raw or non raw?
Sorry... I was tied up with other things to check on this thread.

Now, the exploration is pretty simple. The rest of the code is just basic stuff. Here is it if you think it'll help you give me a proper answer.

// Begin Exploration
Buy = Cross( TEMA_LOWER, TEMA_UPPER ) ;
Sell = Cross( TEMA_UPPER, TEMA_LOWER ) ;

Filter = Buy OR Sell ;

AddColumn( C, "Close", 1.1 );
AddColumn( Buy, "Buy", 1 );
AddColumn( H, "High", 1.1 );
AddColumn( Sell, "Sell", 1 );
AddColumn( L, "Low", 1.1 );

// End Exploration

Perhaps my request is not as simple as I expect it to be? :confused:

"If I get a Buy/Sell today... How do I list DATE+OHLC last time the Buy/Sell happened?"

I would guess my exploration would have to do a double run each time... One to check Buy/Sell and second time to check the previous Buy/Sell.

I just don't know how to achieve a simultaneous second run??
 

trash

Well-Known Member
Sorry... I was tied up with other things to check on this thread.

Now, the exploration is pretty simple. The rest of the code is just basic stuff. Here is it if you think it'll help you give me a proper answer.

// Begin Exploration
Buy = Cross( TEMA_LOWER, TEMA_UPPER ) ;
Sell = Cross( TEMA_UPPER, TEMA_LOWER ) ;

Filter = Buy OR Sell ;

AddColumn( C, "Close", 1.1 );
AddColumn( Buy, "Buy", 1 );
AddColumn( H, "High", 1.1 );
AddColumn( Sell, "Sell", 1 );
AddColumn( L, "Low", 1.1 );

// End Exploration

Perhaps my request is not as simple as I expect it to be? :confused:

"If I get a Buy/Sell today... How do I list DATE+OHLC last time the Buy/Sell happened?"

I would guess my exploration would have to do a double run each time... One to check Buy/Sell and second time to check the previous Buy/Sell.

I just don't know how to achieve a simultaneous second run??
The code will output raw signals

Code:
// adjusted by trash, May 2014 for ma5yk at traderji.com
// http://www.traderji.com/amibroker/90119-simple-coding-help-no-promise-174.html#post968982

TEMA_LOWER = TEMA( C, 20 );
TEMA_UPPER = TEMA( C, 50 );

Buy = Cross( TEMA_LOWER, TEMA_UPPER ) ;
Sell = Cross( TEMA_UPPER, TEMA_LOWER ) ;

Filter = Buy OR Sell;

format = 1.2;
colorfont = colorDefault;
colorcell = colorDefault;
width = 60;

dt = DateTime();

AddColumn( C, "Close", format, colorfont, colorcell, width );
AddColumn( Buy, "Buy", 1, colorfont, colorcell, width );
AddColumn( H, "High", format, colorfont, colorcell, width );
AddColumn( Sell, "Sell", 1, colorfont, colorcell, width );
AddColumn( L, "Low", format, colorfont, colorcell, width );

AddColumn( IIf( Buy, ValueWhen( Buy, dt, 2 ), Null ), "DateTime prev.Buy", formatdatetime, colorfont, colorcell, 120 );
AddColumn( IIf( Buy, ValueWhen( Buy, C, 2 ), Null ), "Close", format, colorfont, colorcell, width );
AddColumn( IIf( Buy, ValueWhen( Buy, 1, 2 ), Null ), "prev.Buy", 1, colorfont, colorcell, width );
AddColumn( IIf( Buy, ValueWhen( Buy, H, 2 ), Null ), "High", format, colorfont, colorcell, width );
AddColumn( IIf( Sell, ValueWhen( Sell, dt, 2 ), Null ), "DateTime prev.Sell", formatdatetime, colorfont, colorcell, 120 );
AddColumn( IIf( Sell, ValueWhen( Sell, C, 2 ), Null ), "Close", format, colorfont, colorcell, width );
AddColumn( IIf( Sell, ValueWhen( Sell, 1, 2 ), Null ), "prev.Sell", 1, colorfont, colorcell, width );
AddColumn( IIf( Sell, ValueWhen( Sell, L, 2 ), Null ), "Low", format, colorfont, colorcell, width);
 
Last edited:
Hi,

Below is a simple and effective 'Support Resistance Dots' code by Mr. Shenoi. My observation is that SRs from distant past can be useful. However, distant SRs are not drawn by this afl.

Is it possible to extend all SR lines to right of chart. However, because numerous lines would simply blanket the chart. Is it possible to make a certain line appear only if price is near to that certain line (say the price is in a given %range of that SR line).

(i have tried my hands on AFL and have tried a few mods. But i am no programmer and the topic of this post brought me here to seek help.)

Request AFL experts for help.
**************************************************
/* SUPPORT AND RESISTANCE */
/* AFL Code - Prakash Shenoi */

LB= Param("Look Back Periods",10,1,30,1);
R=ValueWhen(Cross(MA(C,LB),C),HHV(H,LB),1);
S=ValueWhen(Cross(C,MA(C,LB)),LLV(L,LB),1);
Color=IIf(O>C,colorRed,colorGreen);
Plot (R,"Resz",colorRed,8+16);
Plot (s,"Supp",colorBrightGreen,8+16);
Plot (C,"Close",color,64,32);
GraphXSpace=4;
 

extremist

Well-Known Member
to all....

is there any way that we calculate something on Range bars and plot it on 5 min time frame?

I tried it by

TimeFrameMode( 2 );
TimeFrameSet( 500 ); // 500 share bars..
//...do something ...
TimeFrameRestore();

but i failed
if anyone can help me then that will be a great help.
is there any way to have the advantage of range bars to time based time frames?

please somebody throw some light on it
 

amitrandive

Well-Known Member
to all....

is there any way that we calculate something on Range bars and plot it on 5 min time frame?

I tried it by

TimeFrameMode( 2 );
TimeFrameSet( 500 ); // 500 share bars..
//...do something ...
TimeFrameRestore();

but i failed
if anyone can help me then that will be a great help.
Try this.Make sure to make proper range bars , you need to use true tick data.

Code:
_SECTION_BEGIN( "Price" );
SetChartOptions( 0, chartShowArrows | chartShowDates );
SetChartBkGradientFill( ParamColor( "Inner panel upper", colorBlack ), ParamColor( "Inner panel lower", colorBlack ) );
_N( Title = EncodeColor( colorWhite ) + StrFormat( "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );

rangesize = Param("Range bar size", 20, 1, 1000, 1);

TimeFrameMode( 4 ); // turn on range bars where N is expressed in tick size
TimeFrameSet( rangesize ); // range in tick size

SetBarFillColor( IIf( C > O, ParamColor( "Candle UP Color", colorGreen ), IIf( C <= O, ParamColor( "Candle Down Color", colorRed ), colorLightGrey ) ) );
Plot( C, "", IIf( C > O, ParamColor( "Wick UP Color", colorDarkGreen ), IIf( C <= O, ParamColor( "Wick Down Color", colorDarkRed ), colorLightGrey ) ), 64, 0, 0, 0, 0 );

a1=EMA(EMA(C,21),21); //DEMA of Close
a2=EMA(a1,21);
Difference=a1-a2;
a=a1+difference; //zerolag
Plot( A, "", colorWhite, styleLine, styleThick );

b1=EMA(EMA(C,8),8); //DEMA of Close
b2=EMA(b1,8);
Difference=b1-b2;
b=b1+difference; //zerolag
Plot( B, "", colorAqua, styleLine, styleThick );
_SECTION_END();
 

extremist

Well-Known Member
Try this.Make sure to make proper range bars , you need to use true tick data.

Code:
_SECTION_BEGIN( "Price" );
SetChartOptions( 0, chartShowArrows | chartShowDates );
SetChartBkGradientFill( ParamColor( "Inner panel upper", colorBlack ), ParamColor( "Inner panel lower", colorBlack ) );
_N( Title = EncodeColor( colorWhite ) + StrFormat( "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );

rangesize = Param("Range bar size", 20, 1, 1000, 1);

TimeFrameMode( 4 ); // turn on range bars where N is expressed in tick size
TimeFrameSet( rangesize ); // range in tick size

SetBarFillColor( IIf( C > O, ParamColor( "Candle UP Color", colorGreen ), IIf( C <= O, ParamColor( "Candle Down Color", colorRed ), colorLightGrey ) ) );
Plot( C, "", IIf( C > O, ParamColor( "Wick UP Color", colorDarkGreen ), IIf( C <= O, ParamColor( "Wick Down Color", colorDarkRed ), colorLightGrey ) ), 64, 0, 0, 0, 0 );

a1=EMA(EMA(C,21),21); //DEMA of Close
a2=EMA(a1,21);
Difference=a1-a2;
a=a1+difference; //zerolag
Plot( A, "", colorWhite, styleLine, styleThick );

b1=EMA(EMA(C,8),8); //DEMA of Close
b2=EMA(b1,8);
Difference=b1-b2;
b=b1+difference; //zerolag
Plot( B, "", colorAqua, styleLine, styleThick );
_SECTION_END();
no amit ....
this not wht i mean to say
i'm actually using range bars successfully
wht i need is calculate ema on range bars and plot it on 1minute time frame.
 

cellclinic

Well-Known Member
Hello Amit ...

Sorry for replying late as i was out of the city ... Afl is the same you modified for previous day HLC ... not using 2-3 days HLC or pivots ...

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

//Previous Days HI LO CL//

DayH = TimeFrameGetPrice("H", inDaily, -1); DayHI = LastValue (DayH,1);// yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1); DayLI = LastValue (DayL,1); // yesterdays low
DayC = TimeFrameGetPrice("C", inDaily, -1); DayCI = LastValue (DayC,1); // yesterdays close
DayO = TimeFrameGetPrice("O", inDaily); // current day open
DayH2= TimeFrameGetPrice("H", inDaily, -2); DayH2I = LastValue (DayH2,1); // Two days before high
DayL2= TimeFrameGetPrice("L", inDaily, -2); DayL2I = LastValue (DayL2,1); // Two days before low
DayC2= TimeFrameGetPrice("C", inDaily, -2); DayC2I = LastValue (DayC2,1); // Two days before close
DayH3= TimeFrameGetPrice("H", inDaily, -3); DayH3I = LastValue (DayH3,1); // Three days before high
DayL3= TimeFrameGetPrice("L", inDaily, -3); DayL3I = LastValue (DayL3,1); // Three days before low
DayC3= TimeFrameGetPrice("C", inDaily, -3); DayC3I = LastValue (DayC3,1); // Three days before close
numbars = LastValue(Cum(Status("barvisible")));
hts = -33.5;

YHL = ParamToggle("PreviousDay HI LO CL ","Show|Hide",1);
if(YHL==1) {
Plot(DayL,"PDL",colorRed,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH,"PDH",colorBlue,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayC,"PDC",colorDarkRed,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
PlotText(" PDH " , LastValue(BarIndex())-25, DayHI+1, colorBlue);
PlotText(" PDL " , LastValue(BarIndex())-25, DayLI+1, colorRed);
PlotText(" PDC " , LastValue(BarIndex())-25, DayCI+1, colorDarkRed);
}

TDBHL = ParamToggle("2/3Days before HI LO CL","Show|Hide",1);
if(TDBHL==1) {
Plot(DayL2,"2DBL",colorOrange,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH2,"2DBH",colorGreen,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
Plot(DayC2,"2DBC",colorWhite,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
Plot(DayL3,"3DBL",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH3,"3DBH",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayC3,"3DBC",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
PlotText(" 2DBH " , LastValue(BarIndex())-25, DayH2I+1, colorGreen);
PlotText(" 2DBL " , LastValue(BarIndex())-25, DayL2I+1, colorOrange);
PlotText(" 2DBC " , LastValue(BarIndex())-25, DayC2I+1, colorWhite);
PlotText(" 3DBH " , LastValue(BarIndex())-25, DayH3I+1, colorTurquoise);
PlotText(" 3DBL " , LastValue(BarIndex())-25, DayL3I+1, colorTurquoise);
PlotText(" 3DBC " , LastValue(BarIndex())-25, DayC3I+1, colorTurquoise);
}

// Pivot Levels //
PP = (DayL + DayH + DayC)/3; PPI = LastValue (PP,1); // Pivot
R1 = (PP * 2) - DayL; R1I = LastValue (R1,1); // Resistance 1
S1 = (PP * 2) - DayH; S1I = LastValue (S1,1); // Support 1
R2 = PP + R1 - S1; R2I = LastValue (R2,1); // Resistance 2
S2 = PP - R1 + S1; S2I = LastValue (S2,1); // Support 2
R3 = PP + R2 - S1; R3I = LastValue (R3,1); // Resistance 3
S3 = PP - R2 + S1; S3I = LastValue (S3,1); // Support 3

ppl = ParamToggle("Pivot Levels","Show|Hide",1);
if(ppl==1) {
Plot(PP, "PP",colorYellow,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R1, "R1",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S1, "S1",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R2, "R2",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S2, "S2",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R3, "R3",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S3, "S3",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);

PlotText(" Pivot ", LastValue(BarIndex())-25, PPI+1, colorYellow);
PlotText(" R1 " , LastValue(BarIndex())-25, R1I+1, colorViolet);
PlotText(" S1 " , LastValue(BarIndex())-25, S1I+1, colorViolet);
PlotText(" R2 " , LastValue(BarIndex())-25, R2I+1, colorViolet);
PlotText(" S2 " , LastValue(BarIndex())-25, S2I+1, colorViolet);
PlotText(" R3 " , LastValue(BarIndex())-25, R3I+1, colorViolet);
PlotText(" S3 " , LastValue(BarIndex())-25, S3I+1, colorViolet);
}
// Camerilla Levels //

rg = (DayH - DayL);

H5=DayC+1.1*rg; H5I = LastValue (H5,1);
H4=DayC+1.1*rg/2; H4I = LastValue (H4,1);
H3=DayC+1.1*rg/4; H3I = LastValue (H3,1);
H2=DayC+1.1*rg/6; H2I = LastValue (H2,1);
H1=DayC+1.1*rg/12; H1I = LastValue (H1,1);
L1=DayC-1.1*rg/12; L1I = LastValue (L1,1);
L2=DayC-1.1*rg/6; L2I = LastValue (L2,1);
L3=DayC-1.1*rg/4; L3I = LastValue (L3,1);
L4=DayC-1.1*rg/2; L4I = LastValue (L4,1);
L5=DayC-1.1*rg; L5I = LastValue (L5,1);

pcl = ParamToggle("Camerilla Levels","Show|Hide",0);
if(pcl==1) {
Plot(H5,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H4,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H3,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H2,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H1,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L1,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L2,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L3,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L4,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L5,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
PlotText(" H5 = " , LastValue(BarIndex())-25, H5I +0.05, colorRose);
PlotText(" H4 = " , LastValue(BarIndex())-25, H4I +0.05, colorRose);
PlotText(" H3 = " , LastValue(BarIndex())-25, H3I +0.05, colorRose);
PlotText(" H2 = " , LastValue(BarIndex())-25, H2I +0.05, colorRose);
PlotText(" H1 = " , LastValue(BarIndex())-25, H1I +0.05, colorRose);
PlotText(" L1 = " , LastValue(BarIndex())-25, L1I +0.05, colorRose);
PlotText(" L2 = " , LastValue(BarIndex())-25, L2I +0.05, colorRose);
PlotText(" L3 = " , LastValue(BarIndex())-25, L3I +0.05, colorRose);
PlotText(" L4 = " , LastValue(BarIndex())-25, L4I +0.05, colorRose);
PlotText(" L5 = " , LastValue(BarIndex())-25, L5I +0.05, colorRose);
}

// Current Days Hi Lo //
THL = ParamToggle("Todays Hi Lo","Show|Hide",1);
if(THL==1) {
isRth = TimeNum() >= 084500 & TimeNum() <= 085959;
isdRth = TimeNum() >= 084500 & TimeNum() <= 235900;
aRthL = IIf(isRth, L, 1000000);
aRthH = IIf(isdRth, H, Null);
aRthLd = IIf(isdRth, L, 1000000);
DayH = TimeFrameCompress( aRthH, inDaily, compressHigh );
DayH = TimeFrameExpand( DayH, inDaily, expandFirst );
DayL = TimeFrameCompress( aRthLd, inDaily, compressLow );
DayL = TimeFrameExpand( DayL, inDaily, expandFirst );
Bars = BarsSince(TimeNum() >= 94500 AND TimeNum() < 095959);//,BarIndex(),1); // AND DateNum()==LastValue(DateNum());
x0 = BarCount-LastValue(Bars);
x1 = BarCount-1;
DayHline=LineArray(x0,LastValue(DayH),x1,LastValue (DayH),0);
DayLline=LineArray(x0,LastValue(DayL),x1,LastValue (DayL),0);
DayHlineI = LastValue (DayHline,1);
DayLlineI = LastValue (DayLline,1);
Plot(DayHline,"DayH",colorBlue,styleBar|styleNoRescale|styleNoTitle);
Plot(DayLline,"DayL",colorRed,styleBar|styleNoRescale|styleNoTitle);
PlotText(" Day Hi " , LastValue(BarIndex())-30, DayHlineI +0.05, colorBlue);
PlotText(" Day Lo " , LastValue(BarIndex())-30, DayLlineI +0.05, colorRed);
}//ESSENTIAL TRADER TOOLS//

_SECTION_BEGIN("Price");
SetChartBkGradientFill( ParamColor("BgTop",colorBlack),ParamColor("BgBottom",colorBlack),ParamColor("Titleblock",colorLightGrey));
SetChartOptions(0,chartShowDates|chartShowArrows|chartLogarithmic|chartWrapTitle);
GraphXSpace = 5;
Plot(C,"",colorWhite,styleCandle);
_SECTION_END();

//Previous Days HI LO CL//

DayH = TimeFrameGetPrice("H", inDaily, -1); DayHI = LastValue (DayH,1);// Previousdays high
DayL = TimeFrameGetPrice("L", inDaily, -1); DayLI = LastValue (DayL,1); // Previousdays low
DayC = TimeFrameGetPrice("C", inDaily, -1); DayCI = LastValue (DayC,1); // Previousdays close
DayO = TimeFrameGetPrice("O", inDaily); // current day open
DayH2= TimeFrameGetPrice("H", inDaily, -2); DayH2I = LastValue (DayH2,1); // Two days before high
DayL2= TimeFrameGetPrice("L", inDaily, -2); DayL2I = LastValue (DayL2,1); // Two days before low
DayC2= TimeFrameGetPrice("C", inDaily, -2); DayC2I = LastValue (DayC2,1); // Two days before close
DayH3= TimeFrameGetPrice("H", inDaily, -3); DayH3I = LastValue (DayH3,1); // Three days before high
DayL3= TimeFrameGetPrice("L", inDaily, -3); DayL3I = LastValue (DayL3,1); // Three days before low
DayC3= TimeFrameGetPrice("C", inDaily, -3); DayC3I = LastValue (DayC3,1); // Three days before close
numbars = LastValue(Cum(Status("barvisible")));
hts = -33.5;

YHL = ParamToggle("Previousday HI LO CL ","Show|Hide",1);
if(YHL==1) {
Plot(DayL,"PDL",colorRed,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH,"PDH",colorBlue,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayC,"PDC",colorDarkRed,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
PlotText(" PDH " , LastValue(BarIndex())-(numbars/Hts), DayHI, colorRed);
PlotText(" PDL " , LastValue(BarIndex())-(numbars/Hts), DayLI, colorBlue);
PlotText(" PDC " , LastValue(BarIndex())-(numbars/Hts), DayCI, colorDarkRed);
}

TDBHL = ParamToggle("2/3Days before HI LO CL","Show|Hide",1);
if(TDBHL==1) {
Plot(DayL2,"2DBL",colorOrange,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH2,"2DBH",colorGreen,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
Plot(DayC2,"2DBC",colorWhite,styleDots|styleNoLine |styleNoRescale|styleNoTitle);
Plot(DayL3,"3DBL",colorPink,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH3,"3DBH",colorBrown,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayC3,"3DBC",colorAqua,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
PlotText(" 2DBH " , LastValue(BarIndex())-(numbars/Hts), DayH2I, colorGreen);
PlotText(" 2DBL " , LastValue(BarIndex())-(numbars/Hts), DayL2I, colorOrange);
PlotText(" 2DBC " , LastValue(BarIndex())-(numbars/Hts), DayC2I, colorWhite);
PlotText(" 3DBH " , LastValue(BarIndex())-(numbars/Hts), DayH3I, colorBrown);
PlotText(" 3DBL " , LastValue(BarIndex())-(numbars/Hts), DayL3I, colorPink);
PlotText(" 3DBC " , LastValue(BarIndex())-(numbars/Hts), DayC3I, colorAqua);
}

// Pivot Levels //
PP = (DayL + DayH + DayC)/3; PPI = LastValue (PP,1); // Pivot
R1 = (PP * 2) - DayL; R1I = LastValue (R1,1); // Resistance 1
S1 = (PP * 2) - DayH; S1I = LastValue (S1,1); // Support 1
R2 = PP + R1 - S1; R2I = LastValue (R2,1); // Resistance 2
S2 = PP - R1 + S1; S2I = LastValue (S2,1); // Support 2
R3 = PP + R2 - S1; R3I = LastValue (R3,1); // Resistance 3
S3 = PP - R2 + S1; S3I = LastValue (S3,1); // Support 3

ppl = ParamToggle("Pivot Levels","Show|Hide",1);
if(ppl==1) {
Plot(PP, "PP",colorYellow,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R1, "R1",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S1, "S1",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R2, "R2",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S2, "S2",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(R3, "R3",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(S3, "S3",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);

PlotText(" Pivot ", LastValue(BarIndex())-(numbars/Hts), PPI, colorYellow);
PlotText(" R1 " , LastValue(BarIndex())-(numbars/Hts), R1I, colorViolet);
PlotText(" S1 " , LastValue(BarIndex())-(numbars/Hts), S1I, colorViolet);
PlotText(" R2 " , LastValue(BarIndex())-(numbars/Hts), R2I, colorViolet);
PlotText(" S2 " , LastValue(BarIndex())-(numbars/Hts), S2I, colorViolet);
PlotText(" R3 " , LastValue(BarIndex())-(numbars/Hts), R3I, colorViolet);
PlotText(" S3 " , LastValue(BarIndex())-(numbars/Hts), S3I, colorViolet);
}
// Camerilla Levels //

rg = (DayH - DayL);

H5=DayC+1.1*rg; H5I = LastValue (H5,1);
H4=DayC+1.1*rg/2; H4I = LastValue (H4,1);
H3=DayC+1.1*rg/4; H3I = LastValue (H3,1);
H2=DayC+1.1*rg/6; H2I = LastValue (H2,1);
H1=DayC+1.1*rg/12; H1I = LastValue (H1,1);
L1=DayC-1.1*rg/12; L1I = LastValue (L1,1);
L2=DayC-1.1*rg/6; L2I = LastValue (L2,1);
L3=DayC-1.1*rg/4; L3I = LastValue (L3,1);
L4=DayC-1.1*rg/2; L4I = LastValue (L4,1);
L5=DayC-1.1*rg; L5I = LastValue (L5,1);

pcl = ParamToggle("Camerilla Levels","Show|Hide",0);
if(pcl==1) {
Plot(H5,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H4,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H3,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H2,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(H1,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L1,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L2,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L3,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L4,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(L5,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
PlotText(" H5 = " , LastValue(BarIndex())-(numbars/Hts), H5I +0.05, colorRose);
PlotText(" H4 = " , LastValue(BarIndex())-(numbars/Hts), H4I +0.05, colorRose);
PlotText(" H3 = " , LastValue(BarIndex())-(numbars/Hts), H3I +0.05, colorRose);
PlotText(" H2 = " , LastValue(BarIndex())-(numbars/Hts), H2I +0.05, colorRose);
PlotText(" H1 = " , LastValue(BarIndex())-(numbars/Hts), H1I +0.05, colorRose);
PlotText(" L1 = " , LastValue(BarIndex())-(numbars/Hts), L1I +0.05, colorRose);
PlotText(" L2 = " , LastValue(BarIndex())-(numbars/Hts), L2I +0.05, colorRose);
PlotText(" L3 = " , LastValue(BarIndex())-(numbars/Hts), L3I +0.05, colorRose);
PlotText(" L4 = " , LastValue(BarIndex())-(numbars/Hts), L4I +0.05, colorRose);
PlotText(" L5 = " , LastValue(BarIndex())-(numbars/Hts), L5I +0.05, colorRose);
}

// Current Days Hi Lo //
THL = ParamToggle("Todays Hi Lo","Show|Hide",1);
if(THL==1) {
isRth = TimeNum() >= 084500 & TimeNum() <= 085959;
isdRth = TimeNum() >= 084500 & TimeNum() <= 235500;
aRthL = IIf(isRth, L, 1000000);
aRthH = IIf(isdRth, H, Null);
aRthLd = IIf(isdRth, L, 1000000);
DayH = TimeFrameCompress( aRthH, inDaily, compressHigh );
DayH = TimeFrameExpand( DayH, inDaily, expandFirst );
DayL = TimeFrameCompress( aRthLd, inDaily, compressLow );
DayL = TimeFrameExpand( DayL, inDaily, expandFirst );
Bars = BarsSince(TimeNum() >= 94500 AND TimeNum() < 095959);//,BarIndex(),1); // AND DateNum()==LastValue(DateNum());
x0 = BarCount-LastValue(Bars);
x1 = BarCount-1;
DayHline=LineArray(x0,LastValue(DayH),x1,LastValue (DayH),0);
DayLline=LineArray(x0,LastValue(DayL),x1,LastValue (DayL),0);
DayHlineI = LastValue (DayHline,1);
DayLlineI = LastValue (DayLline,1);
Plot(DayHline,"DayH",colorBlue,styleBar|styleNoRescale|styleNoTitle);
Plot(DayLline,"DayL",colorRed,styleBar|styleNoRescale|styleNoTitle);
PlotText(" Day Hi " , LastValue(BarIndex())-(numbars/Hts), DayHlineI +0.05, colorBlue);
PlotText(" Day Lo " , LastValue(BarIndex())-(numbars/Hts), DayLlineI +0.05, colorRed);
}

_SECTION_BEGIN("Magnified Market Price");
FS=Param("Font Size",30,10,75,1);
GfxSelectFont("Arial", FS, 500, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor("Color",colorBlue) );
Hor=Param("Horizontal Position",500,500,500,500);
Ver=Param("Vertical Position",27,27,27,27);
GfxTextOut("L.T.P="+C,Hor , Ver );
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont("Arial", 14, 500, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor(ParamColor("Color",colorYellow) );
GfxTextOut(""+DD+" ("+xx+"%)", Hor+5, Ver+45 );
_SECTION_END();
 

amitrandive

Well-Known Member
Hello Amit ...

Sorry for replying late as i was out of the city ... Afl is the same you modified for previous day HLC ... not using 2-3 days HLC or pivots ...

_SECTION_BEGIN("Price1");
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 ) ) ));
.
.

GfxSelectFont("Arial", 14, 500, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor(ParamColor("Color",colorYellow) );
GfxTextOut(""+DD+" ("+xx+"%)", Hor+5, Ver+45 );
_SECTION_END();
Thanks cellclinic !!!
:clapping:
 

Similar threads