How to plot Buy/Sell arrows in Indicators

#1
hello, i wud like a help...

i use qstick indicator with EMA.. i wud like to generate Buy/Sell Signal in case of crossovers... i need help in the coding.. In amibroker


_SECTION_BEGIN("qstick");
/* QStick from Tushar Chande. This indicator measures intraday momentum by
using the distance between the open and close of price over "n periods".
It is set at the default ( 8 ) periods that Chande suggest. */

MaxGraph=3;

Graph0=MA( C-O,8);

// The '0' line.
Graph1=0;
Graph1Style=5;
Graph1Style=styleNoLabel;
_SECTION_END();

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

Plz help.. Thanx.
 

Attachments

djsinha

Active Member
#2
hello, i wud like a help...

i use qstick indicator with EMA.. i wud like to generate Buy/Sell Signal in case of crossovers... i need help in the coding.. In amibroker


_SECTION_BEGIN("qstick");
/* QStick from Tushar Chande. This indicator measures intraday momentum by
using the distance between the open and close of price over "n periods".
It is set at the default ( 8 ) periods that Chande suggest. */

MaxGraph=3;

Graph0=MA( C-O,8);

// The '0' line.
Graph1=0;
Graph1Style=5;
Graph1Style=styleNoLabel;
_SECTION_END();

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

Plz help.. Thanx.

Hi Mansukh
Don't know much about the indicator...but can suggest you how to code that in Ami.
You first need to specify Buy and Sell variables based on crossovers....
Just include these few lines at the last of your code:

Buy=Cross(Graph0, Graph1);
Sell=Cross(Graph1, Graph0);

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );

GraphXSpace = 5;


Should work. Hope this helps.
Cheers
D J Sinha
 
#3
Try this

Buy=Cross(Graph0, EMA( P, Periods ));
Sell=Cross(EMA( P, Periods ), Graph0);



PlotShapes( Buy*shapeUpArrow, colorGreen);
PlotShapes( Sell*shapeDownArrow, colorRed);
 

Similar threads