Help needed for AFL

#1
Hi friends..
Of late I ve been trying my hand at afl code writing but without any sort of expertise in c language I am finding it tough to get along forward.
So I though why not put up a query in traderji..

What i was looking for is a very basic condition. i want the buy signal to be generated when price closes above a moving average eg EMA 5(high)

I can write it as
Buy = Cross(Close , EMA(high,5));

But then the buy trade during back test will happen depending on the settings i give in the backtester.

What I want is

1. the buy trade should come when the high of this crossover bar is taken out. This is basically for backtesting the strategy. Similarly for the short trade should come when the low of the crossover bar is taken out.

2. The Ema slope should be displayed on the chart. I assume ROC is akin to slope and have managed to find a code for the same but it does nt display it on the chart ...

Any help regarding the same would be highly appreciated. I dont need the exact reply just a pointer to the right direction would suffice.

Thanks in advance..
 

Similar threads