PriceActionSwing discussion (Page 29) - NinjaTrader | futures.io
futures.io futures trading
 

Go Back   futures.io

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader


PriceActionSwing discussion
Started:November 23rd, 2009 (11:23 AM) by dorschden Views / Replies:392,466 / 1,346
Last Reply:Yesterday (10:04 AM) Attachments:423

Welcome to futures.io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.


You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike
     

Reply
 423  
 
Thread Tools Search this Thread

PriceActionSwing discussion

Old July 16th, 2011, 02:14 PM   #281 (permalink)
Urban Samurai
Chicago IL
 
Futures Experience: Intermediate
Platform: Ninja, MT4,TOS, SC, Matlab
Broker/Data: CQG, AMP, MB, DTN
Favorite Futures: E/U, G/U
 
forrestang's Avatar
 
Posts: 1,030 since Jun 2010
Thanks: 223 given, 666 received


dorschden View Post
Pepperdog,

you have to add this lines in your strategy

 
Code
#region Using declarations
...
using PriceActionSwing.Utility;
#endregion 

#region Variables
...
private SwingMode pAS_SwingMode = SwingMode.Standard; 
private int pAS_DtbStrength = 15; 
private int pAS_Span = 8; 
#endregion

protected override void Initialize()
{
   
   // Add the indicator to the chart - not necessary
   Add(PriceActionSwing(pAS_SwingMode, pAS_DtbStrength, pAS_Span));
}

protected override void OnBarUpdate()
{
   
   // If the last high and  low was higher high and higher low and a short sma cross above the long sma enter long
   if (PriceActionSwing(pAS_SwingMode, pAS_DtbStrength, pAS_Span).PriceSwingRelation[0] == 1 && CrossAbove(SMA(3), SMA(7), 1))
   (
      EnterLong(DefaultQuantity, "");
   )
   ...
}

#region Properties
[Category("Parameters")]
public SwingMode PAS_SwingMode
{
   get { return pAS_SwingMode; }
   set { pAS_SwingMode = value; }
}

[Category("Parameters")]
public int PAS_DtbStrength
{
   get { return pAS_DtbStrength; }
   set { pAS_DtbStrength = Math.Max(1, value); }
}

[Category("Parameters")]
public int PAS_Span
{
   get { return pAS_Span; }
   set { pAS_Span = Math.Max(1, value); }
}
#endregion
For the 1 in "PriceSwingRelation[0] == 1" you can set the following values
-2 for double top
-1 for lower high and lower low
0 nothing
1 for higher high and higher low
2 for double bottom

Hope this helps.


Howdy.

I am trying to reference some things in your study. Basically just the swing relation, i.e. price making a HH and HL or LL and LH.

When I try to add this code snippet here, I get an error shown in the picture. I don't know if something has changed, but I am using the latest version from the download section. Is this still the proper code snippet to insert into my indicator?

Reply With Quote
     

Old July 16th, 2011, 03:19 PM   #282 (permalink)
Elite Member
Germany (Meck-Pomm)
 
Futures Experience: Advanced
Platform: NinjaTrader
 
Posts: 107 since Jun 2009
Thanks: 50 given, 935 received

You have to replace in your post in the bold line the "PriceSwingRelation" with "SwingRelation" and then it should work. You can also take a look in the PriceActionSwingTrend indicator as an example how to access the swing relation values.
 
Code
			
// HH and HL

