![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Jul 2007
Location: Fairfax, VA
Posts: 216
Thanks: 0
Thanked 0 times in 0 posts
|
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)?
|
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
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)
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
|
thx Josh - that sounds logical. I think I can code around that.
DG |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |