Hi, im a noob to Amibroker.
Looking for an example of code that Averages Down a trade using AFL.
For instance, during a backtest, if the Current Bar Close Price is 30% less than the Last Open Position, then trigger a "sigScaleIn" signal.
The problem Im having is getting the Price of the last trade or the Original Opening Trade.
Ive tried using BuyPrice but im not sure what it is that is contained within that Variable. Reading some of the DOCs, it seems it holds the Buy Point info (O, H, L, C) and not the actual purchase price of the current open position.
Or am I just really screwed up here -
I am a programmer - But only been playing with the AFL for a few days.
Or:
Is the only real way to do this is by using a FOR loop and run through the array to find the price? - Kinda looks like that after going through some of the other examples.
Kevin
Looking for an example of code that Averages Down a trade using AFL.
For instance, during a backtest, if the Current Bar Close Price is 30% less than the Last Open Position, then trigger a "sigScaleIn" signal.
The problem Im having is getting the Price of the last trade or the Original Opening Trade.
Ive tried using BuyPrice but im not sure what it is that is contained within that Variable. Reading some of the DOCs, it seems it holds the Buy Point info (O, H, L, C) and not the actual purchase price of the current open position.
Or am I just really screwed up here -
I am a programmer - But only been playing with the AFL for a few days.
Or:
Is the only real way to do this is by using a FOR loop and run through the array to find the price? - Kinda looks like that after going through some of the other examples.
Kevin
Last edited: