PriceActionSwing discussion (Page 32) - 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,752 / 1,346
Last Reply:December 7th, 2016 (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 29th, 2011, 02:06 PM   #311 (permalink)
Elite Member
BUENOS AIRES
 
Futures Experience: Intermediate
Platform: ninja
Broker/Data: AMP
Favorite Futures: ES
 
Posts: 34 since Nov 2009
Thanks: 0 given, 13 received

Tks. Will work on this and send you feedback
Marcelo




forrestang View Post
Here you go!

I created pretty much a blank template that pulls the variables from Dorsch's Indicator. The two main one's I'm sure you need are there. You just need to add your logic which can just be 'IF' statements etc. The user inputs are coded for you already so that when you add it to a chart, you can manipulate the settings you want for the "PriceActionSwing" indicator itself. The picture should cover most of the explanation you need.

You can see the debug line in the code(green box in attached pic). This is how you can test to be sure it does what you want. For example, replace the "1" with a "-1" and you should see it will draw those arrows when the Trend is DOWN according to the "PriceActionSwing" indicator. If you replace "swingTrend" with "swingRelation" you will see it will draw the arrows only when price makes a HH/HL combination.

I'd suggest you add the "PriceActionSwing" indicator as well to your chart (with the same settings) while you test it to verify your logic is what you want. Play with it you will understand.

Only thing is that I made this as an indicator. You can get your logic straight here. Then once you do that, just turn it into a strategy, and put in the lggic for entering and exiting trades.


Reply With Quote
     

Old July 30th, 2011, 07:15 PM   #312 (permalink)
Elite Member
BUENOS AIRES
 
Futures Experience: Intermediate
Platform: ninja
Broker/Data: AMP
Favorite Futures: ES
 
Posts: 34 since Nov 2009
Thanks: 0 given, 13 received


marcelo_s View Post
Tks. Will work on this and send you feedback
Marcelo

Hi, could not converted to Strategy. I attached the file so you can see. On Log Tab the error " Reference to an object ..... "
Tks for more help

Marcelo

Attached Files
Register to download File Type: cs SwingTrendX.cs (4.8 KB, 30 views)
Reply With Quote
     

Old July 30th, 2011, 07:21 PM   #313 (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


I'm not on a PC that has NT on it at the moment.

What did you do exactly to change it to a strategy?

Reply With Quote
     

Old July 30th, 2011, 07:26 PM   #314 (permalink)
Elite Member
BUENOS AIRES
 
Futures Experience: Intermediate
Platform: ninja
Broker/Data: AMP
Favorite Futures: ES
 
Posts: 34 since Nov 2009
Thanks: 0 given, 13 received


forrestang View Post
I'm not on a PC that has NT on it at the moment.

What did you do exactly to change it to a strategy?

1- Added on Using Declaration using PriceActionSwing.Utility;
2- Added on Variables
private int swingSize = 2;
private SwingTypes swingType = SwingTypes.Standard;
private int dtbStrength = 15;
private IDataSeries swingRelation = null; //HH/HL or LL/LH
private IDataSeries swingTrend = null; //Trend defined by DTs/DBs too

//variables below not needed, let in for completeness
private bool seeRelation = false;
private bool useOldTrend = true;
private bool paintBars = true;
private int oldTrend = 0;
3- Added Conditions


protected override void OnBarUpdate()
{

if (CurrentBar < 1)
{
if (swingRelation == null)
swingRelation = PriceActionSwing(Input, dtbStrength, swingSize, swingType).SwingRelation;

if (swingTrend == null)
swingTrend = PriceActionSwing(Input, dtbStrength, swingSize, swingType).SwingTrend;
}

4- Added on Propierties the Parameters

#region Parameters
//=====================================================================
/// <summary>
/// Represents the swing size. e.g. 1 = small swings and 5 = bigger swings.
/// </summary>
#if NT7
[GridCategory("Parameters")]
#else
[Category("Parameters")]
#endif
[Description("Represents the swing size. e.g. 1 = small swings and 5 = bigger swings.")]
[Gui.Design.DisplayName("2.Swing size")]
public int SwingSize
{
get { return swingSize; }
set { swingSize = Math.Max(1, value); }
}
/// <summary>
/// Represents the swing type. Standard | Gann
/// </summary>
#if NT7
[GridCategory("Parameters")]
#else
[Category("Parameters")]
#endif
[Description("Represents the swing type. Standard | Gann")]
[Gui.Design.DisplayName("3.Swing type")]
public SwingTypes SwingType
{
get { return swingType; }
set { swingType = value; }
}
/// <summary>
/// Represents the double top/-bottom strength.
/// </summary>
#if NT7
[GridCategory("Parameters")]
#else
[Category("Parameters")]
#endif
[Description("Represents the double top/-bottom strength. Increase the value to get more DB/DT.")]
[Gui.Design.DisplayName("1.Double top/-bottom strength")]
public int DtbStrength
{
get { return dtbStrength; }
set { dtbStrength = Math.Max(1, value); }
}
[Category("Visualize")]
[Description("Indicates if the trend direction is shown or the swing relation.")]
[Gui.Design.DisplayNameAttribute("See swing relation")]
public bool SeeRelation
{
get { return seeRelation; }
set { seeRelation = value; }
}
[Category("Visualize")]
[Description("Indicates if the trend direction is changed when the old trend ends or whether a new trend must start.")]
[Gui.Design.DisplayNameAttribute("Trend change")]
public bool UseOldTrend
{
get { return useOldTrend; }
set { useOldTrend = value; }
}
#endregion


Compile OK but when adding to chart and enable, it does not works and error shows

Reply With Quote
     

Old July 30th, 2011, 07:39 PM   #315 (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

Are you a NinjaTrader user?

 
Change the indicator type in the name of the strategy. Right now it probably says:

 
Code
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Indicator
Change it to:
 
Code
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
Also make sure your 'using declaration' block has it in there. Compare against another strategy you have loaded to make sure the proper declaration is there at the very top.

Reply With Quote
     

Old July 30th, 2011, 07:46 PM   #316 (permalink)
Elite Member
BUENOS AIRES
 
Futures Experience: Intermediate
Platform: ninja
Broker/Data: AMP
Favorite Futures: ES
 
Posts: 34 since Nov 2009
Thanks: 0 given, 13 received


forrestang View Post
Change the indicator type in the name of the strategy. Right now it probably says:

 
Code
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Indicator
Change it to:
 
Code
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
Also make sure your 'using declaration' block has it in there. Compare against another strategy you have loaded to make sure the proper declaration is there at the very top.

******************************************************************************

That is what I did, see below

#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
using PriceActionSwing.Utility;
#endregion

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class SwingTrendX : Strategy
{
#region Variables
//Variables for PriceActionSwing
private int swingSize = 2;
private SwingTypes swingType = SwingTypes.Standard;
private int dtbStrength = 15;
private IDataSeries swingRelation = null; //HH/HL or LL/LH
private IDataSeries swingTrend = null; //Trend defined by DTs/DBs too

//variables below not needed, let in for completeness
private bool seeRelation = false;
private bool useOldTrend = true;
private bool paintBars = true;
private int oldTrend = 0;
#endregion

/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = true;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{

if (CurrentBar < 1)
{
if (swingRelation == null)
swingRelation = PriceActionSwing(Input, dtbStrength, swingSize, swingType).SwingRelation;

if (swingTrend == null)
swingTrend = PriceActionSwing(Input, dtbStrength, swingSize, swingType).SwingTrend;
}

//MARCELO ----- This IF statement is just used for debugging, so that you can see what values are
//in the two main variables you want that are referenced above.
if(swingTrend[0] == 1)
{
DrawArrowUp("arrow"+CurrentBar, true, 0, Low[0]-12*TickSize, Color.Green);
}


if(swingTrend[0] == -1)
{
DrawArrowDown("arrow"+CurrentBar, true, 0, High[0]+12*TickSize, Color.Red);
}





}
#region Properties

#region Parameters
//=====================================================================
/// <summary>
/// Represents the swing size. e.g. 1 = small swings and 5 = bigger swings.
/// </summary>
#if NT7
[GridCategory("Parameters")]
#else
[Category("Parameters")]
#endif
[Description("Represents the swing size. e.g. 1 = small swings and 5 = bigger swings.")]
[Gui.Design.DisplayName("2.Swing size")]
public int SwingSize
{
get { return swingSize; }
set { swingSize = Math.Max(1, value); }
}
/// <summary>
/// Represents the swing type. Standard | Gann
/// </summary>
#if NT7
[GridCategory("Parameters")]
#else
[Category("Parameters")]
#endif
[Description("Represents the swing type. Standard | Gann")]
[Gui.Design.DisplayName("3.Swing type")]
public SwingTypes SwingType
{
get { return swingType; }
set { swingType = value; }
}
/// <summary>
/// Represents the double top/-bottom strength.
/// </summary>
#if NT7
[GridCategory("Parameters")]
#else
[Category("Parameters")]
#endif
[Description("Represents the double top/-bottom strength. Increase the value to get more DB/DT.")]
[Gui.Design.DisplayName("1.Double top/-bottom strength")]
public int DtbStrength
{
get { return dtbStrength; }
set { dtbStrength = Math.Max(1, value); }
}
[Category("Visualize")]
[Description("Indicates if the trend direction is shown or the swing relation.")]
[Gui.Design.DisplayNameAttribute("See swing relation")]
public bool SeeRelation
{
get { return seeRelation; }
set { seeRelation = value; }
}
[Category("Visualize")]
[Description("Indicates if the trend direction is changed when the old trend ends or whether a new trend must start.")]
[Gui.Design.DisplayNameAttribute("Trend change")]
public bool UseOldTrend
{
get { return useOldTrend; }
set { useOldTrend = value; }
}
#endregion



#endregion
}
}

Reply With Quote
     

Old July 30th, 2011, 09:03 PM   #317 (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

I just tried running it.

There is a problem somewhere, definetely some reference somewhere. I'm not sure where at the moment.

I'll play around with it, not sure why the strategy is giving problems when the indie is not. You may want to start a thread in programming.

Reply With Quote
     

Old July 30th, 2011, 10:20 PM   #318 (permalink)
Elite Member
BUENOS AIRES
 
Futures Experience: Intermediate
Platform: ninja
Broker/Data: AMP
Favorite Futures: ES
 
Posts: 34 since Nov 2009
Thanks: 0 given, 13 received


forrestang View Post
I just tried running it.

There is a problem somewhere, definetely some reference somewhere. I'm not sure where at the moment.

I'll play around with it, not sure why the strategy is giving problems when the indie is not. You may want to start a thread in programming.

Tks, let me know if you can solve it.
I will post it on programming also to ask for help

Reply With Quote
     

Old August 1st, 2011, 10:32 AM   #319 (permalink)
Elite Member
BUENOS AIRES
 
Futures Experience: Intermediate
Platform: ninja
Broker/Data: AMP
Favorite Futures: ES
 
Posts: 34 since Nov 2009
Thanks: 0 given, 13 received


marcelo_s View Post
Tks, let me know if you can solve it.
I will post it on programming also to ask for help

I asked support to NT, and they answered as follow

" The issue likely is that indicator and strategies work different with your assignment of the data series return of the SwingRelation indicator as an object.
I would suggest working with the supported .Set approach here to add doubles to a series. You can likely just call the indicator plot directly in the strategy without needed to create additional series here first. "

Do you know how to do what is suggested ?

tks for help

Reply With Quote
     

Old August 5th, 2011, 08:25 AM   #320 (permalink)
Elite Member
Germany
 
Futures Experience: Intermediate
Platform: NinjaTrader
 
Serninja's Avatar
 
Posts: 56 since Mar 2010
Thanks: 87 given, 30 received

PriceActionSwing - Relative Swing Volume in Percent


dorschden,

I would like to ask you if it's possible for you to add a relative volume swing value in percent?

For example: Imagine a down swing in price with 100K volume and then a 30% up swing in price with 50K volume. When I set to show me the swing percentage, I can see the 30% print which is referring to the price swing but I still have to make mental math regarding the relative volume swing in percent of the last swing which would be 50%.

In this case price retraced 30% up but needed 50% of the last swing volume.

I believe it's helpful to have an 'at a glance - effort vs. result' view, so one can see if the price move is accompanied with high or low volume relative to the last price swing.

Thank you very much in advance!

Kind regards,
Serninja

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)
 

Trading Technologies: ADL hands-on

Dec 13

Normal webinar schedule resumes after the holidays

January

Ernie Chan: Risk Management

Elite only

Dedicated Trading Servers: Advantages/Disadvantages w/sam028

Elite only

An Afternoon with FIO member Massive I

Elite only

Leo Murphy: TBA

Elite only
     

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:33 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-10 in 0.17 seconds with 20 queries on phoenix via your IP 54.197.142.219