How to set the view fixed as per the candle? Every time I insert indicators, the candle size got reduced.
Please help.
Thank you
How to set the view fixed as per the candle? Every time I insert indicators, the candle size got reduced.
Please help.
Thank you
Please use search function of the forum. This maybe a reason why no one may reply promptly to you.
There are many topics on this.
Add styleNoRescale
to Plot function's style argument of your indicator AFL.
e.g.
Plot( C, "Price", colorDefault, styleBar );
Plot(MA(C,500), "MA", colorRed, styleLine | styleNoRescale);
I had searched but did not get any. Maybe because I don't have that much knowledge.
Thank you
You have deleted your previous post while I was answering to your posted code...
Anyway... You should put price AFL at the top (before your indicators) to initialize price plot
And in addition you can add a style variable like this
style = styleLine | styleNoRescale;
or you may use ParamStyle() function e.g.
style = ParamStyle("CPR style", styleLine | styleNoRescale);
So e.g. ...
_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();
_SECTION_BEGIN( "CPR" );
dtDayStartComp = TimeFrameCompress( DateTime(), inDaily, compressOpen );
dtDayStartExp = TimeFrameExpand( dtDayStartComp, inDaily, expandFirst );
dtDayEndComp = TimeFrameCompress( DateTime(), inDaily, compressLast );
dtDayEndExp = TimeFrameExpand( dtDayEndComp, inDaily, expandFirst );
DayCond = DateTime() >= dtDayStartExp AND DateTime() < dtDayEndExp;
// Previous Days High Low Close
PDH = TimeFrameGetPrice( "H", inDaily, -1 );
PDL = TimeFrameGetPrice( "L", inDaily, -1 );
PDC = TimeFrameGetPrice( "C", inDaily, -1 );
PV = ( PDH + PDL + PDC ) / 3;
LB = ( PDH + PDL ) / 2;
UB = 2 * PV - LB;
style = styleLine | styleNoRescale;
Plot( IIf( DayCond, UB, Null ), "UB", colorBlue, style, Null, Null, 0 );
Plot( IIf( DayCond, UB, Null ), "UB", colorBlue, style, Null, Null, 2 );
Plot( IIf( DayCond, PV, Null), "Pivot", colorBlue, style, Null, Null, 0 );
Plot( IIf( DayCond, PV, Null), "Pivot", colorBlue, style, Null, Null, 2 );
Plot( IIf( DayCond, LB, Null), "LB", colorBlue, style, Null, Null, 0 );
Plot( IIf( DayCond, LB, Null), "LB", colorBlue, style, Null, Null, 2 );
_SECTION_END();
_SECTION_BEGIN( "Pivot Levels" );
//PDH = TimeFrameGetPrice( "H", inDaily, -1 );
//PDL = TimeFrameGetPrice( "L", inDaily, -1 );
//PDC = TimeFrameGetPrice( "C", inDaily, -1 );
//PV = ( PDH + PDL + PDC ) / 3;
R1 = 2 * PV - PDL;
S1 = 2 * PV - PDH;
style = styleLine | styleNoRescale;
Plot( IIf( DayCond, R1, Null ), "R1", colorRed, style, Null, Null, 0 );
Plot( IIf( DayCond, R1, Null ), "R1", colorRed, style, Null, Null, 2 );
Plot( IIf( DayCond, S1, Null ), "S1", colorGreen, style, Null, Null, 0 );
Plot( IIf( DayCond, S1, Null ), "S1", colorGreen, style, Null, Null, 2 );
_SECTION_END();
_SECTION_BEGIN( "To view Pivots of Next Day as Today closes" );
shift = 10; //Number of Bars to be shifted, could use a Param if needed
bi = BarIndex();
lvbi = LastValue( bi );
LAx0 = lvbi - shift + 1;
LAx1 = lvbi;
// Present Days High Low Close
// These levels will be dynamic as day progresses and would ahow up in the no bar region after the last visible Bar for shifted number of bars (i.e. 10 in this case)
// Do use "Bar Replay" to figure out what I mean
dH = TimeFrameGetPrice( "H", inDaily, 0 );
dL = TimeFrameGetPrice( "L", inDaily, 0 );
dC = TimeFrameGetPrice( "C", inDaily, 0 );
//Central Pivots shifted for Next Day
dPV = ( dH + dL + dC ) / 3;
LB = ( dH + dL ) / 2;
UB = 2 * dPV - LB;
y = LastValue( dPV );
la = LineArray( LAx0, y, LAx1, y );
style = styleLine | styleNoRescale;
Plot( la, "PV", colorBlue, style, Null, Null, shift );
y = LastValue( LB );
la = LineArray( LAx0, y, LAx1, y );
Plot( la, "LB", colorBlue, style, Null, Null, shift );
y = LastValue( UB );
la = LineArray( LAx0, y, LAx1, y );
Plot( la, "UB", colorBlue, style, Null, Null, shift );
//Pivot Levels shifted for Next Day
R1 = 2 * dPV - dL;
S1 = 2 * dPV - dH;
y = LastValue( R1 );
la = LineArray( LAx0, y, LAx1, y );
Plot( la, "R1", colorRed, style, Null, Null, shift );
y = LastValue( S1 );
la = LineArray( LAx0, y, LAx1, y );
Plot( la, "S1", colorGreen, style, Null, Null, shift );
_SECTION_END();
I edited each and every "Plot" function in that with "styleLine | styleNoRescale", It worked.
Thank you very much.
I manually inserted price before this code. So it worked.
Thank you for your help.