Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Use the following code, which is a good way to access the public DataSeries from the PriceActionSwing indicator within other indicators/strategies.
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.
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.
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.
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?
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
// 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