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)
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?
Can you help answer these questions from other members on NexusFi?
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.
// HH and HL
if (PriceActionSwing(pAS_DtbStrength, pAS_Span, pAS_SwingMode).SwingRelation[0] == 1)
// if (PriceActionSwing(15, 7, SwingTypes.Standard).SwingRelation[0] == 1)
{
// Do something
}
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.
// HH and HL if (PriceActionSwing(pAS_SwingMode, pAS_DtbStrength, pAS_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,
if (price makes a HH/HL)
{
Do this
}
-----EDIT---------
Looks like "swingRelation" is what I need.
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
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).
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?
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?
//#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);
}
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.
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.