PriceActionSwing discussion - NinjaTrader | futures.io
futures.io futures trading


PriceActionSwing discussion
Started: by dorschden Views / Replies:408,667 / 1,441
Last Reply: Attachments:448

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
 448  
 
Thread Tools Search this Thread
 

PriceActionSwing discussion

  #301 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 45,732 since Jun 2009
Thanks: 29,082 given, 81,048 received

From a quick look at your code (which you should attach as a file next time please), the problem is you aren't referencing a bar index at the end of the line... like [0] for example.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #302 (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

Error shown on Log tab

Hi Mike

find attached the code. I did not exported yet as a NT file as it is not working. Even can be openned by wordpad

Error on Log tab comes up still " Error on calling 'OnBarUpdate' method for strategy 'SwingTrend/5a5dbe23f8024e478a15d85fea1eb33d': Referencia a objeto no establecida como instancia de un objeto.

If you can help I think this strategy could be profitable for all Big Mike members

Tks
Marcelo

Attached Files
Register to download File Type: cs SwingTrend.cs (7.4 KB, 28 views)
Reply With Quote
 
  #303 (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,033 since Jun 2010
Thanks: 224 given, 673 received



marcelo_s View Post
Hi Mike

find attached the code. I did not exported yet as a NT file as it is not working. Even can be openned by wordpad

Error on Log tab comes up still " Error on calling 'OnBarUpdate' method for strategy 'SwingTrend/5a5dbe23f8024e478a15d85fea1eb33d': Referencia a objeto no establecida como instancia de un objeto.

If you can help I think this strategy could be profitable for all Big Mike members

Tks
Marcelo

Do me a favor and try this out. It compiles at least. There was an error with that 'Log' command you put in there which I think you were using for debugging.

So look @ lines 62-65 and 82-89 and check those.

I'm obviously not smart enough to figure out how to disable 'ChartTrader' for some reason so I didn't add this to my chart, but it compiles.

Attached Files
Register to download File Type: cs SwingTrendx.cs (7.5 KB, 42 views)

Last edited by forrestang; July 28th, 2011 at 04:24 AM.
Reply With Quote
 
  #304 (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
Do me a favor and try this out. It compiles at least. There was an error with that 'Log' command you put in there which I think you were using for debugging.

So look @ lines 62-65 and 82-89 and check those.

I'm obviously not smart enough to figure out how to disable 'ChartTrader' for some reason so I didn't add this to my chart, but it compiles.

Hi,
I deleted @lines 62-65 , but @lines 82-89 I copy/paste them from the forum. Can not be deleted . Does not compiles .
We need to work with a variable that contains the trend ( ==1 Long, ==-1 Short , ==2 neutral ) but I can not find it in the PriceActionSwingTrend code
What do you suggest ?
Tks for help
Marcelo

Reply With Quote
 
  #305 (permalink)
Trading Apprentice
NED
 
Futures Experience: None
Platform: Ninja
 
Posts: 34 since May 2010
Thanks: 7 given, 8 received

Futures Edge on FIO

dorschden View Post
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 

Thanks, I think I get it almost working.
When I add that code to the indicator and then I change my strategy.. I'm getting this error:
OnBarUpdate method for strategy: Object reference not set to an instance of an object.

I think it needs a null reference, like this:
if (swingRelation == null)
swingRelation = PriceActionSwing(Input, dtbStrength, swingSize, swingType).SwingRelation;

But how do I make that for swingHlLh?

Reply With Quote
 
  #306 (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

Hi,

Cannot complile, error shows up on line where

#region Variables
....
private SwingMode pAS_SwingMode = SwingMode.Standard;
.....
#endregion


and on line

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

The type or namespace name 'SwingMode' could not be found (are you missing a using directive or an assembly reference?)


Any idea why?

tks for help
Marcelo





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.


Reply With Quote
 
  #307 (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,033 since Jun 2010
Thanks: 224 given, 673 received


marcelo_s View Post
Hi,
I deleted @lines 62-65 , but @lines 82-89 I copy/paste them from the forum. Can not be deleted . Does not compiles .
We need to work with a variable that contains the trend ( ==1 Long, ==-1 Short , ==2 neutral ) but I can not find it in the PriceActionSwingTrend code
What do you suggest ?
Tks for help
Marcelo

In the 'PriceActionSwingTrend' the variables you are looking for are shown highlighted in the pic.

'swingRelation' tells you if you have a HH/HL or LL/LH in relation to the last swing.

'swingTrend' tells you what the trend is based on that.

These two dataSeries are either -1,0 or +1.

Attached Thumbnails
PriceActionSwing discussion-prime2011-07-29_042818.png  
Reply With Quote
 
  #308 (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,033 since Jun 2010
Thanks: 224 given, 673 received

Also, I would suggest copying the entire "PriceActionSwingTrend" indicator, renaming it, setting the property to 'strategy' and starting from there. This is what I did. At least this way you will have the references you need to build your strategy.

Then delete the things you don't need one at a time.

If you need help with this let me know and we can get you started with that blank template so to speak so that you can begin building the logic you need based on those references.

Reply With Quote
 
  #309 (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
Also, I would suggest copying the entire "PriceActionSwingTrend" indicator, renaming it, setting the property to 'strategy' and starting from there. This is what I did. At least this way you will have the references you need to build your strategy.

Then delete the things you don't need one at a time.

If you need help with this let me know and we can get you started with that blank template so to speak so that you can begin building the logic you need based on those references.

I will apritiate a lot if you can send me the blank template , so I can add only the strategy conditions and actions where Trend == 1 ( Long ) , Trend == -1 ( Short )

Tks for help
Marcelo

Reply With Quote
 
  #310 (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,033 since Jun 2010
Thanks: 224 given, 673 received



marcelo_s View Post
I will apritiate a lot if you can send me the blank template , so I can add only the strategy conditions and actions where Trend == 1 ( Long ) , Trend == -1 ( Short )

Tks for help
Marcelo

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.

Attached Thumbnails
PriceActionSwing discussion-prime2011-07-29_115400.png  
Attached Files
Register to download File Type: cs swingTrendX.cs (10.1 KB, 89 views)
Reply With Quote
The following user says Thank You to forrestang for this post:

Reply



futures io > > > > PriceActionSwing discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Al Brooks: When A Good Trade Goes Bad (Risk and Probabilities)

Elite only

Ran Aroussi: Quant Trading with Python

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 03:08 PM.

no new posts
Page generated 2017-02-21 in 0.14 seconds with 20 queries on phoenix via your IP 54.144.205.182