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
How to stop strategy trading once daily profit or loss reached
Collapse
X
-
How to stop strategy trading once daily profit or loss reached
Hello: I would like to know how to program a strategy to stop trading once reached a daily profit or loss using strategy builder. Do I need to know how to code in C## in order to program it ?. Thanks,Tags: None
-
Hello mtamaku,
While the Strategy Builder could have a condition for the Realized PnL to be above or below a certain amount, this would not reset on a new trading day. The Realized PnL would continue to be the total PnL through the life of the script.
Unfortunately, this would mean that the strategy would need to be unlocked and this logic coded by hand.
The PnL of each trade would need to be tracked, so that this could be reset on each new day.
Below is a link to an example.
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://ninjatraderChelsea B.NinjaTrader Customer Service
-
Hello mtamaku,
Are you referring to in a strategy or as a general platform feature to have a Daily Loss limit?
You could inquire with your broker if a daily limit can be added to your account, and strategies would need to have their own logic programmed into them to exit positions and stop trading.
Do you mean to have a built in strategy property similar to ExitOnSessionClose that would be used for setting a daily limit where you don't have to program the behavior?
We look forward to hearing back.JimNinjaTrader Customer Service
Comment
-
Hello: I am referring to have this option in strategy builder. I tried that function using the Realized PL compared with a user input variable to a value and it worked only for the first day of strategy starting point and then it stooped as soon as daily profit limit reached since it could not reset the Realized PL to zero for the next day in the range. Or any suggestion on how to reset the daily limit for next day while strategy running.
Please see the image attached.
Sorry I do not know how to program in C# so only using Strategy builder. Thanks,Last edited by mtamaku; 07-10-2020, 04:38 PM.
Comment
-
Hello mtamaku,
NinjaTrader_PaulH was able to use custom series to allow math with offsets to accomplish this with the Strategy Builder.
I've added his example to my post.
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://ninjatraderChelsea B.NinjaTrader Customer Service
- Likes 1
Comment
-
Hi
I tried this Builder script using MACD condition replacing SMA in the the logic but it keeps trading as per my strategy and does not print anything as per some print command in the strategy.
Is this script supposed to check only daily loss and then stop trading if below set value ?
I am looking for a script to stop trading as soon it reaches the daily profit limit set by the user input similar to daily loss limit.
Thanks,
Comment
-
Hello mtamaku,
This is meant to be a learning tool for you to design your own custom logic.
Yes, this example demonstrates how to track the daily profit and loss and use this to only place orders if this is greater than a preset loss limit amount.
You could create a daily profit limit. You would want to compare the dailypnl to be less than the limit amount instead of greater than the limit amount to place an order.
The script demonstrates how to get a dailypnl and use this as you would like.
If you would like to email a script to us you can at platformsupport [at] ninjatrader [dot] com.
Please note, in the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients. This is so that we can maintain a high level of service for all of our clients as well as our partners.
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.
That said, I am happy to answer any questions you may have about NinjaScript if you decide to code this yourself.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Lele2k24, Yesterday, 11:24 AM
|
8 responses
27 views
0 likes
|
Last Post
by Lele2k24
Today, 11:00 AM
|
||
Started by Padan, Today, 02:02 AM
|
4 responses
15 views
0 likes
|
Last Post
by Padan
Today, 10:46 AM
|
||
Started by kramnor2001, Yesterday, 02:30 PM
|
4 responses
24 views
0 likes
|
Last Post
by bltdavid
Today, 10:44 AM
|
||
Started by eduardodipp7, Today, 10:29 AM
|
0 responses
2 views
0 likes
|
Last Post
by eduardodipp7
Today, 10:29 AM
|
||
Started by AgriTrdr, 07-16-2023, 12:54 PM
|
39 responses
272 views
0 likes
|
Last Post
by f.saeidi
Today, 10:23 AM
|
Comment