I need to set some "pausing", blocking a strategy to generate any other for x minutes since last closing order (in case it was a loss), to improve my strategies performance.
So I need to store -> time_from_last_loss = toTime (when this event occurs) to check it against toTime (onBarUpdate()) to block or allow new trades.
But I am in trouble.
For instance, Does anyone know how can I store time_from_last_loss in case of a stop loss order?
Or maybe, there is some functionality on NT libraries.
You can easily access the DateTime for the last execution, and then determine if the execution was a winner or loser. If loser you can update a variable that stores the DateTime lastloser info.
As for new trades, you can just use the lastloser.AddSeconds() function (or similar) to test and see if sufficient time has passed before entering a new trade.
BTW, if you are using time based charts, there is also a built-in BarsSinceExit() function in NinjaTrader. But if using non-time based charts then it will only give you a bar number. You could also then pull the Time of that bar number.
Multiple ways to skin a cat in C#.
Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.
Need help? 1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first. 2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses. 3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make. 4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance. 5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers. 6) Help using the forum? Watch this video to learn general tips on using the site.
If you want to support our community, become an Elite Member.