I have some charts at a one pane. All are drown with StyleOwnScale. How to plot text for these charts?
No, I want to name my ownscale plots as high as the last value.
ind1 = MACD();
ind2 = RSI();
function GfxMapYtoPixelY( value )
{
global pxchartbottom;
global Min_Scale;
global Max_Scale;
global pxchartheight;
// return ( (( pmax - pmin ) / height )* ( 100 - position ) )*scaleY;
return pxchartbottom - floor( 0.5 + ( value - Min_Scale ) * pxchartheight / ( Max_Scale - Min_Scale + 1e-9 ) );
}
GfxSetCoordsMode( 3 );
GfxSelectFont( "Verden", 9, 500, false );
pxchartbottom = Status( "pxchartbottom" );
pxchartheight = Status( "pxchartheight" );
pixelHeight = Status( "pxheight" );
//--------------
// 1
//--------------
value=ind1;
position = Param( "1.position ", 0, -100, 100, 1 );
height = Param( "1.height ", 20, 0, 100, 1 );
pMax = hhv( value, 10 );
pMin = llv( value, 10 );
// pMax = HighestVisibleValue( value );
// pMin = LowestVisibleValue( value );
Max_Scale = LastValue( pMax + ( pmax - pmin ) / height * ( 100 - position ) );
Min_Scale = LastValue( pMin - ( pmax - pmin ) / height * ( 100 + position ) );
totalY = Max_Scale - Min_Scale;
scaleY = pixelHeight / totalY;
GfxTextOut( "MACD():" + LastValue( value ), LastValue( BarIndex() + 1 ), LastValue( GfxMapYtoPixelY( value ) ) );
Plot( value , "MACD()", colorred, styleDots + styleNoLabel + styleOwnScale, Min_Scale, Max_Scale );
//--------------
// 2
//--------------
value=ind2;
position = Param( "2.position ", 0, -100, 100, 1 );
height = Param( "2.height ", 20, 0, 100, 1 );
pMax = hhv( value, 10 );
pMin = llv( value, 10 );
// pMax = HighestVisibleValue( value );
// pMin = LowestVisibleValue( value );
Max_Scale = LastValue( pMax + ( pmax - pmin ) / height * ( 100 - position ) );
Min_Scale = LastValue( pMin - ( pmax - pmin ) / height * ( 100 + position ) );
totalY = Max_Scale - Min_Scale;
scaleY = pixelHeight / totalY;
GfxTextOut( "RSI():" + LastValue( value ), LastValue( BarIndex() + 1 ), LastValue( GfxMapYtoPixelY( value ) ) );
Plot( value , "RSI()", coloryellow, styleDots + styleNoLabel + styleOwnScale, Min_Scale, Max_Scale );
Any upgrades welcome!
This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.