NexusFi: Find Your Edge


Home Menu

 





Swing Hi/Lo points for indicator values?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one zacharydw00 with 5 posts (1 thanks)
    2. looks_two sam028 with 3 posts (0 thanks)
    3. looks_3 max-td with 2 posts (0 thanks)
    4. looks_4 Trader.Jon with 2 posts (0 thanks)
    1. trending_up 12,306 views
    2. thumb_up 7 thanks given
    3. group 13 followers
    1. forum 18 posts
    2. attach_file 3 attachments




 
Search this Thread

Swing Hi/Lo points for indicator values?

  #11 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


Trader.Jon View Post
Sam,

Any thoughts on how to use (code) previous swing levels as profit targets ? I am thinking on as momentum stays above a certain level, then the profit target keeps moving from previous swing level to the next profitable swing level, and then as ROC falls the profit target drops to the price as market order.

Jon

Their are many ways to do this, but the easier is maybe to use a multidimensional array, to store the previous swing levels.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
32 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #12 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
Near the BEuTiFULL Horse Shoe
 
Experience: Beginner
Platform: NinjaTrader
Broker: MBTrading Dukascopy ZenFire
Trading: $EURUSD when it is trending
Posts: 473 since Jul 2009
Thanks Given: 401
Thanks Received: 184


sam028 View Post
Their are many ways to do this, but the easier is maybe to use a multidimensional array, to store the previous swing levels.


Do you know a strategy or indicator that would use that type of array so I can have a look at the code?

Reply With Quote
  #13 (permalink)
 
zacharydw00's Avatar
 zacharydw00 
Idaho
 
Experience: Intermediate
Platform: NinjaTrader,ToS
Broker: Amp Futures, ToS
Trading: ES, E7, CL, GC
Posts: 149 since Aug 2009
Thanks Given: 87
Thanks Received: 180


Jon here's a simple (NT 6.5) strategy I was testing on the ES a few months back that uses swing Hi/Lo point patterns to enter trades. If you can improve the entry signals that would be great. At least, hopefully the Hi/Lo code will help you out.

Attached Files
Elite Membership required to download: GRTswingHiLoV1d20100128.zip
Started this thread Reply With Quote
Thanked by:
  #14 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


Trader.Jon View Post
Do you know a strategy or indicator that would use that type of array so I can have a look at the code?

Sorry, I didn't found any piece of NT code using multi dimensional arrays, but if you just need to store the previous swing high/swing low, using two simple variables is enough, something like (pseudo-code not tested):
 
Code
                            
init() {

  
_previous_high=Swing(5).SwingHigh[0];
  
_previous_low=Swing(5).SwingLow[0];
}
protected 
override void OnBarUpdate() {
if (
_previous_high != Swing(5).SwingHigh[0] )
  
_previous_high=Swing(5).SwingHigh[0];
if (
_previous_low != Swing(5).SwingLow[0] )
  
_previous_low=Swing(5).SwingLow[0];
_stop_Long=_previous_low;
_stop_Short=_previous_high;...} 

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #15 (permalink)
 
zacharydw00's Avatar
 zacharydw00 
Idaho
 
Experience: Intermediate
Platform: NinjaTrader,ToS
Broker: Amp Futures, ToS
Trading: ES, E7, CL, GC
Posts: 149 since Aug 2009
Thanks Given: 87
Thanks Received: 180


zacharydw00 View Post
Any one know of an indicator or code that will identify the Swing Hi/Lo points of an indicator's output value? NT's Swing indicator uses the High & Low functions, which can't be applied to an ind. value. Thanks.

I was wrong about the Swing ind. To update anyone who's following this post, I am making good progress on my divergence ind. I'm working on the the more complex part first... getting it to work with the MACD Histogram.

FYI- Europe is sinking. Short the E7.

Started this thread Reply With Quote
  #16 (permalink)
 TimC 
East Coast USA
 
Experience: Intermediate
Platform: NT8
Broker: Amp/CQG
Trading: NQ
Posts: 16 since Dec 2009
Thanks Given: 9
Thanks Received: 5

Does anyone know if the "mean" of the swing h/l indicator can be plotted? Similar to the Donchian channel mean.

Reply With Quote
  #17 (permalink)
 
zacharydw00's Avatar
 zacharydw00 
Idaho
 
Experience: Intermediate
Platform: NinjaTrader,ToS
Broker: Amp Futures, ToS
Trading: ES, E7, CL, GC
Posts: 149 since Aug 2009
Thanks Given: 87
Thanks Received: 180

Simple answer... Yes. It probably would be fairly easy to modify NT's Swing ind to calc and plot the mean.

Started this thread Reply With Quote
  #18 (permalink)
 
spinnybobo's Avatar
 spinnybobo 
Crete, IL/USA
 
Experience: Intermediate
Platform: NinjaTrader, Mt4
Broker: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Trading: ES, CL, EUR/USD, TF
Posts: 173 since Aug 2009
Thanks Given: 105
Thanks Received: 61


sam028 View Post
If you mean a strategy using the Swing built-in indicator, it's easy, something like:
 
Code
                            
if (Close[0] > Swing(5).SwingHigh[0]) {
  
Golong();
  
etcetc, ...
}
if (
Close[0] < Swing(5).SwingLow[0]) {
  
GoShort();
  
etcetc, ...


Hi Sam
this simple code worked well for me, but I noticed once the next bar would be > the swing high, it would still go long and opposite for short. so, I think

 
Code
if(High[0] > Swing(5).SwingHigh[0] && High[1] < Swing(5).SwingHigh[0])
   GoLong();
if(Low[0] < Swing(5).SwingLow[0] && Low[1] > Swing(5).SwingLow[0])
  GoShort();
this is assuming you only want to go long the 1st time it breaks out or breaks down, rather than going long and short over and over just because it is above or below the swing level

thanks and love your webinar
Spencer

Follow me on Twitter Reply With Quote
  #19 (permalink)
 
wccktrader's Avatar
 wccktrader 
Singapore
 
Experience: Intermediate
Platform: NinjaTrader, Sierra Charts
Broker: Thinkorswim, IQFeed
Trading: Options of SPY, IWM, QQQ
Posts: 47 since Nov 2010
Thanks Given: 54
Thanks Received: 149


zacharydw00 View Post
Any one know of an indicator or code that will identify the Swing Hi/Lo points of an indicator's output value? NT's Swing indicator uses the High & Low functions, which can't be applied to an ind. value. Thanks.

Attached is an indicator that I have coded based on NT's Swing indicator. It shows the trend based on a specified swing strength/period. The indicator can be referenced from a strategy. The code for a simple crossover strategy could be as follows:


if
(Close[0] < SwingChartTrend(SwingPeriod).SupplyLine[0]
&& Close[
1] > SwingChartTrend(SwingPeriod).DemandLine[1])



{

DrawArrowDown(
"My down arrow" + CurrentBar, false, 0, High[0]+(8*TickSize), Color.Red);

}

if (Close[0] > SwingChartTrend(SwingPeriod).DemandLine[0]
&& Close[
1] < SwingChartTrend(SwingPeriod).SupplyLine[1])



{

DrawArrowUp(
"My up arrow" + CurrentBar, false, 0, Low[0]+(-8*TickSize), Color.Green);

}



Attached Thumbnails
Click image for larger version

Name:	SwingChartTrend.png
Views:	453
Size:	125.3 KB
ID:	47006  
Attached Files
Elite Membership required to download: SwingChartTrend.zip
Reply With Quote




Last Updated on August 20, 2011


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts