Swing High / Swing Low

Hi All,

Need help to develop AFL indicator code for Amibroker.

1st Indicator Logic… [Swing High / Swing Low]
On daily chart i need Green Down Arrow indication for swing high and Red Up Arrow indication for swing low.
Swing High = Previous High < High > Next High [Green Down Arrow Indication on High Candle]
Swing Low = Previous Low > Low < Next Low [Red UP Arrow Indication on Low Candle]

2nd Indicator Logic… [Risk Ratio Quantity]
Risk Ratio will be calculated on the Swing High and Swing Low, If BUY trade is executed then the Swing Low will be the SL [Stoploss] for the trade, divided by Risk Value. suppose my risk value is 1000 (this Risk should be in input Parameters), if the Buy trade is executed @ Rate 100 and my Swing Low is @ 90, then the 100-90 = 10 Points Risk, then 1000 (Risk Value) / 10 point (Risk ratio) = 100 is the Risk Ratio Quantity, It should give pop-up for the Risk Ratio Quantity. as "Quantity Risk Ratio - Buy 100 " and vice versa scenario for SHORT SELL Trade.

Thanks & Regards,


this one is too vague to put into coding. You need to define your swing high/low more “parametric”.

In the meantime, have a look at the zig-zag function.