Crossover buy above previous High

#1
I have my EMA Crossovers buy sell logic below and would like your advice on the following logic:

I want the confirmation that when the crossover happens the buy is initiated only if the next candle closes above the high of the previous candle for a buy or the low of the previous candle for a sell.

//Buy-Sell Logic

Buy = Cross(EMA( C, MALength1 ),EMA( H, MALength2 ));
Sell = Cross( EMA( L, MALength2 ), EMA( C, MALength1 )) ;

Short = Cross( EMA( L, MALength2 ), EMA( C, MALength1 )) ;
Cover = Cross(EMA( C, MALength1 ),EMA( H, MALength2 ));

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

I have tried following several parameters like below but have been unsuccessful http://jbmarwood.com/20-basic-amibroker-buy-arguments/

Would appreciate any response on this please.
 

amitrandive

Well-Known Member
#2
I have my EMA Crossovers buy sell logic below and would like your advice on the following logic:

I want the confirmation that when the crossover happens the buy is initiated only if the next candle closes above the high of the previous candle for a buy or the low of the previous candle for a sell.

//Buy-Sell Logic

Buy = Cross(EMA( C, MALength1 ),EMA( H, MALength2 ));
Sell = Cross( EMA( L, MALength2 ), EMA( C, MALength1 )) ;

Short = Cross( EMA( L, MALength2 ), EMA( C, MALength1 )) ;
Cover = Cross(EMA( C, MALength1 ),EMA( H, MALength2 ));

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

I have tried following several parameters like below but have been unsuccessful http://jbmarwood.com/20-basic-amibroker-buy-arguments/

Would appreciate any response on this please.
Use a combination of conditions like

Buy1 = Cross(EMA( C, MALength1 ),EMA( C, MALength2 ));
Buy2= C > Ref(H,-1);
Buy=Buy1 AND Buy2;
 

Similar threads