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
Strategy Builder - Using a Buy/Sell indicator
Collapse
X
-
Originally posted by bnoisette View Post
Thx for taking a look and pointing me in the right direction
Leave a comment:
-
Here is what I have for the short section. On the longs it will still take trades without the print that is why I have it commented out here. The long is exactly the same except labeled "Buy"
// Set 2
if ((VolumeBasedBuySellSignals1.SellSignal[0] != 0)
//&& (Close[0] <= Close[1])
//&& ((BarsSinceExitExecution() > 3)
//|| (BarsSinceExitExecution() == -1)
&& (Position.MarketPosition == MarketPosition.Flat))
{
//Print(@"VolumeBasedBuySellSignals1.SellSignal[0]:" + Convert.ToString(VolumeBasedBuySellSignals1.SellSi gnal[0]));
}
{
EnterShort(1, @"ShortCTP");
EnterShort(1, @"ShortCTR");
Leave a comment:
-
Here is what I have for the short section. On the longs it will still take trades without the print that is why I have it commented out here. The long is exactly the same except labeled "Buy"
// Set 2
if ((VolumeBasedBuySellSignals1.SellSignal[0] != 0)
//&& (Close[0] <= Close[1])
//&& ((BarsSinceExitExecution() > 3)
//|| (BarsSinceExitExecution() == -1)
&& (Position.MarketPosition == MarketPosition.Flat))
{
//Print(@"VolumeBasedBuySellSignals1.SellSignal[0]:" + Convert.ToString(VolumeBasedBuySellSignals1.SellSi gnal[0]));
}
{
EnterShort(1, @"ShortCTP");
EnterShort(1, @"ShortCTR");
Leave a comment:
-
Originally posted by bnoisette View Post
Thx for taking a look and pointing me in the right direction
Leave a comment:
-
Originally posted by marco231 View PostI forgot to mention, if you run into little problems like this try painting the background for order execution and reviewing your order entry conditions and also open the data box to get an understanding of what the indicators are printing out (saves time from having to manually use the print function).
Leave a comment:
-
I forgot to mention, if you run into little problems like this try painting the background for order execution and reviewing your order entry conditions and also open the data box to get an understanding of what the indicators are printing out (saves time from having to manually use the print function).
- Likes 1
Leave a comment:
-
Originally posted by bnoisette View PostAlso the sell signal is committed out as I was trying to get the buy signal to work properly first.
The other thing I noticed was this condition && (BarsSinceExitExecution(0, "", 0) > 3), I commented it out to get it to take a trade. You need to refine what this is as I'm not sure what this is checking. I had it active and it didn't take any trades over 5 days 23 hours of the market open.
Anyway best of luck with your strategy, It looks like a great piece of work coming together !
Leave a comment:
-
Also the sell signal is committed out as I was trying to get the buy signal to work properly first.
Leave a comment:
-
Originally posted by marco231 View PostIf you can share the source code of your script + where I can download the indicator then I can review your code for you and give better guidance on why the issue is occuring.
Leave a comment:
-
If you can share the source code of your script + where I can download the indicator then I can review your code for you and give better guidance on why the issue is occuring.
Leave a comment:
-
Originally posted by bnoisette View Post
Yeah I have that. This is what I have tried and it is not working
if ((0 == VolumeBasedBuySellSignals1.BuySignal[1])
&& (BarsSinceExitExecution(0, "", 0) > 3)
&& (Position.MarketPosition == MarketPosition.Flat))
{
Print(@"VolumeBasedBuySellSignals.BuySignal[0]:" + Convert.ToString(VolumeBasedBuySellSignals1.BuySig nal[0]));
Leave a comment:
-
Originally posted by marco231 View Post
I ended up reviewing my code and there was additional information , you need make sure your market position is flat as part of the condition you can do something like this , && (Position.MarketPosition == MarketPosition.Flat)) . So when you get a signal, it will check 1 are you in a trade (from a previous signal - if so do not open another trade), if you are flat and you get a signal then enter the trade.
if ((0 == VolumeBasedBuySellSignals1.BuySignal[1])
&& (BarsSinceExitExecution(0, "", 0) > 3)
&& (Position.MarketPosition == MarketPosition.Flat))
{
Print(@"VolumeBasedBuySellSignals.BuySignal[0]:" + Convert.ToString(VolumeBasedBuySellSignals1.BuySig nal[0]));
Leave a comment:
-
I ended up reviewing my code and there was additional information , you need make sure your market position is flat as part of the condition you can do something like this , && (Position.MarketPosition == MarketPosition.Flat)) . So when you get a signal, it will check 1 are you in a trade (from a previous signal - if so do not open another trade), if you are flat and you get a signal then enter the trade.
Leave a comment:
-
Make sure your logic is calculate on bar close, and try using other conditions. Like Close of previous candle must be below 50 EMA or SMA. or Only take shorts if price is under Vwap or take longs if above vwap.
Leave a comment:
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Mr Bread, Today, 06:21 AM
|
1 response
11 views
0 likes
|
Last Post
by Mr Bread
Today, 06:44 AM
|
||
Started by tonydavisonline, Yesterday, 08:01 AM
|
1 response
26 views
0 likes
|
Last Post Today, 06:15 AM | ||
Started by cbentrikin, Today, 05:30 AM
|
1 response
10 views
0 likes
|
Last Post
by cbentrikin
Today, 06:06 AM
|
||
Started by slimtrading, 04-05-2024, 04:23 PM
|
4 responses
192 views
0 likes
|
Last Post
by Sam2515
Today, 04:47 AM
|
||
Started by bltdavid, 03-04-2023, 05:05 PM
|
13 responses
1,335 views
0 likes
|
Last Post
by Gerry-N
Today, 04:45 AM
|
Leave a comment: