Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Reverse Logic (short) question
Collapse
X
-
Reverse Logic (short) question
What is the code for the reverse logic of the EnterLong on this snippet of straetgy code taken from: http://www.ninjatrader-support.com/H...lPressure.html ------------------------------------------ protected override void OnBarUpdate() { // Looking for a long breakout signal if (Close[0] > DonchianChannel(20).Upper[5]) { // !! See notes below !! if (Historical || BuySellPressure().BuyPressure[0] > 70) EnterLong(); } } ------------------------------------------ How would it be coded to go short & cover a long position lets say and vise versa?Tags: None
-
Hello,
This is basically the opposite of what you have below:
if (Close[0] < DonchianChannel(20).Lower[5])
{
if (Historical || BuySellPressure().SellPressure[0] > 70)
EnterShort();
}
Please note that BuySellPressure will only work in real-time operation and not in backtesting.DenNinjaTrader Customer Service
-
Thanks for the reply. I got that far. Let me correct my initial question. How is the code structured (nested, i think) so that it looks to see if the long condition exists first and go long (and/or cover a short), otherwise looks for the short condition and goes short (and/or to cover a long)
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
60 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
147 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
162 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
97 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
284 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Comment