Amazing Formula

#4
This formula good for real trading and I am looking for someone can help make this formula, maybe senior can help...this look reversal but totally different!
 
#6
hehehehehehe another marketting.
Hi Johney, i need your help.
I am using EMA(close, 7), EMA(close, 21) crossover system.when EMA7 crosses EMA21, we will get a BUY signal and viceversa for the SELL.But i need to get buy signal only when the price breaks the high of the current buy candle, reverse for the sell.
after getting the buy signal, how can we chk the high of the current buy candle, and when price breaks the high of the current buy candle, that also we need to chk, expecting your reply, thx
 

asnavale

Well-Known Member
#7
Hi Johney, i need your help.
I am using EMA(close, 7), EMA(close, 21) crossover system.when EMA7 crosses EMA21, we will get a BUY signal and viceversa for the SELL.But i need to get buy signal only when the price breaks the high of the current buy candle, reverse for the sell.
after getting the buy signal, how can we chk the high of the current buy candle, and when price breaks the high of the current buy candle, that also we need to chk, expecting your reply, thx
Hi Satheesh, if you are talking about Amibroker AFL then you can use this code:

E7 = EMA(C, 7);
E21 = EMA(C, 21);
BTrig = Cross(E7, E21);
STrig = Cross(E21, E7);

Buy = Ref(BTrig, -1) AND H > Ref(H, -1);
Sell = Ref(STrig, -1) AND L < Ref(L, -1);

I hope I understood your logic correctly.

-Anant
 
#8
Hi Satheesh, if you are talking about Amibroker AFL then you can use this code:

E7 = EMA(C, 7);
E21 = EMA(C, 21);
BTrig = Cross(E7, E21);
STrig = Cross(E21, E7);

Buy = Ref(BTrig, -1) AND H > Ref(H, -1);
Sell = Ref(STrig, -1) AND L < Ref(L, -1);

I hope I understood your logic correctly.

-Anant
Hai Anant
Thx A Lot for your fast reply and it alomost done.You got my idea very clear. Only one thing missing. we are getting buy signal only when the first candle breaks the high of the ema7, ema21 crossover candle.
If the 2nd, 3rd or 4th..... candle crosses the high of the (ema7, ema21 )crossover candle, we are not getting the buy signal and vice versa for the sell.
Means when ema7, ema21 crossover candle happens, we will get a buy signal.only the next candlecrosses the high, we are getting a signal.(if the 2nd candle was lower than the buying candle and the 3rd was higher the buying candle, not getting the signal).I think you got it clear. Thx in advance.
 

asnavale

Well-Known Member
#9
Hi Satheesh,

Try the following modified AFL:

SetChartOptions(0, chartShowDates | chartWrapTitle);


E7 = EMA(C, 7);
E21 = EMA(C, 21);

BTrig = Cross(E7, E21);
STrig = Cross(E21, E7);

BT = Flip(BTrig, STrig);
ST = Flip(STrig, BTrig);

B_High = ValueWhen(Btrig, H, 1);
S_Low = ValueWhen(STrig, L, 1);


Buy = BT AND H > B_High;
Sell = ST AND L < S_Low;

Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);

_N(Title = StrFormat("{{NAME}} ({{INTERVAL}}), {{DATE}} : {{OHLCX}}, Vol=%1.0f\n{{VALUES}}", V));

Plot(C, "", colorLightGrey, styleCandle);
Plot(E7, "EMA7", colorGreen, styleLine);
Plot(E21, "EMA21", colorRed, styleLine);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);



-Anant
 

Similar threads