A query, I have this line of code, in theory I should stop putting positions when the ticks are more to the winners, or the losses are greater than allowed, my question is, is the total number of ticks that the strategy makes or the grand total ticks carried by the day?
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Stop when you meet the daily maximum.
Collapse
X
-
Stop when you meet the daily maximum.
if (shortButtonClicked && (Close[0] > SellPrice) && (SystemPerformance.AllTrades.TradesPerformance.Tic ks.CumProfit < dGainMax) && (SystemPerformance.AllTrades.TradesPerformance.Tic ks.CumProfit > dLossMax))
A query, I have this line of code, in theory I should stop putting positions when the ticks are more to the winners, or the losses are greater than allowed, my question is, is the total number of ticks that the strategy makes or the grand total ticks carried by the day?Tags: None
-
Hi AdSeque, thanks for your question.
The SystemPerformance class will give you info about the strategy since the beginning of the data series (or the very leftmost bar). so the cumulative profit in ticks will be how much profit the strategy has made since it started. This is why we have realtime and historical trade partitions in the SystemPerformacne class, so its easier to grab the info about orders that occurred in real-time rather than the theoretical trades that happened in the historical data.
Please let me know if I can assist any further.Chris L.NinjaTrader Customer Service
-
Hello AdSeque,
This would require communication between two scripts which is not officially supported and is not documented in the help guide.
If you would like to go down this unsupported route, below is a link to an example that uses unsupported code to share information between script instances with static classes and objects.
Below I am including a link to an example script that demonstrates basic daily loss limit logic.
Hello, I've updated the DailyLossLimit and DailyLosLimitMultiTrade examples that were posted on the forum for NinjaTrader 7 for NinjaTrader 8. These are often requested and I felt they are good examples to have for NT8. DailyLossLimitExample_NT7 - http://ninjatrader.com/support/forum...241#post451241 (http://ninjatrader
This would need to be adapted to keep the PnL tracking and resetting in the shared static class.Chelsea B.NinjaTrader Customer Service
Comment
-
What I need is that if I reach a loss ceiling that day in that instrument, I will not put more positions, in that instrument, that the same strategy in both charts, only that one puts buy stop limit orders and one and the other sell stop limit orders in the other, but when there is a loss of for example 100 usd in the NQ, both stop putting positions.
Comment
-
Hello AdSeque,
You will need to design your own custom logic.
The DailyLossLimitMultiTradeExample can provide an example for you to learn from. This demonstrates how to accumulate the PnL to a variable and then stop trading once this is greater than a certain amount, then will reset this variable tracking the PnL on a new session.
This idea you can use for your custom script. As in, accumulate the PnL to a variable, then reset this on a new session.
I am happy to answer any questions about documented NinjaScript tools if you decide to code this yourself.
You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by algospoke, Yesterday, 06:40 PM
|
2 responses
23 views
0 likes
|
Last Post
by algospoke
Today, 07:04 PM
|
||
Started by ghoul, Today, 06:02 PM
|
3 responses
14 views
0 likes
|
Last Post Today, 06:43 PM | ||
Started by jeronymite, 04-12-2024, 04:26 PM
|
3 responses
45 views
0 likes
|
Last Post
by jeronymite
Yesterday, 10:10 PM
|
||
Started by Barry Milan, Yesterday, 10:35 PM
|
7 responses
21 views
0 likes
|
Last Post Today, 06:16 PM | ||
Started by AttiM, 02-14-2024, 05:20 PM
|
10 responses
181 views
0 likes
|
Last Post
by jeronymite
Today, 06:11 PM
|
Comment