Hi guys.
I tried to modify the example given here to display Stop Loss Price for each trade.
Let's assume I entered a trade at $22 and I set SL to $20 by ApplyStop function and TP to $25 for example:
How can I display the value $20 and $25 values as SL and TP in the backtest trade list?
I tried to modify the below line in the above link example that gets the ATR value, but don't know how to get the SL and TP.
@Tomasz Would you please advise?
I need to add a user-defined metric to backtest report, such as for example Stoploss level or any value I calculated within my code.
Be grateful if you kindly help.
You're probably not getting any help because you've provided no code so nobody can guess what the problem is. All you said is that you modified a working example and it doesn't do what you want. See this link: How to ask a good question
Where have you calculated the SL and TP values? How have you stored them? How have you retrieved them?
Just do the same thing with SL and TP that the example did with ATR: Store the values in a static variable during phase 1, and then retrieve them in Phase 2 (CBT) and use the Lookup value to pluck out the right element from the array.
To store SL you have to use StaticVarSet() in 1st phase of BT.
StaticVarGet calls the stored static var in 2nd phase of BT.
And static var name has to be type string but not array.