Dear All,
I use a simple formuls of 13/21 EMA cross over, for
generating buy
and sell signals, which come up on the charts ina AMI with
sounds
ALERTS. the same is appended below.
What I was looking for
is.....if a condition can be attached to it as
follows..
Buy SIGNAL TO
GENERATE ARROWS (SIGNAL) ONLY IF 100 EMA IS OVER 100 SMA
SELL SIGNAL TO
GENERATE ARROWS (SIGNAL) ONLY IF 100 EMA IS UNDER 100
SMA.
Appreciate your time and help
Best
Regards
Ravi
NB: MA1 is 100 simple MA and EMA1 is 100
EMA.
//---------- --------- --- System code ------------ ---------
--------
- --------
Buy = Cross(EMA(C,13), EMA(C,21));
Sell =
Cross(EMA(C,21), EMA(C,13));
Short = Sell;
Cover =
Buy;
//---------- --------- --- Arrow Template ------------ ---------
-----
---- -----
AlertIf( Buy, "SOUND
C:\\Windows\\Media\\wine_glass", "Audio alert",
1 );
AlertIf(
Sell, "SOUND C:\\Windows\\Media\\ssxjump SELL", "Audio
alert",
2
);
UpShape = 3;
UpColor = colorCustom16 = 15;
UpOffset =
12;
DownShape = 4;
DownColor = colorBlack;
DownOffset =
41;
//---------- --------- --------- --------- --------- ---------
-------
-- --------- -
_SECTION_BEGIN("Arrow Setting");
UpShape1
= ParamToggle("Up Shapes","Off,On",1);
UpShape = Param("Up Shape
Typ",UpShape);
UpColor = ParamColor("Up Shape
Color",UpColor);
UpOffset = Param("Up Shape OFF
Set",UpOffset);
_SECTION_END();
_SECTION_BEGIN("Down
Arrow");
DownShape2 = ParamToggle("Down
Shapes","Off,On",1);
DownShape = Param("Down Shape
Typ",DownShape);
DownColor = ParamColor("Down Shape
Color",DownColor);
DownOffset = Param("Down Shape OFF Set",DownOffset)
;
_SECTION_END();
//---------- --------- --------- ---------
--------- --------- -------
-- --------- ---------
----
PlotShapes(Buy*UpShape1*UpShape,
UpColor,0,L,-UpOffset);
PlotShapes(Sell*DownShape2*
DownShape, DownColor,0,H,- DownOffset );
//---------- ---------
--------- --------- --------- --------- -------
-- --------- ---------
----
_SECTION_BEGIN("MA1");
P = ParamField("Price
field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot(
MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color",
colorCycle ),
ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("EMA1");
P =
ParamField("Price field",-1);
Periods = Param("Periods", 15, 2,
300, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor(
"Color",
colorCycle ), ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("Volume");
Plot(
Volume, _DEFAULT_NAME(), ParamColor("Color", colorBlueGrey ),
ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick,
maskHistogram ), 2
);
_SECTION_END();
_SECTION_BEGIN("EMA2");
P =
ParamField("Price field",-1);
Periods = Param("Periods", 15, 2,
300, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor(
"Color",
colorCycle ), ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("EMA3");
P =
ParamField("Price field",-1);
Periods = Param("Periods", 15, 2,
300, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor(
"Color",
colorCycle ), ParamStyle("Style") );
_SECTION_END();