if (PriceActionSwing(pAS_DtbStrengthpAS_SpanpAS_SwingMode).SwingRelation[0] == 1)
// if (PriceActionSwing(15, 7, SwingTypes.Standard).SwingRelation[0] == 1)
{
  
// Do something



Last edited by dorschden; July 16th, 2011 at 06:26 PM.
Reply With Quote
     
The following user says Thank You to dorschden for this post:
     

Old July 16th, 2011, 06:01 PM   #283 (permalink)
Urban Samurai
Chicago IL
 
Futures Experience: Intermediate
Platform: Ninja, MT4,TOS, SC, Matlab
Broker/Data: CQG, AMP, MB, DTN
Favorite Futures: E/U, G/U
 
forrestang's Avatar
 
Posts: 1,030 since Jun 2010
Thanks: 223 given, 666 received



dorschden View Post
You have to replace in your post in the bold line the "PriceSwingRelation" with "SwingRelation" and then it should work. You can also take a look in the PriceActionSwingTrend indicator as an example how to access the swing relation values.
 
Code
			
// HH and HL
if (PriceActionSwing(pAS_SwingModepAS_DtbStrengthpAS_Span).SwingRelation[0] == 1)
{
  
// Do something


I just couldn't seem to get that to work no matter what I tried. I kept getting an error having to do with the 'swingmode.'

So I just copied that entire "PriceActionSwingTrend" and I will start from there by modifying that.

But can you tell me which data series, or variable I would need to use just to know when a HH/HL or LL/LH is being made?

Just basically,

 
Code
if (price makes a HH/HL)
{
    Do this
}


-----EDIT---------
Looks like "swingRelation" is what I need.


Last edited by forrestang; July 16th, 2011 at 06:27 PM.
Reply With Quote
     

Old July 16th, 2011, 06:28 PM   #284 (permalink)
Elite Member
Germany (Meck-Pomm)
 
Futures Experience: Advanced
Platform: NinjaTrader
 
Posts: 107 since Jun 2009
Thanks: 50 given, 935 received


forrestang View Post
I just couldn't seem to get that to work no matter what I tried. I kept getting an error having to do with the 'swingmode.'

The parameters were interchanged. Try the edited code above.
And in the "using" region in the top of your indicator/strategy you have to add "using PriceActionSwing.Utility;".
Check for the SwingRelation value.
SwingRelation[0] == 1 is equal to HH/HL
SwingRelation[0] == -1 is equal to LL/LH

Reply With Quote
     
The following 2 users say Thank You to dorschden for this post:
     

Old July 16th, 2011, 06:30 PM   #285 (permalink)
Urban Samurai
Chicago IL
 
Futures Experience: Intermediate
Platform: Ninja, MT4,TOS, SC, Matlab
Broker/Data: CQG, AMP, MB, DTN
Favorite Futures: E/U, G/U
 
forrestang's Avatar
 
Posts: 1,030 since Jun 2010
Thanks: 223 given, 666 received

Futures Edge on FIO

dorschden View Post
The parameters were interchanged. Try the edited code above.
And in the "using" region in the top of your indicator/strategy you have to add "using PriceActionSwing.Utility;".
Check for the SwingRelation value.
SwingRelation[0] == 1 is equal to HH/HL
SwingRelation[0] == -1 is equal to LL/LH

Thanks..... I just edited my post above that I found that swingRelation dataseries.

Just plotting arrows to confirm it is doing what I want(on a HH/HL).

Attached Thumbnails
PriceActionSwing discussion-testing.jpg  
Reply With Quote
     

Old July 17th, 2011, 12:55 AM   #286 (permalink)
Urban Samurai
Chicago IL
 
Futures Experience: Intermediate
Platform: Ninja, MT4,TOS, SC, Matlab
Broker/Data: CQG, AMP, MB, DTN
Favorite Futures: E/U, G/U
 
forrestang's Avatar
 
Posts: 1,030 since Jun 2010
Thanks: 223 given, 666 received

@dorschden

I had everything working mostly the way I wanted it to. And this was mainly by taking the "PriceActionSwingTrend" indie, and deleting most of it, then adding in the things I needed. It worked fine.

Then I reloaded everything, then all of a sudden I get errors and the chart won't load. It is an error pertaining to not initializing, or checking for a null reference. I have been at it for a while and cannot seem to figure it out. I am wondering if you had run into a similar problem with the indicator before?

The error is pertaining to THIS i believe?

Running several iterations, commenting out various lines of code, I get the errors shown in the picture (there are only 3, but I've run it many times trying to figure out what was wrong).

Here is a code snippet. You don't have to comb over it entirely, but if you've seen this before, is there something OBVIOUSLY wrong that jumps out at you in the 'Initialize()' or 'OnBarUpdate()" blocks?

 
Code
//#region Variables
        //#####################################################################
        //Variables for PriceActionSwing
	private int swingSize = 2;
        private SwingTypes swingType = SwingTypes.Standard;
        private int dtbStrength = 15;
        private IDataSeries swingRelation;
        private IDataSeries swingTrend;
        private bool seeRelation = false;
        private bool useOldTrend = true;
        private bool paintBars = true;
        private int oldTrend = 0;
        private Color upTrendColour = Color.Green;
        private Color dnTrendColour = Color.Red;
        private Color noTrendColour = Color.Gray;
		
	//Variables for IchiCloud
	private int periodFast = 9;			// Default setting for PeriodFast
        private int periodMedium = 26;		// Default setting for PeriodMedium
        private int periodSlow = 52;		// Default setting for PeriodSlow
		
	//Variables independant to FPCJTrend
	private bool blueCloud = false;
	private bool redCloud = false;
	private int ichiBuffer = 6;
		
        //#####################################################################
        //#endregion

        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        protected override void Initialize()
        {
            
	    //Add(new Plot(new Pen(Color.Firebrick, 20), PlotStyle.Square, "DoubleTop"));
            Add(new Plot(new Pen(Color.Red, 20), PlotStyle.Square, "DownTrend"));
            Add(new Plot(new Pen(Color.Gold, 20), PlotStyle.Square, "NoWhere"));
            Add(new Plot(new Pen(Color.Green, 20), PlotStyle.Square, "UpTrend"));
            //Add(new Plot(new Pen(Color.Lime, 20), PlotStyle.Square, "DoubleBottom"));
			
            CalculateOnBarClose = true;
            Overlay				= true;
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {	
			
			
		if (CurrentBar < swingSize)		
                        return;							//Do we have enough bars for PriceActionSwing
			
		if ((CurrentBar < periodMedium) || (CurrentBar < periodFast))
			return;							// Do we have enough bars for Ichi Calculation
			

		if (CurrentBar < 1)
               {
                     if (swingRelation == null && seeRelation)
                              swingRelation = PriceActionSwing(Input, dtbStrength, swingSize, swingType).SwingRelation;
                     if (swingTrend == null && !seeRelation)
                              swingTrend = PriceActionSwing(Input, dtbStrength, swingSize, swingType).SwingTrend;
                }
			
		double spanA = IchiCloud(Input, periodFast, periodMedium, periodSlow).SenkouSpanA[0];
		double spanB = IchiCloud(Input, periodFast, periodMedium, periodSlow).SenkouSpanB[0];
						
		if(spanA > spanB)
			{
				blueCloud = true;	
				redCloud = false;
			}
			
		if(spanA < spanB)
			{
				redCloud = true;
				blueCloud = false;
			}
			
		if(redCloud == true)
			{
				DrawArrowDown("arrow"+CurrentBar, true, 0, Low[0]+12*TickSize, Color.Red);	
			}
			
			
			///*
                if (swingTrend[0] == 1 && blueCloud == true && Low[0] > spanA-ichiBuffer*TickSize)
			{
				UpTrend.Set(1);
				//DrawArrowUp("arrow"+CurrentBar, true, 0, Low[0]-12*TickSize, Color.Green);
				//Print("hi");
			}
            
		else if (swingTrend[0] == -1 && redCloud == true && High[0] < spanA+ ichiBuffer*TickSize)
			{
				DownTrend.Set(1);
				//DrawArrowDown("arrow"+CurrentBar, true, 0, Low[0]+12*TickSize, Color.Red);
			}
			
		else
			{
				NoWhere.Set(1);	
			}

Attached Thumbnails
PriceActionSwing discussion-prime2011-07-16_225051.jpg  
Reply With Quote
     

Old July 17th, 2011, 02:37 AM   #287 (permalink)
Elite Member
Buderim Queensland Australia
 
Futures Experience: Advanced
Platform: ninja
Broker/Data: AMP/Zenfire
Favorite Futures: 6E, 6B, YM
 
Posts: 79 since Jul 2009
Thanks: 120 given, 24 received

Bottom


forrestang View Post
Thanks..... I just edited my post above that I found that swingRelation dataseries.

Just plotting arrows to confirm it is doing what I want(on a HH/HL).


Where can i find the trend indicator on the bottom of your chart??

Thanks a million

Reply With Quote
     

Old July 17th, 2011, 02:41 AM   #288 (permalink)
Urban Samurai
Chicago IL
 
Futures Experience: Intermediate
Platform: Ninja, MT4,TOS, SC, Matlab
Broker/Data: CQG, AMP, MB, DTN
Favorite Futures: E/U, G/U
 
forrestang's Avatar
 
Posts: 1,030 since Jun 2010
Thanks: 223 given, 666 received


ticnau View Post
Where can i find the trend indicator on the bottom of your chart??

Thanks a million



I'm not sure what you mean? Are you referring to the one called "PriceActionTrend?" That's in the download section, created by the OP of this post. In there, are two studies. One is called "PriceActionSwing" and the other is called "PriceActionSwingTrend."

If you are referring to the indie at the VERY bottom, that's my indicator I'm working on and at the momement isn't working.

Reply With Quote
     
The following user says Thank You to forrestang for this post:
     

Old July 17th, 2011, 02:49 AM   #289 (permalink)
Elite Member
Milan Italy
 
Futures Experience: Intermediate
Platform: Ninjatrader, Sierra Chart
Favorite Futures: ES
 
Posts: 516 since Feb 2010
Thanks: 465 given, 619 received

Looks like the "if CurrentBar < 1 " section should come first. otherwise swingTrend and swingRelation have no value set.

We're working along similar lines....

Reply With Quote
     

Old July 17th, 2011, 02:53 AM   #290 (permalink)
Urban Samurai
Chicago IL
 
Futures Experience: Intermediate
Platform: Ninja, MT4,TOS, SC, Matlab
Broker/Data: CQG, AMP, MB, DTN
Favorite Futures: E/U, G/U
 
forrestang's Avatar
 
Posts: 1,030 since Jun 2010
Thanks: 223 given, 666 received



futuretrader View Post
Looks like the "if CurrentBar < 1 " section should come first. otherwise swingTrend and swingRelation have no value set.

We're working along similar lines....

I dunno....... I actually have that first the way my script sits now. I still get the same error.



-----EDIT------
I commented out the first portion in void onBarUpdate. See this code snippet and my indie is now working. I'm not sure what those where there for, but they must have a purpose I am failing to understand.
 
Code
if (CurrentBar < 1)
       {
              //if (swingRelation == null && seeRelation)
               swingRelation = PriceActionSwing(Input, dtbStrength, swingSize, swingType).SwingRelation;
				
              //if (swingTrend == null && !seeRelation)
              swingTrend = PriceActionSwing(Input, dtbStrength, swingSize, swingType).SwingTrend;
       }


Last edited by forrestang; July 17th, 2011 at 03:19 AM.
Reply With Quote
     

Reply



futures.io > Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > PriceActionSwing discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)
 

NinjaTrader 8: Features and Enhancements, Tips and Tricks

Dec 6
 

Al Brooks: Stop Losing when a Good Trade goes Bad, Correcting Mistakes

Elite only
 

Trading Technologies: Algo Design Lab hands-on

Dec 13
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Murray Math Discussion? jwhtrades Traders Hideout 5 July 27th, 2011 10:06 PM
Looking for general discussion thread. jctrader Traders Hideout 2 May 2nd, 2011 03:23 PM
PriceActionSwing jeff92887 NinjaTrader 2 March 1st, 2011 07:15 AM


All times are GMT -4. The time now is 12:01 PM.

Copyright © 2016 by futures.io. 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.
 
no new posts
Page generated 2016-12-08 in 0.15 seconds with 20 queries on phoenix via your IP 54.163.94.5