PriceActionSwing discussion (Page 30) - 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:391,846 / 1,345
Last Reply:14 Minutes Ago (10:10 PM) 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 17th, 2011, 06:14 AM   #291 (permalink)
Elite Member
Germany (Meck-Pomm)
 
Futures Experience: Advanced
Platform: NinjaTrader
 
Posts: 107 since Jun 2009
Thanks: 50 given, 934 received

PriceActionSwing DataSeries access

Use the following code, which is a good way to access the public DataSeries from the PriceActionSwing indicator within other indicators/strategies.
 
Code
			
#region Using declarations

...
using PriceActionSwing.Utility;
#endregion

#region Variables
...
private 
int dtbStrength 15;
private 
int swingSize 7;
private 
SwingTypes swingType SwingTypes.Standard;
private 
IDataSeries swingRelation;
private 
IDataSeries swingTrend;
#endregion

protected override void OnStartUp()
{
  if (
swingRelation == null)
    
swingRelation PriceActionSwing(InputdtbStrengthswingSizeswingType).SwingRelation;
  if (
swingTrend == null)
    
swingTrend PriceActionSwing(InputdtbStrengthswingSizeswingType).SwingTrend;
  
// Assign other DataSeries here
}

protected 
override void OnBarUpdate()
{
  
// If HH and HL draw an arrow
  
if (swingRelation[0] == 1)
    
DrawArrowUp("MyArrow" CurrentBartrue0Low[0] - TickSizeColor.Lime);
  ...

Forrestang,

Like futuretrader mention, it is important, that the assignment of the "SwingRelation" dataseries comes before any other return statement, while the "if (CurrentBar < 1)" part is a leftover from NT 6.5. Or you can use the above code and every thing should work. You can do the same with the data series from the IchiCloud indicator.

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

Old July 17th, 2011, 11:39 AM   #292 (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

Thanks a bunch! My script is working with the changes you mentioned.

I am trying to get my indicator to display in MA (Market Analyzer) now. My signal is basically in 1 of 3 positions.

I have been staring at the template you provided in the thread while I was going through it for YOUR MA, trying to figure out which variables you have exposed and how you did it. But I can't get it to do what I want.

What's weirder, is that as you can see in that column "WT_Up" on my MA template, it has the closing price. Which isn't what I want there.

What is it that I need to make sure my script has so that I can print it to MA? I can change the cell conditions, but where does it look in my script for that information?

-----EDIT------

I created a new data series called "trendState." Each time I perform my calculations (which have 3 different states), I have been putting a 1,0, -1 into that data series on each bar. I tried to then expose this variable.

Now, it shows up in MA as a selectable option in the 'plot' field. But the output is still just the close of the last bar on my chart, instead of the output of that dataSeries.

Here is what I mean by what I added. And it is in fact printing the proper output to my test window. I just haven't gotten it to work properly with MA.

 
Code
if (swingTrend[0] == 1 && blueCloud == true && Low[0] > spanA-ichiBuffer*TickSize)
			{
				UpTrend.Set(1);
				trendState[0] = 1;
			}
            
			else if (swingTrend[0] == -1 && redCloud == true && High[0] < spanA+ichiBuffer*TickSize)
			{
				DownTrend.Set(1);
				trendState[0] = -1;
			}
			
			else
			{
				NoWhere.Set(1);	
				trendState[0] = 0;
			}
			
			Print(trendState[0]);

Attached Thumbnails
PriceActionSwing discussion-prime2011-07-17_093014.jpg  

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

Old July 17th, 2011, 12:45 PM   #293 (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'm such a newb!!! I finally got it working.

It was the way I was defining that new data series in the 'properties' section. I now have it returning the data series instead of whatever it was before.

Glad I had your script to reference.

Thanks again Dorschden!

Attached Thumbnails
PriceActionSwing discussion-finally.jpg  
Reply With Quote
     

Old July 24th, 2011, 12:53 PM   #294 (permalink)
Trading Apprentice
NED
 
Futures Experience: None
Platform: Ninja
 
Posts: 34 since May 2010
Thanks: 7 given, 8 received

With these numbers you can get swingrelation:
-2 = DT
-1 = LL and LH
0 = price is nowhere
1 = HH and HL
2 = DB

But is it also possible to get HL and LH?

Reply With Quote
     

Old July 26th, 2011, 05:02 AM   #295 (permalink)
Elite Member
London UK
 
Futures Experience: Advanced
Platform: NinjaTrader, TT
Broker/Data: Mirus
Favorite Futures: CL, Dax, ES, Eurostoxx50
 
Posts: 121 since Oct 2010
Thanks: 23 given, 46 received

Market analyser

Futures Edge on FIO
Hi Dorschden,

Thanks again for this fantastic work on PAS.
Just a question please : is it possible to have sound alerts with the market analyser template you did? If yes, how do you set it up?

Thanks a lot for your help.

Raphael

Reply With Quote
     

Old July 26th, 2011, 12:44 PM   #296 (permalink)
Elite Member
PA
 
Futures Experience: Beginner
Platform: Sierra, Ninja, MD
Broker/Data: Optimus/Rithmic & IQ
Favorite Futures: currency futures
 
Posts: 27 since Apr 2011
Thanks: 10 given, 19 received

Does anyone have the time and skill to add an email alert in addition to the sound?

Reply With Quote
     

Old July 26th, 2011, 07:05 PM   #297 (permalink)
Elite Member
Germany (Meck-Pomm)
 
Futures Experience: Advanced
Platform: NinjaTrader
 
Posts: 107 since Jun 2009
Thanks: 50 given, 934 received


no111 View Post
...you can get swingrelation... But is it also possible to get HL and LH?

no111,

This isn't possible but you can add a dataseries and calculate it by yourself. Add this code to the indicator.
 
Code
			
#region Variables

private DataSeries swingHlLh;
#endregion

// Add to the Initialize() method
swingHlLh = new DataSeries(this);

// Add in the end of OnBarUpdate() method
// HL and LH
if (curHighRelation == Relation.Lower && curLowRelation == Relation.Higher
  
swingHlLh.Set(1);
else
  
swingHlLh.Set(0);

#region Properties
[Browsable(false)]
public 
DataSeries SwingHlLh
{
  
get { return swingHlLh; }
}
#endregion 

rdaune View Post
is it possible to have sound alerts with the market analyser template you did?

Raphael,

Yes, this is possible. Just add an alert condition to it. For more details look here.


evancds View Post
Does anyone have the time and skill to add an email alert in addition to the sound?

evancds,

Sorry I can't help you here, I don't have time for this. But on this site are enough scripts with an email alert, just copy and paste the code.

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

Old July 27th, 2011, 01:08 PM   #298 (permalink)
Elite Member
PA
 
Futures Experience: Beginner
Platform: Sierra, Ninja, MD
Broker/Data: Optimus/Rithmic & IQ
Favorite Futures: currency futures
 
Posts: 27 since Apr 2011
Thanks: 10 given, 19 received

Email

Ok, I've attempted to add the email alert. Can some one compile this and see if it works? I don't have the full version of Ninjatrader

Attached Files
Register to download File Type: cs PriceActionSwingEmail.cs (190.5 KB, 44 views)
Reply With Quote
     

Old July 27th, 2011, 01:11 PM   #299 (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


evancds View Post
Ok, I've attempted to add the email alert. Can some one compile this and see if it works? I don't have the full version of Ninjatrader

I think you can always put your SIM key back in NT, restart, so that you can mess with scripting if you wish.

Reply With Quote
     

Old July 27th, 2011, 01:50 PM   #300 (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

PriceAction Swing Trend


Hi,
I am trying to use the code to build a strategy but an error on the Log tab comes up showing " Reference to oject .... )

This is the way I am starting to write code. May be you can help me how to use this indicator correctly

#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 CLSwing : Strategy
{
#region Variables
// Wizard generated variables

private int swingSize = 3;
private SwingTypes swingType = SwingTypes.Standard;
private int dtbStrength = 15;
private IDataSeries swingTrend;
private IDataSeries swingRelation;

// User defined variables (add any user defined variables below)
#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()
{
// SetStopLoss("", CalculationMode.Ticks, SaftyStopLoss, false);
//SetProfitTarget("", CalculationMode.Ticks, Profit);
//SetTrailStop("", CalculationMode.Ticks, Stop, false);
// SetStopLoss("", CalculationMode.Ticks, Stop, false);

CalculateOnBarClose = true;

}


/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (CurrentBar < 1)
{
if (swingTrend == null)
swingTrend = PriceActionSwing(Input, dtbStrength, swingSize, swingType).SwingTrend;
if (swingRelation == null)
swingRelation = PriceActionSwing(Input, dtbStrength, swingSize, swingType).SwingRelation;
}
int trend = Convert.ToInt32(swingTrend[0]);
switch (trend)
{
case -1:
// Down trend - do something
EnterShort(DefaultQuantity, "Sh");
break;
case 1:
// Up trend - do something
EnterLong(DefaultQuantity, "Lg");
break;
default:
// No trend - do something or nothing
break;
}

// Or alternative
//if (swingRelatioin[0] == 2)
// Double bottom - do something
}
#region Properties

#endregion
}
}

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 10:25 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-04 in 0.13 seconds with 20 queries on phoenix via your IP 54.158.84.38