Simple Coding Help - No Promise.

Snake.Head

Well-Known Member
Is it possible not Plot details on top corner of chart
Which EMA(close)20 and EMA15 and EMA 60


for eg this code
///////////////////////////////////////////////////////////////////////////////////////////////////
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartOptions( 0, chartShowArrows );
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("EMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 20, 2, 300, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorBlack ), ParamStyle("Style") );
_SECTION_END();

_SECTION_BEGIN("EMA TF");
TimeFrameSet(in15Minute);
m15= EMA(Close,20) ;
Plot(TimeFrameExpand(m15, in15Minute), "EMA 15", colorBlue,styleLine|styleDashed);
TimeFrameRestore();
 

bunti_k23

Well-Known Member
Is it possible not Plot details on top corner of chart
Which EMA(close)20 and EMA15 and EMA 60


for eg this code
First do 'save as ' the code then try this .delete this part

,_DEFAULT_NAME()

And apply .try this im not sure....:D
 

sr114

Well-Known Member
Is it possible not Plot details on top corner of chart
Which EMA(close)20 and EMA15 and EMA 60


for eg this code
do this as following

Plot(TimeFrameExpand(m15, in15Minute), "EMA 15",colorBlue,styleLine|styleDashed);
put nothing in between the inverted commas [ the red under lined part] eg - Plot(TimeFrameExpand(m15, in15Minute), "", colorBlue,styleLine|styleDashed);

ur EMA15 will not be shown in the chart heading

rgds
 

bunti_k23

Well-Known Member
will this code solve the repainting problem in amibroker ,iv got this from help file....



if( Status("redrawaction") ==1 )
{
_TRACE("nTIMED REFRESH"+Now());
}
RequestTimedRefresh(1);

Example 2 (low-level graphic overlay + pixel co-ordinate conversion):

_SECTION_BEGIN("GfxOverlaySampleNew");

function GetVisibleBarCount()
{
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");

return Min( Lvb - fvb, BarCount - fvb );
}

function GfxConvertBarToPixelX( bar )
{
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxchartleft = Status("pxchartleft");
pxchartwidth = Status("pxchartwidth");

return pxchartleft + bar * pxchartwidth / ( Lvb - fvb + 1 );
}

function GfxConvertValueToPixelY( Value )
{
local Miny, Maxy, pxchartbottom, pxchartheight;

Miny = Status("axisminy");
Maxy = Status("axismaxy");

pxchartbottom = Status("pxchartbottom");
pxchartheight = Status("pxchartheight");

return pxchartbottom - floor( 0.5 + ( Value - Miny ) * pxchartheight/ ( Maxy - Miny ) );
}



Plot(C, "Price", colorBlack, styleHistogram );

GfxSetOverlayMode(0);
GfxSelectSolidBrush( colorRed );
GfxSelectPen( colorRed );

AllVisibleBars = GetVisibleBarCount();
fvb = Status("firstvisiblebar");

for( i = 0; i < AllVisibleBars ; i++ )
{
x = GfxConvertBarToPixelX( i );
y = GfxConvertValueToPixelY( C[ i + fvb ] );

GfxRectangle( x-1, y-1, x + 2, y+1 );
}

//SetChartBkGradientFill( ColorRGB(200,200,200), ColorRGB( 255,255,255) );
_SECTION_END();
 

trash

Well-Known Member
Is it possible not Plot details on top corner of chart
Which EMA(close)20 and EMA15 and EMA 60


for eg this code
Simply add stylenotitle

Code:
///////////////////////////////////////////////////////////////////////////////////////////////////
_SECTION_BEGIN( "Price" );
SetChartOptions( 0, chartShowArrows | chartShowDates );
SetChartOptions( 0, chartShowArrows );
Plot( C, "Close", ParamColor( "Color", colorDefault ), styleNoTitle | ParamStyle( "Style Price" ) | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN( "EMA" );
P = ParamField( "Price field", -1 );
Periods = Param( "Periods", 20, 2, 300, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorBlack ), ParamStyle( "Style EMA 1",  styleNoTitle, maskAll ) );
_SECTION_END();

_SECTION_BEGIN( "EMA TF" );
TimeFrameSet( in15Minute );
m15 = EMA( Close, 20 ) ;
Plot( TimeFrameExpand( m15, in15Minute ), "EMA 15", colorBlue, ParamStyle( "Style EMA 2", styleLine | styleDashed | styleNoTitle, maskAll ) );
TimeFrameRestore();
_SECTION_END();

and if you wanna add custom title then

Code:
///////////////////////////////////////////////////////////////////////////////////////////////////
_SECTION_BEGIN( "Price" );
SetChartOptions( 0, chartShowArrows | chartShowDates );
SetChartOptions( 0, chartShowArrows );
Plot( C, "Close", ParamColor( "Color", colorDefault ), styleNoTitle | ParamStyle( "Style Price" ) | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN( "EMA" );
P = ParamField( "Price field", -1 );
Periods = Param( "Periods", 20, 2, 300, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorBlack ), ParamStyle( "Style EMA 1",  styleNoTitle, maskAll ) );
_SECTION_END();

_SECTION_BEGIN( "EMA TF" );
TimeFrameSet( in15Minute );
m15 = EMA( Close, 20 ) ;
Plot( TimeFrameExpand( m15, in15Minute ), "EMA 15", colorBlue, ParamStyle( "Style EMA 2", styleLine | styleDashed | styleNoTitle, maskAll ) );
TimeFrameRestore();
_SECTION_END();

Title = "";
Title = ""; will plot no title at all

Now instead of

Title = "";

You could replace it with

Just Title = "{{NAME}}";

or

Title = StrFormat( "{{NAME}} - Price: %g", C );

or

Title = StrFormat( "{{NAME}} - Price: %g, {{VALUE}}", C );

etc, etc., etc.



{{VALUES}} will show values of indicator AFLs drag and dropped onto existing price chart
 

trash

Well-Known Member
will this code solve the repainting problem in amibroker ,iv got this from help file....

Code:
if ( Status( "redrawaction" ) == 1 )
{
    _TRACE( "nTIMED REFRESH" + Now() );
}

RequestTimedRefresh( 1 );

//Example 2 ( low - level graphic overlay + pixel co - ordinate conversion ):

_SECTION_BEGIN( "GfxOverlaySampleNew" );

function GetVisibleBarCount()
{
    lvb = Status( "lastvisiblebar" );
    fvb = Status( "firstvisiblebar" );

    return Min( Lvb - fvb, BarCount - fvb );
}

function GfxConvertBarToPixelX( bar )
{
    lvb = Status( "lastvisiblebar" );
    fvb = Status( "firstvisiblebar" );
    pxchartleft = Status( "pxchartleft" );
    pxchartwidth = Status( "pxchartwidth" );

    return pxchartleft + bar  * pxchartwidth / ( Lvb - fvb + 1 );
}

function GfxConvertValueToPixelY( Value )
{
    local Miny, Maxy, pxchartbottom, pxchartheight;

    Miny = Status( "axisminy" );
    Maxy = Status( "axismaxy" );

    pxchartbottom = Status( "pxchartbottom" );
    pxchartheight = Status( "pxchartheight" );

    return pxchartbottom - floor( 0.5 + ( Value - Miny ) * pxchartheight / ( Maxy - Miny ) );
}



Plot( C, "Price", colorBlack, styleHistogram );

GfxSetOverlayMode( 0 );
GfxSelectSolidBrush( colorRed );
GfxSelectPen( colorRed );

AllVisibleBars = GetVisibleBarCount();
fvb = Status( "firstvisiblebar" );

for ( i = 0; i < AllVisibleBars ; i++ )
{
    x = GfxConvertBarToPixelX( i );
    y = GfxConvertValueToPixelY( C[ i + fvb ] );

    GfxRectangle( x - 1, y - 1, x + 2, y + 1 );
}

//SetChartBkGradientFill( ColorRGB(200,200,200), ColorRGB( 255,255,255) );
_SECTION_END();
First of all use code tags if you insert code in a forum!
Second there is no repainting problem in AmiBroker.
Code repaints if YOUR code is looking into the future.

i.e

Ref( H, 1 )
Zig( C, 5 )

The code you have posted above is just price plotted via Gfx. Nothing more nothing less. And no, it does not repaint.
 
I need a little help with my very basic AFL. I want buy signal for candle Close which is crossed by MA(C, 3) but this MA must be in an uptrend and not down trend. Means average is increasing and not decreasing. And MA is crossing a full green candle. No spin tops or doji.

I also want to experiment by adding a MA(c,15). And MA (c,3) should be above ma 15 crossing from below. means MA 3 going above MA 15 starting from below MA 15.

Can anyone help?

And if possible sell signal for the reverse i.e. full green candle crossed by MA 3 in down trend.

Many thanks in advance..... :)
 
Last edited:
How do I reference current high being high of last 4 candles. My try:

Buy = H > Ref(H, -4) AND C > O;

However, this is only giving me candles which is higher than just previous candle and not last 4 candles.

Thanks in advance..... :)
 

Similar threads