NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 01-19-2008, 10:16 AM   #1
dgregor5
Senior Member
 
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
Default Entering Trades When Price Away from Key Areas of Support & Resistance

Hi....
Pls bear with me on this one, whilst I try & explain what I am attempting to do.
I have a simple JMA strategy which enters a trade when 2x different JMAs cross & also when there is a continuation after a pullback.

What I would like to do is limit trade entry to when the price is not close to a key area of support & reistance. i.e.

if (Close[0] + 10 < AreaOfSupport && AreaOfSupport + 10 < Close[0])
then EnterLong().

I have now established indicators (which are basically a number of constant lines with a specific price value associated to each) which can be used for the above purpose.

However, the number of lines I am talking about is > 20 & I was thinking there must be two coding options to execute this:

1/ As above, but repeat that line of code for the different AreasOfSupport & AreasOfResistance ---- laborious.

or.....

2/ If (Close[0] - 10 < AreaOfSupport 1,2,3,4,5,6,7,8, etc && AreaOfSupport 1,2,3,4,5,6,7,8, etc. + 10 < Close[0]
then EnterLong() ---- quicker to code.

Since I have a number of different entry & exit conditions for both long & short then samples '1' or '2' have to be repeated for each of the conditions, hence the preference for Option '2' if this is possible.

Question to NT -> Is option '2' possible to code?
Many thx in advance

David
dgregor5 is offline  
Reply With Quote
Old 01-19-2008, 11:19 AM   #2
Pete S
Senior Member
 
Join Date: Jul 2007
Location: Fairfax, VA
Posts: 216
Thanks: 0
Thanked 0 times in 0 posts
Default

Is each set of support resistance lines a pair and they may overlap? Or are all of the support lines lower than all of the resistance lines (i.e. you really only need to check the hghest support and lowest resistance)?
Pete S is offline  
Reply With Quote
Old 01-19-2008, 11:43 AM   #3
dgregor5
Senior Member
 
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
Default

Pete
They are all unique no-trade-horizontal-price-bands. Some may overlap, but that would just widen that specific no-trade-horizontal-price-band.
hope that makes sense. some are pivots, some are fibs, some are market profile numbers, etc. etc.

thx
David
dgregor5 is offline  
Reply With Quote
Old 01-19-2008, 02:34 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

If you only want one if statement then you will need to make a long string of conditions through the use of the OR operator.

if (blah blah || blah blah 2 || blah blah 3 || blah balh4)
NinjaTrader_Josh is offline  
Reply With Quote
Old 01-19-2008, 02:40 PM   #5
dgregor5
Senior Member
 
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
Default

thx Josh - that sounds logical. I think I can code around that.
DG
dgregor5 is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Support/Resistance garciaal NinjaScript File Sharing Discussion 24 03-12-2012 02:34 AM
Colored Support and Resistance Zones CarlosAlberto Indicator Development 20 01-28-2009 07:33 AM
Dynamic Support and Resistance lines using HMA qitrader Indicator Development 18 11-08-2007 11:00 AM
Multiple support/resistance points daxman Automated Trading 3 10-17-2007 12:54 PM
Shading areas of chart? higler Charting 3 05-01-2007 07:58 AM


All times are GMT -6. The time now is 11:55 PM.