I am wondering if it is possible, and how if so, to create an exit/TP at a reversal. Example, using the TSSupertrend I get in at the beginning of an uptrend, and want to exit when the downtrend signal fires. Is this possible? Still new to strategy coding so please be gentle.
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
Exit on opposite signal
Collapse
X
-
Exit on opposite signal
Hello All,
I am wondering if it is possible, and how if so, to create an exit/TP at a reversal. Example, using the TSSupertrend I get in at the beginning of an uptrend, and want to exit when the downtrend signal fires. Is this possible? Still new to strategy coding so please be gentle.Tags: None
-
Helllo sprks7979,
To exit at a reversal you would just submit an exit market order to exit the position. If you wanted to set a target at that point you could use one of the target methods like SetStopLoss or SetProfitTarget during that condition if you waned to activate the target at that point.JesseNinjaTrader Customer Service
-
NinjaTrader_Jesse Thanks for the explanation. Another question if I may. I am currently using the strat builder since I'm not very adept at C# yet. In the builder, is there a way to exit a position based on the signal of an indicator. Perhaps additional sets?
example, I go short when the price is below the Parabolic and would like to exit when the price closes above the 14 EMA.
Also, where are the strategies running? I know this may seem to be a convoluted question but are they "ran" locally on my machine or ninjatrader servers? My question arises because if I am in a trade and my strat is supposed to exit for whatever reason, if I load a chart at that moment, it misses the exit and runs wild. I just found the "keep strat running" option with a disconnect but I wouldnt think that applies since Im still technically connected just loading.
Thanks for your assistance and sorry for the mundane questions. Im just trying to learn a bit more.
Comment
-
Hello sprks7979,
In the strategy builder you can use exit orders as an action of a condition. Targets cannot be used in the Sets so if you wanted to base a target off an indicator you would need to instead make a target from an exit order. You can find an example of that concept here: https://ninjatrader.com/support/foru...rategy-builder
Strategies run from the control center strategies tab. You can apply strategies to a chart as well to visualize them, you can still manage the strategy from the control center. These are run locally on your machine. You would need to ensure your platform is connected and you keep your PC on while running a strategy.JesseNinjaTrader Customer Service
Comment
-
Ninjatrader_Jesse, thanks again, I think I can get that to work, now one final issue, at least for now. I am running into an issue where a buy signal fires, and then closes out for profit or stop loss and then, since the signal is still positive it fires on the next bar close. I have a fairly simple PSAR/MACD/EMA strat that im using to test and in one day of trading there were some 300 trades. My question, if possible in the builder, how would one go about only having one trade per signal. Example, price closes above PSAR, MACD crosses average buy signal happens, TP = 40 ticks. I would then want the strat to cool until a "reset" occurs such as PSAR is still good but MACD is no longer valid AND when MACD comes back to valid it issues a new signal. Is something like this possible in the Strat builder? I think this may be my last question today as I am still trying to figure out the unique orderId errors while live trading.
Thanks for your continued time and patience.
PS. Is there a place/forum that you know of that has "mentors" for ninjatrader strategy and indicator building? I would like to learn a bit more but have some issues with some of the concepts.
Comment
-
Hello sprks7979,
You can use the BarsSinceEntryExecution to do that or also a user variable. The bars since entry would be easier if the condition stops being true after one or more bars.
BarsSinceEntryExecution returns -1 if no previous entry was found or reports 0,1,2,3 etc as the bars progress.
To use this in a set in the builder you would need to create a Group condition. Click the Group button and then add the two following conditions:
Left: Misc -> Bars since entry
Center: equals
Right: Misc -> Numeric value -> -1
Add another condition:
Left: Misc -> Bars since entry
Center: greater
Right: Misc -> Numeric value -> 1 or the number of bars you want to wait before another entry.
The alternative would be to use a bool variable. The variable could start with a default value of true to indicate that the entry condition can be true. As part of the entry condition you would check if that user variable is true in addition to your other conditions. As an action in the entry condition you would set the bool variable to false. This would prevent the condition from ever happening again until you reset the variable to true in a different set based on some other condition.
You can always ask individual questions on the forum here for help. You can also seek out third party educators however I am not aware of any myself. Please contact [email protected] for further assistance with third party developers or educators.
JesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Jonker, Today, 01:19 PM
|
0 responses
1 view
0 likes
|
Last Post
by Jonker
Today, 01:19 PM
|
||
Started by futtrader, Today, 01:16 PM
|
0 responses
5 views
0 likes
|
Last Post
by futtrader
Today, 01:16 PM
|
||
Net Change
by Segwin
Started by Segwin, 05-07-2018, 02:15 PM
|
14 responses
1,791 views
0 likes
|
Last Post
by aligator
Today, 11:47 AM
|
||
Started by Jimmyk, 01-26-2018, 05:19 AM
|
6 responses
841 views
0 likes
|
Last Post
by emuns
Today, 11:27 AM
|
||
Started by jxs_xrj, 01-12-2020, 09:49 AM
|
6 responses
3,294 views
1 like
|
Last Post
by jgualdronc
Today, 10:56 AM
|
Comment