If I create a strategy for example, one that places a trade when on MA is above of the other, the problem is that, once it reaches the target, is continues to place orders as long as the MA is above. Is it there a way, in the strategy builder to limit this to a certain number of trades? I do not want a cross over, would be one MA on top of another. Thanks!
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
Help with NT Strategy builder
Collapse
X
-
Help with NT Strategy builder
Hello,
If I create a strategy for example, one that places a trade when on MA is above of the other, the problem is that, once it reaches the target, is continues to place orders as long as the MA is above. Is it there a way, in the strategy builder to limit this to a certain number of trades? I do not want a cross over, would be one MA on top of another. Thanks!Tags: None
-
Hi mestril, thanks for your note.
You can use the MarketPosition object under the Strategy folder and only perform the action when flat.
e.g.: https://clauber.tinytake.com/tt/Mzk0NjMwNV8xMjEwOTQ2NwChris L.NinjaTrader Customer Service
-
Originally posted by NinjaTrader_ChrisL View PostHi mestril, thanks for your note.
You can use the MarketPosition object under the Strategy folder and only perform the action when flat.
e.g.: https://clauber.tinytake.com/tt/Mzk0NjMwNV8xMjEwOTQ2Nw
Comment
-
Originally posted by NinjaTrader_ChrisL View PostHi mestril, thanks for your reply.
If your EntriesPerDirection is set to 1 then you should not get any further entries if you are already long. I can test your script if you export it and post it (Tools>Export>NinjaScript)
Comment
-
-
Originally posted by mestril View Post
It is set to 1, but still places more than one. I will post the script.
Thanks
Attached Files
Comment
-
Originally posted by NinjaTrader_ChrisL View PostHi mestril, thanks for posting that. I'm not getting the same problem, the script submits only 1 order at a time. Please confirm you have the strategy set up in the same way I do:
https://clauber.tinytake.com/tt/Mzk0NjczMl8xMjExMDU4MQ
I do have it the same way, however I think we are not talking about the same issue. The strategy places one order at a time, yes, however, once that position is closed, and a new candle opens, it will place another one and then another. I want the strategy to place just one order per signal and not every time a candle opens. Does that make sense? Thanks a lot!
Comment
-
Originally posted by NinjaTrader_ChrisL View PostHi mestril, thank you I understand now.
The builder has a bars since entry and bars since exit in the Misc folder. You can limit when the next trade takes place using these properties.
I need one trade per signal, now, it is placing a trade once is closed, and placing another one, resulting on several trades per signal. My question is, is it there anything I can do to make this happen? just one trade per signal!
Thanks
Comment
-
Hello mestril,
Thanks for your reply.
You could create a single bool variable that you use to control the trades to one per direction. For example in your entry conditions for a long set you would check to see if the bool is true and in the short entry you would check to see if it is false. In the action of the long set, besides placing the order you would change the bool to false which means no more long trade. Once false, if your other short entry conditions occurs the short order would be placed and you would then set the bool to true.
Written out it would look something like (I called the bool FlipFlop):
if (your long conditions are true and FlipFlop equals True)
{
place long order here
set FlipFlop equal to False // prevent further longs until a short has been taken
}
if (your short conditions are true and FlipFlop equals False)
{
place short order here
set FlipFlop equal to True // prevent further shorts until a long has been taken
}Paul H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by frankthearm, Yesterday, 09:08 AM
|
13 responses
45 views
0 likes
|
Last Post
by frankthearm
Today, 01:52 PM
|
||
Started by PaulMohn, Today, 12:36 PM
|
2 responses
16 views
0 likes
|
Last Post
by PaulMohn
Today, 01:48 PM
|
||
Started by Conceptzx, 10-11-2022, 06:38 AM
|
2 responses
53 views
0 likes
|
Last Post
by PhillT
Today, 01:47 PM
|
||
Started by Kaledus, Today, 01:29 PM
|
1 response
4 views
0 likes
|
Last Post Today, 01:53 PM | ||
Started by yertle, Yesterday, 08:38 AM
|
8 responses
37 views
0 likes
|
Last Post
by ryjoga
Today, 01:22 PM
|
Comment