|
Can anybody help. I need to generate a buy and sell signal when a candle touches two EMA's

|
|
|
|
Posts: 298
Thanks: 1 times Was thanked: 19 time(s) in 17 post(s)
|
Hi Johan,
This code will get you going:
X0 : EMA(CLOSE,N1);
X1 : EMA(CLOSE,N2);
X3 := BETWEEN(X0,LOW,HIGH);
X4 := BETWEEN(X1,LOW,HIGH);
SIGNAL := IF(X3+X4==2,1,0);
DRAWTEXT(SIGNAL==1,CLOSE,'TEST'),Label2,VCenter,Bottom;
Basically the first two lines set up the EMAs - N1 and N2 are the EMA parameters which you can set - these two lines are also displayed when the custom indicator is applied. The next two lines evaluate whether each EMA line is falls between the low and the high of any candle. The SIGNAL line simply returns the value '1' if both the EMAs fall between the low and high of the candle. The last line draws the text.
This last line you would probably want to tweak to suit you - e.g. maybe split into two parts where the buy label is on the top of the candle and the sell is below the candle. Please contact Swordfish support if you require further help or would like the indicator emailed to you.
Here's a screen shot of the above indicator in action:

Estuary
Edited by user Wednesday, May 2, 2012 7:13:10 PM(UTC)
| Reason: Not specified
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.