Hi Friends,
I am trying to Backtest set of symbols on more than one year data as below:
- Generate Buy signal based on 200 Daily MA of Volume and closing price in 1 min Timeframe.
- Initial Target is 2.5%
- Initial Stop Loss is 2%
- Trailing 0.5%
- Example: Buy at 100, Initial Target = 102.5, Initial SL = 98, Trailing = 0.5;
My requirement:
-
When price reaches initial target of 102.5, then my trailing SL will be at 100.5. At this point I want Trailing SL to move to 2% of Buy Price (i.e. 102).
-
After Initial target is achieved then I want to Trail normally (i.e. if price goes from 102.5 to 103, then Trailing SL should move from 102 to 102.5 and continue until Trailing SL is hit)
Note:
-
Above requirement I am able to achieve for single script using Static Variables in real time but I want to backtest on set of symbols.
-
Before posting I have searched KBs and gone through below links but they are not suiting my requirement:
https://forum.amibroker.com/t/implement-exit-according-to-current-position-profitability/1961/5
Any help is appreciated.
Thanks
Shiva