I would like to add a variable to the Strategy Performance Report list of trades. It shows me the trade details, but I want to log the initial value of my stop loss as well.
I have a variable in my code called iStop. Is there any way to add iStop to the Strategy Performance Report such that it is logged in the trade list somewhere?
I've been trying to write my own log file using FileAppend but I have trouble with that because it logs for each bar and I only want the log written when I am filled. Is there any way to trigger code to run only when a trade is opened? It seems like I could do it retroactively if the trade was opened on the previous bar using something like BarsSinceEntry[1], but that is tricky because if I have an entry right after an exit I need to handle it.
Any suggestions would be very much appreciated.
Logging a variable
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Logging a variable
Unfortunately that is not possible.I would like to add a variable to the Strategy Performance Report list of trades. It shows me the trade details, but I want to log the initial value of my stop loss as well.
I have a variable in my code called iStop. Is there any way to add iStop to the Strategy Performance Report such that it is logged in the trade list somewhere?
You need to write out only when the condition is met. The simplest condition is market position check. Another suggestion is PosTradeIsOpen word.I've been trying to write my own log file using FileAppend but I have trouble with that because it logs for each bar and I only want the log written when I am filled. Is there any way to trigger code to run only when a trade is opened? It seems like I could do it retroactively if the trade was opened on the previous bar using something like BarsSinceEntry[1], but that is tricky because if I have an entry right after an exit I need to handle it.
Any suggestions would be very much appreciated.